Toggle navigation
Home
▼ Details
Products and pricing
Chart gallery
User stories
Text analytics
CDC NAMCS Library
Blog
Tutorials
Contact
Sign in
Post Editor
← All help posts
View post
Save
## Two ways to process data in Protobi Protobi has two types of data processes, dynamic and static: - **Dynamic**: Code in the "Pre-calculate" admin tab runs dynamically, and is executed every time you open the project. - **Static**: Code in the "[Data](http://help.protobi.com/adminaccess/project-data#New%20process-1)" admin tab runs only on command, and creates a data table that's accessible to the project <img src="/uploads/upload/image/5200/direct/1596024725413-1596024725413.png" alt="Project settings navigation sidebar showing "Data" highlighted in green and "Pre-calculate" highlighted in blue, indicating these are key sections for configuring static versus dynamic data processing." class="fr-fic fr-dib"> Both methods can be accessed by [admins](http://help.protobi.com/adminaccess/project-permissions#%0APermission%20level-1) in [project settings](/adminaccess/project-settings). Pre-calculate code is run automatically as the project opens, and only on the primary data file. Data processes are run upon request, and can pull from multiple data files. Typically these are programmed in JavaScript. ## Pre-calculate (dynamic) Press on the pre-calculate tab and you will see a code-view page. There is a button to save any changes made. By default, pre-calc already contains the code "return rows;". "rows" is the data table or process that is currently set to primary in the "Data" tab. This line of code should always be in pre-calc because it informs Protobi to retrieve the data upon opening the project. <img src="/uploads/upload/image/5200/direct/1579620687598-1579620687598.png" alt="Project settings Pre-Calculate page displaying a code editor with line 1 showing "return rows;" in purple syntax highlighting. A red-bordered "Save" button and "Advanced users only!" warning appear at the top, indicating this is for programming data transformations that run before analysis." style="text-align: center;" class="fr-fic fr-dib"> **Features** - Is run automatically before the project opens - No additional steps are needed if a data is refreshed - Additional processing time is need to open the project - Can modify project setup or edit element [attributes](http://help.protobi.com/editaccess/edit-json#Attributes-0) - Pre-calc only operates on the "primary" data file **Practical applications** - [Set project default to not show NA](/how-to/how-to-default-not-show-na) - [Remove certain respondents](/110257-process-data-in-protobi/how-to-filter-or-remove-respondents) ## Data process (static) For more complex data changes we recommend [creating a process](http://help.protobi.com/adminaccess/project-data#New%20process-1) under the "Data" tab. Start by pressing the green "New process" button. <img src="/uploads/upload/image/5200/direct/1596024553564-1596024553564.png" alt="Data settings page displaying three sections: Data tables with "+ New data table" and "main" options, a Processes panel showing "+ New process" button and a green "process" button labeled with orange "Primary" tag, and a Documents section below with "+ New document" and "survey doc" options." class="fr-fic fr-dib"> After a data process is created, press "Edit/run" to see the code view. Like the pre-calculate page, there is a button to save changes. Because the code here will only be executed upon request, there is a "Run..." button to apply the code to the data and save the results. Run the process each time changes are made to the code or data files are updated. <img src="/uploads/upload/image/5200/direct/1595866280623-1595866280622.png" alt="Data process editor titled "test_process" (simple) showing JavaScript code with line 1 containing "return data['main']" and multiple comment lines explaining how to define a program that returns row data, with references to data tables being pre-loaded as attributes and a tutorial URL." class="fr-fic fr-dib"> **Features** - Can operate on multiple files, for tasks like merging and stacking - The result of a process is stored as a data file - The data file can be the "primary" file for the project - The file can be downloaded in CSV format *Protobi will soon have capabilities for an asynchronous data process to edit elements* **Practical applications** - [Merge data files](/110257-process-data-in-protobi/tbd-csv-left-join) - Data cleanup - [Create new variables](http://help.protobi.com/110257-process-data-in-protobi/javascript-primer#Common%20Protobi%20data%20processing%20code-5) ## Use the result of a data process as project data In order to use the result of a data process as the datafile for a project, the process needs to be set as "Primary". Click on the process from the data tab and make sure the Primary button is selected (yellow). <img src="/uploads/upload/image/5200/direct/1595934679307-1595934679307.png" alt="Process configuration form displaying fields for Name ("process"), Type ("process"), Process type dropdown set to "Simple", Updated timestamp ("Thu Jun 25, 2020 03:36 pm"), and Filename ("process.csv"). Admin section shows Edit/Run, Delete, and Primary buttons, with download options for Original, CSV, SPSS, and Excel formats." style="width: 345px;" class="fr-fic fr-dib">
Publishing
Date
Status
Published
Draft
Slug
edit
Content
Thumbnail
Categories
Manage
New to Protobi?
Charts
Making Changes
Intermediate topics for editors
Frequently Asked Questions
SERMO Topics
Tutorial Pages
Internal Docs
Data Processing
Videos
Obsolete
GSG Admin
SERMO Admin
GSG Topics
How to...
Basics for viewers
Basics for editors
For project admins
Advanced topics
Assessments
Articles (in-progress)
New and updated articles
Process data in Protobi
superseded
Text open-end questions
Troubleshooting
Tracking studies
Organizing the view
API References
Tools
AI Database
Checking AI...
Convert to MD
Danger zone
Delete