Hi All,
I am looking to create a button that adds multiple rows to a table based on conditions.
Please see the example below. I want one click of the button to add a unique row for each person in the “People” table and automatically fill in the previous date +3 months (quarterly updates).
In this example, the button should add 4 rows, with each person’s name and the date being 12/30/2023. When the button is clicked again, it should add 4 more rows, with each person’s name and the date being 3/30/2024.
Thanks!
hi @Peyton_Skill1 ,
Welcome to the community and great question, below the code you can put in your button
People.ForEach(
[Quarterly Updates].AddRow(
[Quarterly Updates].Name,CurrentValue,
[Quarterly Updates].Date,[Quarterly Updates].Date.Last().RelativeDate(3)))
Enjoy your evening, cheers, Christiaan
Thank you Christiaan!! I copied this format into my own document and was able to get the button to create one new set perfectly! However, when I tried to click the button again, it created the new rows with the same date as the previous set… any idea why this might be?
yes, I see my mistake
max() is what we need, not last()
People.Name.ForEach(
[Quarterly Updates].AddRow(
[Quarterly Updates].Name,CurrentValue,
[Quarterly Updates].Date,[Quarterly Updates].Date.Max().RelativeDate(3)))
You’re a hero, Christiaan. Thank you!