• Resolved Marin Marinov

    (@mpmarinov)


    Hello,

    this plugin is amazing.

    I have a question about Checkboxes: In them we can create 3 names with three different values. My question is: how can I use individual values in Calculated Field?

    Thanks in advance for your attention!

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @mpmarinov

    The checkbox field includes the following attribute in their settings: “Merge ticked up options (sum or concatenation) or their values are returned as an array.”

    If the attribute is ticked, the field’s value would be the sum of the values of the ticked choices.

    If the attribute is unticked, the field’s value would be an array with the values of the ticked choices.

    So, if the attribute is unticked and you want to know if the choice with the value 3 was ticked by the user, you can use a piece of code similar to the following one as part of the equation:

    
    (function(){
    if(IN(3, fieldname1))
    {
    /* The code to evaluate if the choice with value 3 is ticked */
    }
    })()
    

    Best regards.

    Thread Starter Marin Marinov

    (@mpmarinov)

    Okay, but how do I take the value and calculate it with the other field. Could this be like a multi selection to calculate for each value of IN1 ANd IN2 AND IN3 and so on?

    Plugin Author codepeople

    (@codepeople)

    Hello @mpmarinov

    I’m sorry, but I don’t understand the equation you are trying to implement. Could you describe it in detail, please?

    Best regards.

    Thread Starter Marin Marinov

    (@mpmarinov)

    If checkboxes 1 and 3 are marked to calculate the value from 1 in field 1 and from 3 in field 3 then make the sum of fields 1 and 3 in the next field.

    Plugin Author codepeople

    (@codepeople)

    Hello @mpmarinov

    I guess you are referring to dependencies.

    I’ll try to describe the process with a hypothetical example.

    * Assuming, the form includes the checkbox field: fieldname1 with three choices whose values are: 1, 2, and 3, respectively. And three number fields: fieldname2, fieldname3, and fieldname4. Furthermore, you want to sum these fields depending on the choices ticked

    First, create dependencies between the choices in the checkbox field and the number fields (Please, read the following post in the plugin’s blog: https://cff.dwbooster.com/blog/2020/03/01/dependencies/)

    Second, insert a calculated field with the equation:

    
    fieldname2+fieldname3+fieldname4
    

    Because only the active fields participate in the sum.

    If you want to emulate this process without dependencies, the code of the equation would be more complex, as follows:

    
    IF(IN(1,fieldname1), fieldname2, 0)+IF(IN(2,fieldname1), fieldname3, 0)+IF(IN(3,fieldname1), fieldname4, 0)
    

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Checkboxes Field’ is closed to new replies.