Upvote 1

for each logic

Answered Albertwinsman 5 years ago

Is is possible to have a "for each" loop on an action? Similar to Javascript, where you can iterate through an object and select and manipulate specific children. In my scenario I need to transfer selected elements from one datamaster over to a different datamaster. I have it working so I can transfer and create one selected record at a time (action > datamaster > new + filter expression) but my application requirements allow users to select and assign multiple items at a time. When there are multiple items selected it just concatenates the selected attributes together.

Best Answer
photo

Yes, using "On Variable Change" events, and a variable. The attached prototype is an example. It's a little complicated but here's how it works in general:

  1. When you select a row, it stores the ID of the row (a field in the Data Master) in a text field.
  2. When you edit data in the edit dialog, there's a Data Master Action - Modify event that modifies the first row and then removes the first row's ID from the text field using a substring.
  3. That text field's value is then given to the Variable - so the 'On Variable change' event activates.
  4. The 'On Variable change' event repeats the Data Master Action and keeps removing IDs from the substring until there are no IDs left.

Replies (1)
photo
2

Yes, using "On Variable Change" events, and a variable. The attached prototype is an example. It's a little complicated but here's how it works in general:

  1. When you select a row, it stores the ID of the row (a field in the Data Master) in a text field.
  2. When you edit data in the edit dialog, there's a Data Master Action - Modify event that modifies the first row and then removes the first row's ID from the text field using a substring.
  3. That text field's value is then given to the Variable - so the 'On Variable change' event activates.
  4. The 'On Variable change' event repeats the Data Master Action and keeps removing IDs from the substring until there are no IDs left.

photo
1

Perfect. Thank you for the example. I was able to build out the logic to iterate the substring of IDs so that I isolate and clone each new record from one datamaster to the next datamaster. Thank you for the prompt reply!!

photo
Leave a Comment
 
Attach a file