Is Coda able to automatically duplicate from a trigger? (new user)

Hello Community!

I am Emmanuel, French, and brand new to CODA. I stayed at Airtable :wink: Now switch to Coda! enjoy

but I don’t know how to do this:

I manage a project with tasks that are fixed.
that is to say for each client 130 tasks to check, to control, … per site

But some of my clients have several sites.

What I would like is when filling out the basic form, an automatic process is triggered.

Form 1:
How many sites do you have?
The client gives the number: 2 (for example).
he indicates in the form the name of each site.

and this is where I would like automation:
Coda automatically adds to the task tracking (general table), the 130 tasks, twice in a row with the name of the corresponding sites.

Is this feasible?
Thanks for your leads

Hi Emmanuel,

Welcome to the community!

It is totally doable with coda. It would be helpful if you would share a dummy doc, so that I can answer more precisely, but anyway I’ll give it a try.

How does the client indicate the name of each site? I will assume you added fields like site1, site2, … , siteN to the form.

You will need to create a table with the 130 task types (TaskTypes), in order to create 130 task instances in the table Tasks for each of the sites.

list(site1, site2, ..., siteN).filter(CurrentValue.IsNotBlank()).forEach(
/*If any of the site fields is blank it won't be considered*/
    CurrentValue.WithName(
        SiteName, /*In the nested forEach, the original CurrentValue is lost, so you need to store it*/
        TaskTypes.forEach(
            Tasks.AddRow(TaskType,CurrentValue,Site,SiteName)
        )
    )
)

Let me know if anything is not clear.

Hope this helps,

Pablo

1 Like

Hello
I am replying late, because it was my first post.
and my account was waiting for validation.
I am traveling, I will return on Friday
and I will test and let you know my feedback.
thank you for taking your time.
have a nice day

Hello
in fact I have this:

1 page with 2 tables (table display)

The client fills in
Your establishments
Name of the establishment | address | postcode | City | tel

Your sites
Name of the site | Type | Establishment | valid site

Establishments drop-down list previous table
Type: other table with the list of types

I do have a table Basic tasks
which contains:
TASKS | Phases

I made an automation that copies the tasks and phases into my general table for each new site

If is true, the rule
continues to the next Step.
[VOS SITES].[SITE VALIDE].Contains(“OUI”)

when
row changed
vos sites
Site valide
Never ends

Run actiat
[TACHES DE BASES].ForEach(
[TACHES DU DEPLOIEMENT].AddRow(
[TACHES DU DEPLOIEMENT].TACHES, CurrentValue.TACHES,
[TACHES DU DEPLOIEMENT].PHASES, CurrentValue.PHASES
)

I’m not taking advantage of the fact that there is no Row add option, only Row changed? (I saw in videos that this existed, it’s on different paid accounts or it no longer exists)

I finally got there, but I am unable to retrieve the name of the site
Because I will need in the global table of the director client that he finds all the tasks for all his sites. And knowing that the tasks have the same names, I need to differentiate them.

Hi Emmanuel,

I think it would be easiest if you create a dummy doc (duplicate it and remove all sensitive data but maintaining the structure), publish it in play mode and put the link here.

After that I’m pretty sure I can help you get it working the way you want.

Pablo

look

i hope you can access
thanks

Hi Emmanuel,

You were almost there.

I changed 2 things in the doc.

  • I changed the field type of Sites in the table [TACHES DU DEPLOIEMENT] from Text to a Relation to the [VOS SITES] table.
    • I see you did the same in many other fields. If the field is supposed to contain an object that is modeled in another table, then it’s much better to use a ‘Relation’ than just a ‘Text’, because it makes it much easier to filter and pull all the attributes with the dot ‘.’ operator, among other reasons.
  • I added one more line to your AddRow() function.
[TACHES DE BASES].ForEach(
  [TACHES DU DEPLOIEMENT].AddRow(
    [TACHES DU DEPLOIEMENT].TACHES, CurrentValue.TACHES,
    [TACHES DU DEPLOIEMENT].PHASES, CurrentValue.PHASES,
    [TACHES DU DEPLOIEMENT].SITE,thisRow.[Step 1 Result]
  )
)

I had not noticed, but Coda shows now a nice explanation of what is [Step 1 Result]

I would recomment to use AddOrModifyRows() instead, because otherwise you risk having duplicate tasks for the same Site.

Hope this helps,

Pablo

1 Like

hello

Thank you very much

When I asked you the question for the When if the ADD Row option
existed or not, because I only have
Row changed
Time Based
Form subm
Webhook

and when I switch SITE VALID from yes to no (because the client warns me that the site is suspended), it adds all the tasks again!
it is not systematic
If I should maybe upgrade to the paid version?

Hi Emmanuel,

The ‘Row added’ trigger doesn’t exist even in paid subscriptions.

That should not happen if you use AddOrModifyRows as I suggested

Actually, if I was you I would not use an automation, but a button in the SITES table. You can disable it under certain conditions and you could also make it behave differently depending if the tasks have already been created or not.

Here you have a little example:

1 Like