I'm trying to calculate and add 2 new values (tag and label) to every element in an array where the 2nd new value (label) is dependent on the value of the first (tag). Is it possible to set them both in 1 iteration of the Map function?
For example, I use the Map function, do some calculation for every element, then Set the tag value first. After this but still in the same iteration of Map I want to use this newly calculated tag value to also set the label on this same element. Can I do this in a Toddle formula without having to use Map and iterate over the entire array again?
Not a huge deal for what I'm dealing with right now since the arrays are pretty small and it performs it quickly enough, just wondering if it's possible to do it more efficiently or if I should even concern myself with trying to be as efficient with my formulas.
I'm used to traditional coding so looping over the same array twice in a row doesn't feel right to my brain ๐
, I'd instead just use a loop like this:
foreach (element in array) {
element.tag = calculateTag() // calculate tag
element.label = calculateLabel(element.tag) // calculate label based on tag value
}