Node - Get multiple pieces of data
Function: With this node you can fetch multiple rows of data (multiple rows of records in a worksheet or multiple rows of data in an array). You can modify these records in bulk, or add these multiple rows of data to other worksheets in bulk, or you can pass them to sub-flows for processing.
5 ways to get multiple pieces of data
1. Get records from worksheet
2. Get associated records from records
- In this way, you can get up to 1,000 associated records. If you need to get more than 1,000 associated records, please choose [Get records from worksheet].
3. Get records from [Add new records] node
- With the [Add new records] node you can add records in bulk, so you can get multiple rows of data again from the records added in bulk.
4. Get operation details from manual node
- You can get the operation details of the [Approval] or [Fill in] node, such as the operator, time, signature, etc. In this way what you get is not a record in the worksheet, but multiple rows of data.
5. Getting data from an array of objects
Nodes like [Code block] and [Sending API requests] can output an array of objects, which you can transform into an internal multi-line data structure through this node.
The input parameters of the encapsulated business process may also be arrays of objects, which can be converted into internal multiline data structures through this node in PBP.
Number of rows of data obtained
The [Get multiple pieces of data] node queries all records that meet the conditions, and the number of rows processed is different when used by different nodes.
In the [Add new records], [Update record], [Delete record] nodes, process up to 100 pieces of data (it is recommended to get up to 100 pieces).
Process up to 10,000 pieces of data when passed to the [Subflow] node for processing (it is recommended to get up to 10,000 pieces).
The [Operation] node counts all records that meet the criteria, even if you set the number of records to be obtained in the [Get multiple pieces of data] node.
As shown in the figure below, the query condition set in the [Get multiple pieces of data] node is the record whose number is less than 200. In fact, 199 records meet the condition. Meanwhile, the node is set to obtain a maximum of 90 records. Therefore, the number of records obtained is 199, and 90 rows of records are deleted in batches.
Access mode
Type 1. Direct access
When the process reaches this node, it is calculated directly and the result is kept for subsequent nodes to use. The result is the same for all subsequent nodes.
Type 2. Dynamically acquired each time it is used
The process does not fetch data when it reaches this node, and recalculates when it reaches a subsequent node that needs the obtained results, which may be different for different nodes.
Example: As shown in the figure below
If you select [Direct access], the process is normal. After deleting the target record, you can also continue to write the data to the backup worksheet.
If you select [Dynamically acquired each time it is used], after deleting the target record, the [Add new records] node regains the invalid record, but it has been deleted, so the data cannot be written to the backup worksheet.
Scenario
The worksheet Project is associated with the worksheet Task. A project can be associated with multiple tasks. When you complete the project and mark the status as [Completed], you can get the associated tasks in bulk and then change them to [Completed] as well.
1. Create a workflow triggered by event from worksheet
Select the worksheet Project
Select [Only when updating records]
Set the filter: [Project Status Equal to Finished]
- In this way, the workflow is triggered only when the project status is updated to completed.
2. Add the [Get multiple pieces of data] node
Select [Get associated records from records].
3. Set the node
A: Select the node object
- Select the associated record of which record you want to get. Choose the record that triggered the workflow here.
B: Select the field of association type
- Select a field in an associated worksheet. It must be a multiple-row association, because a worksheet may be associated with fields from multiple other worksheets. Select the associated field [Task] here.
C: Filter
- Filter the associated records to get only the required records.
D: Collation
- Set a sorting rule and return a list of records after sorted by this rule.
E: Limit number
You can set to get up to X rows of data, X can be a fixed value entered manually or you can select a numeric field. For example, when querying data, there are 200 records that meet the condition, but you only need to delete 60 records, you can set to get up to 60. If you do not set the number, the [Get multiple pieces of data] node can only get up to 100 rows, or up to 10,000 rows in a [Subflow] node.
If the obtained records are to be used in nodes such as [Add new records], [Update record], [Delete record] and [Code block], it is recommended to set to get up to 100 records.
If the obtained records need to be passed to subflows, it is recommended to set to get up to 10,000 records.
Save the settings.
4. Bulk update the records
Updated object: Select the multiple records obtained by the second node Updated field: Set task status to finished
5. Publish the workflow
6. Test
Have questions about this article? Send us feedback