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
In [Data processing explained](/process-data/process-data-in-protobi) we reviewed the two types of data processes: 1) [Dynamic](http://help.protobi.com/110257-process-data-in-protobi/pre-calculate-vs-data-processes#Pre-calculate%20\(dynamic\)-4) processes in project pre-calculate and 2) [Static](http://help.protobi.com/110257-process-data-in-protobi/pre-calculate-vs-data-processes#Data%20process%20\(static\)-5) processes in project data. Within static data processes there are two forms, "Simple" and "Asynchronous". # Simple vs Asynchronous A simple data process operates only on data tables in the same project, and returns a single modified table. This tutorial focuses on examples of common simple processes. [Asynchronous](/process-data/asychronous-data-processes) processes are for more sophisticated processing, such as combining data tables from different projects. <img src="/uploads/upload/image/5200/direct/1586120284340-1586120284340.png" alt="Protobi project settings page with two sections. Left sidebar titled 'Project settings' shows menu items: Open, Overview, Wiki pages, Data (highlighted in light blue), Permissions, Elements, Pre-calculate, Downloads, Log, History, Help, Advanced, To do. Right section titled 'Data table' shows configuration form for 'merge' data table with fields: Name (merge), Type (process), Process type dropdown showing 'Simple' selected with 'Asynchronous' option visible, Updated timestamp (Sat Apr 04, 2020 04:14 pm), Filename (simple.csv), Description textarea, and action buttons including blue 'View data online', 'Edit/Run', gray 'Delete', blue 'Make primary', download buttons (Original, Direct, CSV, SAV), 'SPSS syntax' button, and 'Wiki' button" style="text-align: center; width: 569px;" class="fr-fic fr-dii"> # Simple ## Return a data table as rows A "Simple" data process receives a variable **data** which is an object containing the contents of each data table as an attribute. If a project has a data table with key "**main"** the most minimal process would simply return the results in that data table. ``` var rows= data["main"] return rows; ``` ## [Combine waves of data](/process-data/combine-data-using-a-simple-stack) A common data process is to combine waves of data. If a project contains data tables for each wave of the survey, the stacking function seen below will work as a simple data process. ``` var W1 = data["wave1"] var W2 = data["wave2"] var W3 = data["wave3"] var W4 = data["wave4"] var rows = Protobi.stack_rows([W1 ,W2, W3, W4]); return rows; ``` ## Define new variables A slightly more complicated example iterates over each row and defines three new row variables: - **row**.**area** is set to the value of **row.Q1** - **row**.**radius** is calculated from row.**area** - **row**.**rituximab** is either 0 or 1 depending on if the value of **row.A4** matches the text fragment "uximab" ``` var rows = rows.main; rows.forEach(function(row) { row.area = row.Q1; row.radius = Math.sqrt(row.area / Math.PI) // Use Regular Expressions to test for string matches row.rituximab = row.A4.test(/uximab/i) ? 1 : 0; }) ``` **Reminder**: For data processes, "Save" and "Run" the process after you are done editing the code view. To use the result of the process as the primary data for the project, you will need to set it as "Primary". *Data processes are specific to each project, and your code may not look identical to our example.*
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