Action chain sequencing is failing

Hi all,

I have a set of 4 tables, OrdersCP, Consumable Products, Consumable Packages and Packages. The use case is as follows:

  1. Consumable Products, Consumable Packages are children of (part of) OrdersCP.
  2. A Consumable Package consists of several Consumable Products (each of different quantity.)
  3. An OrderCP contains one or more Consumable Products and one or more Consumable Packages
  4. When a Consumable Package is added to an Order, its constituent Consumable Products need to be added to the Products table.

I have actions defined to do #4 in tables Orders, and PkgItems and it works fine if there is 1 PkgItem in an order but it doesn’t work when there are 2 or more PkgItems in an Order.

The action chain doesn’t seem to process the PkgItems in sequence and creates more lines in Consumable Products than needed.

Here are the actions and some details I have set up.

  1. Action Add Package Items

  2. Action Add to CP Order: loop

  3. Action Add to CP Order: add item

  4. Action Add to CP Order: incr copied

  5. Action Add to CP Order: repeat

This seems like a bug but maybe there is a different way to set it up. I think the repeat action is the culprit but I am not sure.

@Steve @Aleksi @Phil - any suggestions?

Thanks.

I don’t understand what the loop is for? Since you’ve already specified the action to run on all related Consumable Packages. Seems to me like that would create n^2 number of records, instead of n. Maybe I misinterpreted though?

The loop is for copying n items (of Consumable Products) from Consumable Packages to Consumable Products. So, say Pkg1 has 2 items and Pkg2 has 3 items, I need 5 rows in Consumable Products.

Ideally I would like to set it up so that rows in Consumable Packages are processed in sequence (so, Pkg1-Item1, Pk1-Item2, Pkg2-Item1, Pkg2-Item2, Pkg2-Item3) but what I see happening is that it doesn’t. It seems to be doing Pkg1-Item1, Pkg2-Item2, Pkg1-Item2 etc.

Well I can at least respond to that. “Execute an action on a set of records” does NOT execute in serial order. See the following thread

1 Like

Clarification: Does Consumable Packages have an EnumList column where the products are selected, and then you want those to be converted to Consumable Product records?

Thanks for that link to the other thread.

Orders CP has child records of Consumable Packages which are Packages so yes, there is a List of Consumable Packages that each member of the List needs to be processed one after another. I think I need to add a looping variable for that in the actions but not sure where and how.

I have logic for controlling the inner loop but not the outer loop, if that makes sense.

I’m still not quite understanding the data hierarchy, and exactly which data is used to create the records.


One way that I’ve converted an “execute…” action, in order to make it run in serial, is as follows.

Child records in this case already each had a sequence number (1,2,3,4…) for them to be run in. I then added a Y/N Type [Complete?] column to each.

The Parent record had an “execute…” action, which ran the Child’s action, but only on the single record that matched

MINROW( “child” , “sequence number” , NOT( [Complete?] ) )

The Child’s action was a group of 3 actions.

  1. Execute the desired action.
  2. Set [Complete?] to TRUE
  3. Loop. this is an “execute…” action pointing back to the Parent’s “execute…” action.

Cool, thanks @Marc_Dillon. This will work for me, I think. Let me try.

1 Like