Create a row and reference it at the same button press

Hi everyone!

I have daily reports (stored in a table “Daily reports”, DR), that include daily progress on some metrics. Each metric is an instance from a table “Metrics” (M), and daily progress on metrics is stored in “Progress updates” (PU) table. PU table has columns: “metric” (relation to M), “measurement A”, “measurement B”, etc. It allows me to gather historical data on each metric from different users.

Like this:

Report

  • date
  • Reporter
  • Report on metrics (multi select relation with PU)
    ** Update on metric A (relation to M) | measurement A | Measurement B
    ** Update on metric B (relation to M) | measurement A | Measurement B

I would like to add a button to the DR table that adds a metric C (a row in M) and a new progress update (a row in PU), referencing metric C, and also add it to the current daily report.
From the user point of view it will add a new row in their daily report they are editing:
** Update on metric C (relation to M) | measurement A | Measurement B

I tried RunActions like this:
Action 1: create a row in M
Action 2: create a row in PU and fill the “metric” column with the most recent entry from the M table
But it didn’t work. It appears that action 1 and action 2 are executed simultaneously.

Is it possible to somehow reference the output of Action 1 in Action 2 while using RunActions function? Or is there a better way for achieving the same result?

Hi @Vasily_Skalon,

RunActions runs sequentially in the order written but do not carry values from one action to another.

Thank you for the detailed summary of what you have and what you want it to do. I am not sure the example I have put together does it justice but the core functionality should be there for you to adapt.

Explanation:
You have a Lookup column in your starting table (Daily Reports). It uses ModifyRow and to update that row in Daily Reports and for the value of the lookup we use AddRow. In this way the result of the AddRow which is the new row feeds back into your lookup. The next action does the same thing again but rather than modifying thisRow we are modifying the row now stored in our Lookup column.

I hope that the doc and explanation make sense.

If you would like something more tailed to your exact structure you will need to provide a safe copy of your doc that we can work on. The best method is to create a copy of your doc, delete all rows of data, add some dummy data and then share it. You can find info on sharing here: https://help.coda.io/en/articles/1137949-sharing-your-doc. Be sure to set the sharing tab to “people with link can View” and then copy and paste the code from the Embed tab.

Kind regards

Dale

2 Likes

Well done @Dale_Cowling for this explanation, as usual your examples are really well detailed :slight_smile:

Sincerely,

Thierry

2 Likes

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