Looping with Action

NCD
Silver 2
Silver 2

@MultiTech 

Hi, I've been using your Looping with Action method, and it's working great.

Thank you very much for your AppSheet Knowledge!

 

I was wondering if there are any way to reverse the action, what I mean by it is once you've selected a product by enumlist, it automatically creates the child and grandchild, but if I accidentally checked a product, I would like it to delete once I uncheck that one from the enumlist. 

Is this possible?

Solved Solved
0 6 489
1 ACCEPTED SOLUTION

Aurelien
Google Developer Expert
Google Developer Expert

Hi @NCD 

In my drawing:

- the purple rockets and arrows are for "execute an action on a set of rows"

- the grey arrows are for grouped actions.

I think you got it yet 🙂

 

So, the action "Save | Order" is a grouped action, that will fire:

- "Execute Loop | This order"

- "Auto-delete | Order details"

- "View | This order"

 

On the sample app:

https://www.appsheet.com/templates/How-to-loop-through-a-list-and-create-child-records-for-each-item...

If you have a look to the Action behaviors, you will notice

- "Loop | Create order details" is a "grouped: execute a sequence of actions". It has a condition for triggering.

- "Auto Delete | Order_Details (removed products from order)" is a "execute an action on a set of rows". It actually takes the list of order_details that are NOT in the order table enumList:

 

SELECT([Related Order_Details][OrderDetailID], 
  NOT(
    IN([OrderDetail_Product], [_THISROW].[Order_Products])
  )
)

 

 It also has a condition, which is, in plain text: "above list expression is not blank".

Aurelien_0-1650957501450.png

 

Does that help you to get your (2) ?

View solution in original post

6 REPLIES 6

Aurelien
Google Developer Expert
Google Developer Expert

Hi @NCD 

 

I allow myself to intervene, as I used his amazing sample app as well.

It's the auto-delete action part.

I made a drawing in order to better visualize the actions (I'm more of a visual worker...):

Looping with Actions (MV).png

That does not work for you ?

Thank you, seems like it should work!

Though I'm not fully confident I understand the steps.

(1) Create a delete this row action on order_details table

(2) Create a execute an action on a set of rows action on orders table

(3) Create a Grouped action consisting the Loop Grouped Action & the Auto Delete Action

If I'm correct I do not fully understand what I need to do for (2) !

Aurelien
Google Developer Expert
Google Developer Expert

Hi @NCD 

In my drawing:

- the purple rockets and arrows are for "execute an action on a set of rows"

- the grey arrows are for grouped actions.

I think you got it yet 🙂

 

So, the action "Save | Order" is a grouped action, that will fire:

- "Execute Loop | This order"

- "Auto-delete | Order details"

- "View | This order"

 

On the sample app:

https://www.appsheet.com/templates/How-to-loop-through-a-list-and-create-child-records-for-each-item...

If you have a look to the Action behaviors, you will notice

- "Loop | Create order details" is a "grouped: execute a sequence of actions". It has a condition for triggering.

- "Auto Delete | Order_Details (removed products from order)" is a "execute an action on a set of rows". It actually takes the list of order_details that are NOT in the order table enumList:

 

SELECT([Related Order_Details][OrderDetailID], 
  NOT(
    IN([OrderDetail_Product], [_THISROW].[Order_Products])
  )
)

 

 It also has a condition, which is, in plain text: "above list expression is not blank".

Aurelien_0-1650957501450.png

 

Does that help you to get your (2) ?

r (copy).png

I can't get it to work in my situation 😞

I'm testing as an Overlay action at the moment, and the button shows up because the Product Table's enum list column does not contain the "S" but when I click the button it does not delete the "S" row from the size table.

Is something wrong with my Referenced Row's expression?

Aurelien
Google Developer Expert
Google Developer Expert

I think so.  Can you try:

SELECT([Related Sizes][id],NOT(IN(...))

 

Worked perfectly, as always thank you very much for your help, I'm learning a lot 🙂

Top Labels in this Space