Help

Re: Need a foreach function for rollup/array fields

2586 2
cancel
Showing results for 
Search instead for 
Did you mean: 
Andy_Fletcher
5 - Automation Enthusiast
5 - Automation Enthusiast

I have multiple needs for a foreach function that would execute on each element of an array. (Side note, there’s nothing that seems to properly count the number of elements in the array.)

The main example is a Date Field on one table being rolled up into a list of dates on another table. All formatting is removed. The only options in the rollup are array functions after the dates are already joined into the “values” variable in the field. Then the result is not a date and cannot be formatted. If we could do a foreach, there would be a tremendous amount of power available and I could address this situation easily by saying “Do X on each element of the rollup values, then join them together in this format.”

8 Replies 8
Matthew_Chattwo
5 - Automation Enthusiast
5 - Automation Enthusiast

I’d like this too. I want to perform a simple multiplication on each element within an array.

Have you found any workarounds, Andy?

Nope. Haven’t found any solutions yet. A cross-product like you are looking for would be useful as well.

HI
IS there a simple solution for this problem ,after 3 years?

HI Andy
Maybe you found out how to do thay?

The workaround is to perform the operation in a formula field in the original table, then roll up that formula field.

For example, say you want to add 5 to each value on the array before finding the average in a rollup. In the original, table, create a formula field that adds 5 to the original value. Then roll up this new formula field.

Allright
Thank you!!

I complicated a simple issue…

בתאריך יום ד׳, 14 באוק׳ 2020, 18:46, מאת kuovonne via Airtable Community Forum ‏<airtable@discoursemail.com>:



Hi Kuvonne
Thank so much for trying to help.
At the beginning I thought your idea would work but unfortunately it doesn’t.
Here is a problem.
I must multiply each record with a parameter ( not a constant) . The parameter is different for each row.
For the first record it is X, for the second record it is Y,
At the original table , where I took the values, this parameters doesn’t exist. they are not relevant there. so I can’t prepare the data as suggested.
There must be a way to multiply each item in this record array.





image.png


Thanks
Ariel

|

Can you share a little more about your use case?

For example, are there always two values in the array? Could you instead use two conditional lookup fields that each return a single value, then multiply the values by their parameters before doing your final calculations?

Can you pass the multiplier back to the original record as a lookup field and do the multiplication in the original field?