Modify multiple rows dynamically from button outside a table

Hi everyone!

I can’t seem to figure this one out. I have a table with a Product Id column and an endpoint that receives a product id and returns a price for it. I have already built a Coda Pack that requests this endpoint with the product id to obtain the price.

I have also created a Select column with a checkbox. What I want to accomplish is to select multiple rows to fetch the prices and upon clicking a button outside the table, it modifies each row by setting the Price column.

This does not work at all, when I click the button, Coda calls the pack function only once with all the information from the selected rows concatenated by commas instead of calling the pack function once for each row and filling the information dynamically.

Is there a way to make this work or is this a limitation? I didn’t want to have to have a button for each row and make the user click it multiple times.

Thanks in advance.

1 Like

Hi Tomas,

Welcome to the community!

Create a button column in the table and have the external button get first the rows you need and then press each row’s button. Something like this: filter(logic_to_get_rows).forEach(currentValue.Button)

Hope this helps,

Pablo

1 Like

Hello @Tomas_Azevedo ,

I made a small demo doc to show you one of the possible options to do this. Copy the doc and check the button code. Make sure to understand the difference between the ‘Name’ fields in the formula: one is currentvalue and one is this row.

Success,
Greetings,
Joost

Thank you for your quick response Pablo!

1 Like

Thank you @joost_mineur ! This worked beautifully!

1 Like

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