Getting crazy using ":first item" and ":item #1"

Hi! I have an API Workflow that creates one row in a table and then adds new rows copying values of the 1st row every X minutes. So, the 2nd row has to copy some content from the 1st row in the table (the previous row), the 3rd row has to copy the content from the 2nd row, and so on. That’s why I am using the instruction “:item #2” and I order elements as “decreasing: yes” to access the fields from the previous row (instead of using “:item #1”, since this would take the current new row -the most recent one in the table-, rather than the previous one).

This was working for me in the past (or I think so!), but now I notice that when I do this, I get empty values in the 2nd row and all the next even rows, and I only get non-empty values (the copy of the fields from the previous row) in the even rows (they take the values from the 1st row, which I create in a different way, outside this workflow). So it looks like the 2nd row accesses a row that has not been created yet (“position 0”, so before the 1st one in “position 1”), so it’s empty, and it moves those empty values to all the even rows when they are created.

Do you know what can be happening? I guess using “:item #1” is equivalent to use “:first item”, but “first item” is the current item (row), since it’s the latest one created in the database… But I might be wrong! I know it’s a stupid question, but it’s driving me crazy… Thanks! :slight_smile:

Could this be a timing issue, where the copy step is happening before the new record is created? I find that referencing the item just created with “Result of step x” tends to help with this dirty of thing, by forcing the step to wait for the referenced step to finish. Even if you don’t need anything from that previous step you could set a condition on the current step that checks that the created record (“Result of step x”) exists.

This topic was automatically closed after 70 days. New replies are no longer allowed.