Button to add rows only to rows with unique value?

Boy could I use some help!

I have a list of stocks, and each stock has a set of dated entries. Is there a way I can create a button to add just one new row for each stock without adding a new row for every entry for every stock?

FWIW, the latest entry for each stock has value “Latest” in a Timing column, and I’ve tried using filters and If statements in a formula for the button, but I just can’t figure out how to make it work.

Or is a button even the right way to do this?

Any suggestions?

Many thanks!

Gregg

Hey @Gregg_Stebben !

Im a little confused on your question? Could you provide more details or an example doc with the issue?

My initial idea would be doing something like: stockTable.stocks.unique().formulaMap(addRow())

Hey @Scott_Collier-Weir !

Thank you for your help!

Because my table has a lot of personal info in it, I would have to make a copy and delete a lot of things to share…before I do that, I am going to try a screenshot.

Basically I want to add a new row for each stock (CEVA, CRSP, CRWD) but if I make a button to Add Row it adds a row for every entry…so I get 4 new rows for CEVA, 4 new rows for CRSP and 3 new rows for CRWD.

I thought maybe I could use a filter or If statement in a button to only add rows where the value of Timing is “Latest” because there is only one row with value “Latest” per stock. But I couldn’t make it work, and maybe it’s a bad idea anyway??? :wink:

The orange button on each row allows me to manually add a new row to any given row…and I tried adding a button to hit those buttons, but the button to push buttons hits all the buttons so I get too many new rows! And I also tried to filter or use an If statement to just add a new row with value “Latest” but I couldn’t make that work either.

Does that help?

Bottom line is I want some way to add one new row for each stock, and it doesn’t really matter if it’s a button or some other approach.

Thank you again for any help you can offer!

Gregg

Great! It still seems like my suggestion above with the example filter would work inside of a button, you would just have to define what table you want the rows added to.

Essentially what that formula inside of a button would do is look at your Stocks table, find each unique entry, then add a row for each unique entry to another table

2 Likes

Hey, @Scott_Collier-Weir , this was a great solution…and after I got everything working I realized there was another approach that’s even more simple and elegant. I went into the settings for the orange button and disabled the button for values Not Recent and Recent Three. Then I created a button to hit the orange buttons that were left which gave me exactly the filter I was looking for. But I only figured this out thanks to you!


Gregg

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