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
## <img src="/uploads/upload/image/5200/direct/1596811917901-1596811917901.png" alt="Protobi data process configuration panel showing a process named 'process' with Type set to 'process' and Process type dropdown set to 'Asynchronous'. The panel displays fields for Name, Type, Process type, Updated timestamp (Fri Aug 07, 2020 10:51 am), Description text area, and Admin action buttons for Edit/Run, Delete, and Make primary." style="width: 355px;" class="fr-fic fr-dib"> ## Asynchronous vs Simple Asynchronous (async) data processes call a wider array of functions than simple processes. You can draw data from multiple independent sources using an async process, and even bring the project elements from one project into another programatically. This is a basic async example that gets the results from one data table and returns it unchanged. ``` Protobi.get_table("main", function(err, rows) { return callback(null, rows) }) ``` Within the async function, you can operate on rows as you would in a simple data process. ``` Protobi.get_table("main", function(err, rows) { rows.forEach(function(row) { // do something for each row... }) return callback(null, rows) }) ``` ## Async functions Asynchronous data processes can access the following utility functions: #### **Protobi.get\_table( key, function(err, rows) { ... })** Gets data from a data table or process within this project. The callback function contains a value **rows** which is an array of row objects representing the table data. If an error occurs, **err** will have a truthy value. #### **Protobi.get\_table( datasetId, key, function(err, rows) { ... })** Gets data from a data table or process within project represented by **datasetId**. The callback function contains a value **rows** which is an array of row objects representing the table data. #### **Protobi.get\_tables( \[keys\], function(err, data) { ... })** Gets data from multiple tables or process within this project. The callback function contains a value **rows** which is a a hash object with keys corresponding to each data table. #### **Protobi.get\_table( datasetId, \[keys\], function(err, data) { ... })** Gets data from multiple tables or process within project represented by datasetId. The callback function contains a value rows which is a a hash object with keys corresponding to each data table. #### **Protobi.set\_table( key, rows, filename, function(err, rows) { ... })** Saves an array of row values as a data table to this project, with a given filename. This allows you to save data to one or more existing or new data tables. If **key** is equal to the key for the process itself, this is akin to calling **callback(err, rows)** . #### **Protobi.set\_table( datasetId, key, filename, function(err, rows) { ... })** Saves an array of row values as a data table to another project specified by datasetId, with a given filename. If datasetId and key are equal to the datasetId and key for the process itself, this is akin to calling **callback(err, rows)** . #### **Protobi.get\_elements( function(err, tabular) { ... })** Returns elements configuration for this project as a collection of live element objects. See the Protobi JSON API for more details. #### **Protobi.get\_elements( datasetId, function(err, tabular) { ... })** Returns elements configuration for a specified project as a collection of live element objects. See the Protobi JSON API for more details. #### **Protobi.left\_join( left, right, \[keys\], \[keeps\])** Merge two arrays of row objects, **left** and **right,** using columns **keys** as merge keys, and retaining specified keep **columns** from the **right** table. This assumes **keys** have the same names in the left and right tables, and **keeps** have retain the same names in the right table and result. This returns a new array of row objects and does change the inputs. #### **Protobi.left\_join( left, right, {keys}, {keeps})** Merge two arrays of row objects, **left** and **right,** using columns in **keys** as merge keys, and retaining specified keep **columns** from the **right** table. The hash structure allows you to refer to different column names for merge keys in the left and right table and change column names when retaining them from the right table into the results. This returns a new array of row objects and does change the inputs. ### Global objects Data processes can also access a number of global libraries: - **d3** (d3js.com) Diverse collection of data utilities - \_ (lodash.com) Diverse collection of common utility functions - **moment** (momentjs.com) Advanced date processing functions ## Advanced support Protobi can handle complex data processing cases, not limited to those that are documented within our tutorials. Our support team is ready to help you with your specific goals. Please contact us at [support@protobi.com](mailto://support@protobi.com) to discuss further.
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