Find previous record in table and set value

Hi all,
New around here, and really getting to grips with Adalo.

I have a table of sequential timeline phases, say: 1. Start, 2. Confirmed, 3. Prepare, 4. Collected. Each has a start and end time.

How do I set the value of Prepare_Starttime to the value of Confirmed_EndTime?

In other words, the CURRENT stage’s start time should be set to the PREVIOUS stage’s end time.

Thanks so much!
Jaco

Hi @jacoleroux,

Welcome to the forum!

The exact way you can set this depend on your database structure. But in general - you need to use “Update record” action, and you need to have an available current record from which you get the end_time.

If you describe in more details what you’d like to achieve, me or someone else can give more meaningful advice - now it’s not enough info for this :slight_smile:

Best regards, Victor.

Thanks Victor!

I have an Collection named “Stages”, each with sequential records, each with a TimeStart and a TimeEnd. The Collection is displayed in a list:
Screenshot 2022-03-28 at 12.36.56

I want to set CurrentStageRecord.TimeSTART = PreviousStageRecord.TimeEND

When I UPDATE the current record in the list I cant set it to the Time End of the previous record. How do I make the TIMEEND of the previous record available, so I can use it to update the current record?

Hope this makes sense! :slight_smile:

Hi @jacoleroux,

Thanks for the explanation. I can see 2 possible options here:

  1. You can add the TimeStart at a point when you create new Stage. For instance, you have a screen with list of stages, on the most recent stage you have a button “Finish”, which will create a new stage (using the TimeEnd from the current one).

  2. You can store TimeEnd in some “temporary proxy” variable, usually Users collection: e.g. Logged-inUser → TempTimeStorage.
    When you finish the stage (button press), you update this variable with TimeEnd of the finished stage. And when you create a next one, you take the value from this variable.

Best,
Victor.

Thanks Victor, almost there!

That can work if you have to still create the stages, but if the Stages are already created, I can’t update the NEXT stage with current EndTime within the same list.

Hi, you can update the following record by making the “finish” button a list of stages and filter it to be the stage you want to update, this way the button will update the current stage as finished and update the one within it as started

Thanks Benali, how do I set the filter of the “FinishButtonList” to reference the next Stage dynamically?
It will need to reference a different stage each time.

Hi @jacoleroux,

As your stages have IDs, you can use a single-item list approach (as @Benalihoussam mentioned). What you need to add is “previous stage ID” and “next stage ID” properties to the database and put correct stage IDs there.
Then if you have a “Current stage” on some page, you can have 2 single item lists (made from buttons): one list is filtered by StageID is equal to Current Stage → PrevStageID, and another list is filtered by StageID is equal to Current Stage → NextStageID.

Best,
Victor.

Hi Victor,
Goodness, managed to get this right with LOTS of trail and error, but the Adalo interface is seriously confusing with the hierarchy of lists within lists. See example below:

The only way to know which is which is trail and error. What a pain!

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.