Dynamically Create X Number of Child Records from Parent EnumList with Only 2 Actions!

Hi @GreenFlux,

Imitation is the sincerest form of flattery and I am trying to imitate your app. My question is how did you configure the workflow rule? Under “Do This” the Data Change Action Name says “OrdersCreateLineItems” but when I try to do something similar I only have the option for “Delete.” I added a trigger column to one of my tables just like yours. Thanks.

1 Like

Hi @tvinci,

The OrdersCreateLineItems action is one I created. There are a few custom actions you have to add before setting up the workflow.

Look under Behavior>Actions and copy the actions I used in my sample before you configure the workflow.

2 Likes

Yup! This is the only problem with this set up. In my case, I just turned on the background sync :slight_smile:

Hi @GreenFlux,

Thanks for your response. Which is the action that populates the Customer column in the Order table with the correct ID? For some reason it stopped populating in my table and I’m trying to fix it. From the front end this means that when a user selects items from the EnumList they are not saved to the “customer” they correspond to. Thanks again :slight_smile:

The Customer is directly filled in by the user. There is no action involved in setting the Customer.

I just checked the sample app and it is working normally. Perhaps you’ve changed something with the Order[Customer] Ref-column, or the Customer table.

Try comparing your current settings with the sample to see what changed.

This is a Great! solution. Thank you.

Is it also possible to create the order and automatically copy ALL products as child records?

I mean without having to select the products within the enumlist?

You can use the SELECT ALL button at the bottom of the EnumList dropdown. This will work without needing to edit the app any further.


Or you could add a New Action to:
Perform an action on a set of rows, and select an action that will:
Add a row to another table using values from this row (from Products to LineItems)

Set the filter to select all the products you want to add. If you want all products, then enter Product[Key].

5 Likes

When the order is changed after the initial create line items will be created double… Is it possible to make sure the child records are only created on the initial create?

You could add a condition to the ‘Form save’ action so that it only runs when:
COUNT([Related Orders]) = 0


FYI- This app is just a demo of the technique for copying EnumList values to individual child records.

It’s not really setup to be the starting point for an inventory app. There are better samples for that here:
https://www.appsheet.com/SampleApps?q=inventory&hPP=100&idx=help&p=0&is_v=1

2 Likes

thanks, i’m using this functionality for my soccer squad. creating the training registraton for players

Hello GreenFlux,

Would you happen to know why certain records populate in the Order table but not in the Line Items table?

Thank you.
Tiffany

Hi @tvinci. I just checked the sample app and it seems to be working normally.

If you’re working with a copy that you have made changes to, it might be better to start a new post describing the issue.

2 Likes

Thanks for the sample! I’ve modified it to address the creation of repeating calendar events within our app. Now we use one calendar event (customer) and create multiple calendar dates (products). Thanks again.

2 Likes

@GreenFlux @Fabian thanks for this work! :clap: :clap: :clap:

Just one question, @Fabian : what is triggering the “OrderTrigger CreateLineItems + Sync” action?

It is not the workflow “OrderAddLineItems”. Thanks again!

Hi @Lucas It’s the Form View “Order_Form”.

1 Like

Many thanks @GreenFlux the solution works well without the need to mimic ‘loops’. Does it also update the order-items if the order is amended and fewer products are chosen? I.e. so the Line item table would need to have Products removed, which were are no longer part of the order.

I have tried some examples using the sample app and from I can tell it doesn’t appear to remove ‘old’ unwanted products.

Thoughts? :thinking: