I have a relatively simple Project table and Task table. I was able to set up a button on the project table so that when the “category” (select field) is set to “Webinar” the button becomes active and when executed, copies all rows from a webinar template table into the task table. My problem is that I am having trouble expanding on this so that the code works for multiple categories. For example, if the Category is “Event” the tasks copied would either come from a separate template table, or from one giant template table (but only copy those where the category matches). My code for the webinar tasks button looks like this (the modifyrow command is used to deactivate the button once tasks are copied for the given project):
Using an IF clause, I attempted to duplicate this code for addditional categories, however it will not recognize “current” value beyond the first “AddRow” section. I am looking for a way to either 1) have the code copy only those tasks for which Category=x, or 2) copy rows from different tables depending on the category in the project table. Any ideas? Thank you!
Thank you for your reply! I think this leaves me with the same problem, however. I’m new to using this forum, so please let me know if you are able to see my sample doc here. The last row of of the Marketing Projects table (Projects page) has an active button in the last column that copies all rows from the Webinar Task Template table to the Tasks table. This is enabled when Category=Webinar. I’d like to duplicate this functionality for a couple of other Categories and am unsure of the best way to do this (short of creating a separate button for each Category). See my info on my initial attempts above. Thank you for any input!
So, I’ve quickly added a button to your sample doc (thanks for sharing ) implementing the SwitchIf() (See Auto create tasks - 2)
Now, to test this, I’ve just copied/pasted the same series of actions for the case where Category = Webinar and Category = Website as I didn’t know what supposed to happen exactly if the Category in this row was Website (in case the actions would need to be different)
If you need to run the exact same set of actions for multiple categories you could also use something like (See Auto create tasks - 3) :
thisRow.Category = Webinar OR thisRow.Category = Website ,
A set of actions
thisRow.Category = [Paid Campaign],
Another set of actions
thisRow.Category = [Another Category],
yet another different set of actions
The Disable if formula would also need adapted
Note that to select the different categories in the buttons, I’ve @ref directly the specific row stored in your table Category (which can be done by typing @ + at least the 2 first letters of a category in the Editor, Coda will make some suggestions regarding the row(s) you can use).
Add-on ( ) : Regarding what should be done and how it should be done if a Category is for example, Website in “a templated way” , I don’t think there’s really a right or wrong way to do this …
You could perfectly use different tables (1 per category) and change the table to use in your ForEach() for the appropriate category or a big one where each task would be linked to a specific category and use something like this in your Button Formula :
For the sake of completeness and just in case someone else would like to do something similar, here’s a sample somewhat reproducing the desired workflow …
The purpose of the button in the original post was to add “templated rows” to a table depending on the category selected in thisRow, add or manipulated certain values to the brand new rows and mark a checkbox as checked when the button has been pushed (so the button could be disabled)
As this could be done in various ways (depending on the final expected result and the action to perform), I’ve decided to illustrate 3 of those using 3 different buttons … But principles behind that workflow stay the same …
So, in the sample there’s a table storing the different categories, a table storing the “templated rows” where each row has been linked to a specific category, a table called [Add Rows Here] where the templated rows are added (also linked to the table Categories) and the table Test where each row has also be linked to a specific category and where the buttons are …
1st Button ([Add Templated Rows 1]) : Adds a certain quantity of “templated rows” to the table [Add Rows Here] depending on the category selected in thisRow.Category and do somewhat 3 different actions (to some extend) if thisRow.Category = [Category 1], thisRow.Category = [Category 2] or thisRow.Category = [Category 3] … Then, it checks the checkbox [Is Clicked]
2nd Button ([Add Templated Rows 2]) : Adds a certain quantity of “templated rows” to the table [Add Rows Here] depending on the category selected in thisRow.Category but will do the exaction same thing regardless of the category … Then, it checks the checkbox [Is Clicked 2]
3rd Button ([Add Templated Rows 3]) : Works similarly as the 1st button but the action formula is written differently … Then, it checks the checkbox [Is Clicked 3]
(The different Action formulas are visible in the sample, below the [Add Rows Here] table )