Programmatically set column options and select the referenced table

Is there a way for me to programmatically set column options and select the reference table via formula? (ex: RunAction())

I have a table that is populated via a button with RunAction() formula.
When populated, I have a column with values from a look up table. It’s great, but the value becomes grayish as if it cannot find its source lookup table.
I have to manually set column options to select table again.

Thanks in advance!

Hi @candyspecs
Can you send through a demo doc? I’m not able to replicate the issue you’ve raised.

Hi @Jono_Bouwmeester , I’m unable to send a sample Coda page but please see screenshots below.

I have a Favorite Fruits table using cross-doc pack and referencing this from another document “Group Specific Doc”. The Fruit column contains values from a look up table. (See first table in screenshot)

I don’t want to create the pack table coming from “Group Specific Doc” for Fruit column, but instead I already have a Fruits table in my current doc “Master Group doc”. (See 2nd table in screenshot)

I understand that with cross-doc, the references will be broken. Now, I have a local table in “Master Group doc” where I want to copy values from the cross-doc table to a Target table but this time also fixing the references where Fruit column points to Fruits lookup table. (see 3rd table in screenshot)

After clicking “Copy to Target Table” button to populate copy rows from cross-doc table to Target table, I set the Fruit column of the Target Table to be a select list from Fruits table. and the Fruit column values are no longer grayed out and its reference is no longer broken.

However, clicking “Copy to Target Table” breaks the reference again. Is there a way to programmatically set column options and set the column’s lookup table to Fruits.

Or perhaps, how can I copy values of list column to target table with fixed references?
image

Thanks so much!

Hi @candyspecs

I think I’m following what you’re trying to achieve. As you suspect, the issue is the line that you highlighted in the button actions. Here you’re trying to set the fruit column in your target table to the value of the fruit column in favorite fruits.

Here’s the problem. Each item in the fruits column in Favorite fruits is a ROW REFERENCE. So copying it to Target Table is copying that broken reference. Even though the name of that broken reference row matches the name of your local fruits table, Coda just copies that broken reference anyways.

What you need to do is run through those broken references and for each of them, find() a matching row in your local fruits table, then return a list of those rows instead. It sounds complicated because it is actually a little complicated. :slight_smile:

I’ve whipped up a sample doc. Check out the big green button for the relevant formula.

Hope it helps!

2 Likes

@Jono_Bouwmeester, may I request access to the doc, please? Thank you.

Ah flip, sorry about that! :slight_smile: I’ve updated the share settings for the doc so it’s publicly visible now, and I’ve approved your request for edit access.

1 Like

Thank you so much! This solves my concern!

1 Like

Absolute pleasure. It turned out to be quite a fun, tricky little challenge. Glad we managed to come to a solution that worked.

2 Likes

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