How to conditionally load a template in a canvas?

Hi there, I just got started with Coda and love it!
I was wondering: is it possible to fill a canvas with content conditionally, based on another column?

Here’s what I want to achieve:
When creating a new meeting, I want to be able to select what kind of meeting it is. Eg. ‘Onboarding’ or ‘Sprint review’.
Then, based on the value in this column, I want to populate a canvas in the same row with a template that contains the relevant meeting items.

Is this possible? Or is there a better way to do what I’m trying to achieve?

Thanks awesome Coda people :)!

Hi @Freerk_Lap

Find this quick example with a conditionnal format for “value for new rows”.

I would put the select list outside of the table and a button to create the row, for coda to know what template it must use before creating the row

CPT2211111100-949x657

Tell me if this is OK for you.

Of course the template 1 and 2 here are pages in your doc.

Cheers

1 Like

Hi Quentin, that looks like what I was looking for! Thanks so much for that explanation :smiley:

1 Like

Sorry that was very short usually I put more detailed example but I was in a hurry. Happy this was clear enough !

I’m usually pretty quick with these things. It just takes knowing the right proces, and you explained it clearly :smiley:

1 Like

Mmm this is frustrating. Although I get the concept, I’m struggling wit the syntax. I have created a page in my Databases page, which holds the page I want to use as template.

But how can I select this page from my formula? I try to type the title, but it doesn’t appear.
What am I missing?

From the suggestion @Quentin_Morel made earlier, the selection of the template is not done in the button :blush:

The button on the canvas just adds a row to the table and when the row is added, depending on the value in the canvas select list, the template is chosen within the canvas column using SwitchIf() in Value for new rows where you should be able to select the appropriate templated page :blush:

Note that, even in the Value for new rows formula editor in the canvas column, it is not that easy to write a formula using multiple pages … I had to first select all the pages I wanted to use in the SwitchIf() and then write the formula around :woman_shrugging:

Here’s a sample to illustrate :blush:

In this case, the button adds a row and adds the appropriate meeting type to the Meeting lookup field which is then used by the Value for new rows formula editor in the canvas column to select the appropriated page

1 Like

Yes Exactly the same for me. Not that easy but I probably missed something about pages selection.

1 Like

I just had the same thought :joy: … But I don’t think you missed anything …
(It’s kind of reassuring to know that it wasn’t “just me” :sweat_smile: )

Selecting (sub)page(s) has sadly never been easy :confused: … I would have thought though that in a canvas column, it would have been easier than it was …

Maybe it will be improved in the future :wink:

2 Likes

Thanks for your answer! This time it finally did click and I was able to select the pages. Somehow, before, I had a lot of trouble getting the normal pages (instead of tables) to show up in my function options.

1 Like

No problem @Freerk_Lap :blush: !
I honestly didn’t do much here :wink:, just added a detail or two to the thoughtful suggestion of @Quentin_Morel :raised_hands: .

I’m glad to know it helped you to solve your issue :relaxed: .

As far as I know, you can’t reference (sub)page(s) (using something like @Name_of_the_(sub)page) anywhere else than on the canvas (in the content of a canvas column included) or in a text field … both would return the link to the referenced (sub)page(s) … (i.e.: (sub)page(s) can’t be used formulaically)

I think the only exception to this is the Value for new rows formula in a canvas column using the suggestions Coda gives us :blush:

I could be wrong though (It’s been a while since I’ve played around with (sub)page(s) ) but this would explain why you could select (sub)page(s) for the canvas column but not in your button :blush:

Depending on the use case, there could also be workarounds involving the url of the (sub)page(s) but that’s another story :blush:

1 Like

Hi @Freerk_Lap , glad to hear the community was able to assist you! Just wanted to share another Community post on the same topic, which might be helpful to you or others reading this thread.

2 Likes

Great! Thanks. This looks like a comprehensive example.

1 Like

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