Calculated field with array features | Community
Skip to main content
Level 3
September 12, 2024
Question

Calculated field with array features

  • September 12, 2024
  • 1 reply
  • 817 views

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.

1 reply

Rafal_Bainie
Community Advisor
Community Advisor
September 13, 2024

seems fairly simple

result:

make sure to configure all fields as numbers!

good luck

R

lgaertner
Level 9
September 13, 2024

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

ibmfurAuthor
Level 3
September 16, 2024

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!