Expand my Community achievements bar.

Latest Community Ideas Review is Out: Discover What’s New and What to Expect!

Calculated field with array features

Avatar

Level 3

Hello, lovely group,

 

I have two checkboxes: Checkbox A with 3 options and Checkbox B with 2 options.

 

I want to create a calculated field in a custom form that will multiply the number of selected options from Checkbox A by the number of selected options from Checkbox B. For example, if a user selects 2 options from Checkbox A and 3 options from Checkbox B, the result should be 2 * 3 = 6.

 

How can I achieve this since I don't see any functions like LENGTH() that can work with arrays?

4 Replies

Avatar

Community Advisor

seems fairly simple

Rafal_Bainie_0-1726217501970.png

result:

Rafal_Bainie_1-1726217522037.png

make sure to configure all fields as numbers!

good luck

R

Avatar

Level 10

Hello Rafal,

 

I think @ibmfur tried to achieve something else.

The challenge is to find out how many choices are made on each Multi-Select Dropdown and multiply the count with each other.

 

So, with the help of the great solution by @Doug_Den_Hoed__AtAppStore in this thread, you can do something like this:

 

IF(LEN({DE:firstMultiselectField})>0,1+LEN(REPLACE({DE:firstMultiselectField},",",",,"))-LEN({DE:firstMultiselectField}),0) * IF(LEN({DE:secondMultiselectField})>0,1+LEN(REPLACE({DE:secondMultiselectField},",",",,"))-LEN({DE:secondMultiselectField}),0)

 

 

As Doug wrote, the values of the choices in your multi select dropdowns should not contain any commas.

 

Regards

Lars

Avatar

Level 3

Hi Lars,

 

I tried the codes, but I ran into some syntax errors. I'll need to spend some time figuring out why, and I'll probably check out the post you mentioned.

 

Thanks for pointing me in the right direction and letting me know this is doable!

Avatar

Level 3

Just a follow-up, I have managed to solve the errors and everything works beautifully. Thanks again Lars