Skip to main content
Level 3
Sep 12, 2024 4:51 PM UTC
Question

Calculated field with array features

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

Rafal_Bainie
Community Advisor
Community Advisor
Sep 13, 2024 8:52 AM UTC

seems fairly simple

result:

make sure to configure all fields as numbers!

good luck

R

Translate
lgaertner
Level 9
Sep 13, 2024 9:27 AM UTC

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

Translate
ibmfurAuthor
Level 3
Sep 16, 2024 4:36 PM UTC

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!

Translate