Skip to main content

Need a foreach function for rollup/array fields

  • May 10, 2017
  • 8 replies
  • 91 views

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

Forum|alt.badge.img+6

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

Have you found any workarounds, Andy?


  • Author
  • New Participant
  • 4 replies
  • June 27, 2017

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.


  • Known Participant
  • 20 replies
  • October 14, 2020

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

Have you found any workarounds, Andy?


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


  • Known Participant
  • 20 replies
  • October 14, 2020

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


HI Andy
Maybe you found out how to do thay?


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • October 14, 2020

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.


  • Known Participant
  • 20 replies
  • October 14, 2020

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>:


  • Known Participant
  • 20 replies
  • October 14, 2020

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.




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.








Thanks
Ariel

|


kuovonne
Forum|alt.badge.img+29
  • Brainy
  • 6009 replies
  • October 14, 2020

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?