Hi guys. I’m currently trying to do something i’ve felt kinda complex.
I’m doing a work calendar for a business. I’ve done a button that, given two dates, it generates one row for each day between those dates for the selected worker.
The problem is, right now it’s only 12 workers, but if it increases, it may get annoying to do. Does anyone know how to use foreach with the sequencer i made so it does generate those rows for each worker? Screenshots here:
You’re not that far from getting your desired result !
Here’s the formula I used in the quickly made sample you’ll find below :
RunActions(
// For each selected worker in [Select Workers] ...
// (Each specific worker in that list being represented by CurrentValue)
[Select Workers].ForEach(
// Store its CurrentValue in the list within the value W so
// we can use it later.
CurrentValue.WithName(W,
// Then, for each date in the sequence, add a row ...
Sequence(Start,End + 1).ForEach(
Table.AddRow(
Table.Workers,
W, // The "Current worker" in the list
Table.Date,
CurrentValue.ToDate()
)
)
)
),
[Select Workers].ResetControlValue()
)
As you can see, you would need to use 2 nested ForEach() (/FormulaMap()) :
The 1st one acts on each specific worker selected in the canvas control and stores its specific value within W (WithName()).
This is done so each specific worker can be referenced within the nested and 2nd ForEach() acting on the sequence of date, like you already did (as in this case, CurrentValue is each specific date within the sequence) .
I left you, as an example, a canvas formula re-creating the list of lists of values the button uses when adding rows to the table, hoping this would help you visualise its action a little bit better
Hi (buenas tardes),
Would like to ask you how do you do to have those colored borders around your “Fecha inicio”, “Fecha Final”, “Trabajador” ?
I’m trying since days to have forms fields grouped into rectangular spaces too but didn’t see how to do so…
I see your table sems to be surrounded by a rectangular colored lines too…
Hi @Anthony_Fernandez_Ferrandiz
I did nothing to color the borders, it’s just the Coda UI designed to color them whenever ur seeing a formula! Look, “Fecha Inicio” is green, in the formula and the border, same with the other fields! I hope some day we can change the color of the borders, but this is not possible yet