Dynamically Updating an XML Data Structure

Is there a way to dynamically update an XML structure based on the number of inputs? For example, I want to set up a time-based scenario where every 5 days the rows in a google sheet which have the Approval column cell set to “Approved”, and only if the cell has been changed to “Approved” within those 5 days, then the fields within those rows should be inserted into a predefined xml structure. Since the amounts of rows approved won’t be the same every 5 days is there a way to dynamically update the set xml structure based on the amount of rows with the “Approved” status? Each “Approved” row should create one new item under PmtInf.

So whichever system is updating the column to approved needs to also update a new “last updated date time” column. Otherwise there is no way to know which row has been updated within the past 5 days.

2 Likes

So once this updated date time column is added what would be the next step? Add a router with filters depending on the count of updated cells within those 5 days? So if there are only two updates rows then they are directed via the router filter to the xml data structure with two items under PmtInf?

Search for all items with Approved status in the past 5 days.

Add filter to continue if there are more than 5 items.

2 Likes

What would be the objective of that filter to continue? What if in a 5 day period there are 7 rows approved and in another instance there are 9 rows approved? How will the XML data structure automatically adapt to the number of approved rows?

That’s what the Map toggle on each field is for – so you can map an array of items into there.

Every result (item/record) from a search/match module will output a bundle. To “combine” them into a single structure, you’ll need to use an aggregator of some sort.

Aggregators are modules that accumulate multiple bundles into one single bundle. An example of a commonly-used aggregator module is the Array aggregator module. The next popular aggregator is the Text Aggregator which is very flexible and has applies to many use-cases.

The Array Aggregator module allows you to build a complex array of collections for a later module’s field to map multiple items (collections) to it.

Here is an example of using the “Target structure type” of an Array Aggregator module:

As you can see, the “Map” toggle on fields are used when you have an array. You can easily build an array variable to map to a field, by using an Array Aggregator module and select the “Target Structure Type” as the future field you want to map the array into.

2 Likes