Updating "Next" Child Record

Hello Appsheet thinktank!

I have another โ€œthis may be another case of this is so simple I donโ€™t realise itโ€, however:

I am hoping to make an automated data change/automation/ where:

  1. A user โ€œCompletesโ€ child record (by setting the โ€œSTATUSโ€ to "COMPLETED)
  2. On the same row - [ACTIVE LEG] to be changed to โ€œFALSEโ€
  3. On the โ€œNEXTโ€ child record (determined by [LEG NUMBER]), receives a data change (setting the โ€œACTIVE LEGโ€ column to โ€œTRUEโ€)

My difficulty with this is that there is not a pre-determined number of โ€œLEGSโ€ or โ€œCHILDโ€ records (there may be any from 1 to 5 rows)

So far, I have tried using SELECT(), ANY(SELECT)) and even DeReferenceโ€™s in both the action and within virtual columns. I have encountered a range of issues, but still canโ€™t seem to get this working.

To be clear, this is not a case of โ€œWhen an update is made in the parent table, the child record is updatedโ€ it is purely between related child records that are in a specific order.

As always, thank you in advance and more than happy to provide some data structure examples.

0 5 200
5 REPLIES 5

Aurelien
Google Developer Expert
Google Developer Expert

Hi @Ryan_Mortimer

your case looks interesting.
Did you have a look to this post ? the section about PENULTIMATE may inspire you an idea ?

I have just managed to find the time now to sit down and read through this.

Thank you for the link! I will try and make sense of this and see if I can get an answer before anybody else chimes in.

So, based on the expressions that I was tinkering with and the information in the above link:

I have worked out how to reliably select the next โ€œLEGโ€ (by this, I mean returning as a ref instead of a LIST)

ANY(SELECT(LEGS[LEG ID], (AND([_THISROW].[JOB ID] = [JOB ID],[LEG NUMBER] = [_THISROW].[LEG NUMBER] + 1))))

Interestingly enough, when reversing the last half of the AND( expression, it actually worked in reverse by selecting the previous โ€œLEGโ€

Expression that resulted in an error

ANY( SELECT(LEGS[LEG ID], ( AND( [_THISROW].[JOB ID] = [JOB ID], [_THISROW].[LEG NUMBER] = [LEG NUMBER] + 1))))

Interestingly enough, I worked this out on an iPhone so I will have to try to work towards the action portion of this conundrum in the morning.

Steve
Platinum 4
Platinum 4

I imagine using a set of actions for this; I see no reason to use automation.

Steps (1) and (2) can be combined into a single action that the user triggers by pressing a button. Try getting that working, then we can consider step (3).

Hey @Steve !

Thanks for your reply!

I did toy with the idea of actions, but I was struggling with the expression to return the value as a reference to then de-reference the action of setting the next โ€œlegโ€ to โ€œactiveโ€.

I have set the action up for step 1 & 2 (that was the easy part), now I am a little stuck on the third step

Top Labels in this Space