• Resolved Asjad Aamir

    (@asjad492)


    Hi, I have one field of drop down options and multiple calculated fields. Now, I want that if I select one of the options in a drop down, it only shows a specific calculated field and does not show other calculated fields. How to do that?

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

    (@codepeople)

    Hello @asjad492

    Thank you very much for using our plugin. Assuming you have multiple fields in the form but want to activate only one at once based on the DropDown choices selected.

    You should select the DropDown field and configure the dependencies between its choices and the other form fields.

    Learn more about fields dependency by reading the following blog post:

    https://cff.dwbooster.com/blog/2020/03/01/dependencies

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Hi, it is working for every other field except calculated field.

    Thread Starter Asjad Aamir

    (@asjad492)

    Actually my concern is. that let’s say I have drop-down of different modes of transactions having certain fee. Now, I have made calculated field for each mode of transaction. I want that if i select certain mode of transaction from drop-down, it only shows specific calculated field and hide all other calculated fields.

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    The dependencies work in exactly that way. If you configured every calculated as dependent on a different choice in the Dropdown field, only one calculated field would be visible and active at once.

    However, if the DropDown field determine the fees to apply, or the calculation method, you can implement the process with only one calculated field by using conditional statements in the equation.

    Please, indicate the URL to the page that contains the form to check your dependencies in action.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Is there any way to tell you through video demonstration on zoom or anything? It is too difficult to tell you in text

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    You can record a video and include its link here.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Thread Starter Asjad Aamir

    (@asjad492)

    Anyone?

    Thread Starter Asjad Aamir

    (@asjad492)

    Really disappointing. No one is replying

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    Ok, your problem is different. You want to create rules dependent on multiple fields. To configure complex dependency rules, you must use an auxiliary calculated field.

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

    Assuming you have two dropdown fields, fieldname1 and fieldname2.

    The choices of the fieldname1 field are A and B.

    The choices of the fieldname2 field are C and D.

    Now, assuming you have three other fields, fieldname3, fieldname4, and fieldname5, and you want to active the fieldname3 field if the user selects the choice A, the fieldname4, if the user selects the choice B, and the fieldname5 if the user selects the choices A, and C for fields fieldname1 and fieledname2.

    Insert a calculated field in the form (you can configure as hidden by ticking a checkbox in its settings), and enter the equation:

    (function(){
    IGNOREFIELD(fieldname3|n);
    IGNOREFIELD(fieldname4|n);
    IGNOREFIELD(fieldname5|n);
    if(AND(fieldname1 == 'A', fieldname1 == 'C')){
        ACTIVATEFIELD(fieldname5|n);
    } else if(AND(fieldname1 == 'A')){
        ACTIVATEFIELD(fieldname3|n);
    } else if(AND(fieldname1 == 'B')){
        ACTIVATEFIELD(fieldname4|n);
    }
    })()

    Best regards.

    • This reply was modified 2 years, 2 months ago by codepeople.
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    I’m sorry, I’m answering your questions in less than an hour on holidays, and you’re talking about disappointment in response times?

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Thanks for your response. Can you please tell where to insert this code?

    Thread Starter Asjad Aamir

    (@asjad492)

    And can you please tell where to enter formula like addition or multiplication in this code? as it is a caclulated field, so I have to make a calculation

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492,

    As I indicated in the previous entry, you must use a calculated field as an auxiliary field.

    The code in the previous entry would be the equation in the calculated field (to be entered through the “Set equation” attribute in its settings).

    Note the code is for a hypothetical example. You must adapt the equation to your fields’ names and choices values.

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    The code is to handle the dependencies. Your question now is different. In my opinion, you don’t need multiple calculated fields, even you don’t need dependencies. Your project can be implemented with a unique calculated field and conditional statements.

    Continuing with the previous example, instead of ignore or activate fields you want:

    Sum fieldname3 and 30 field if the user selects the choice A,

    Multiply fieldname3 by fieldname4, if the user selects the choice B,

    Multiply fieldname5 by 15 and summing 10 if the user selects the choices A, and C for fields fieldname1 and fieledname2.

    The fields’ names, numbers, and operations are hypothetical, used only to describe the process.

    In this case, you would need a unique calculated field to calculate the three cases by using the following equation:

    (function(){
        if(AND(fieldname1 == 'A', fieldname1 == 'C')){
            return SUM(fieldname5*15,10);
        } else if(AND(fieldname1 == 'B')){
            return fieldname3*fieldname4;
        } else if(AND(fieldname1 == 'A')){
            return SUM(fieldname3,30);
        }
    })()
    

    Best regards.

    • This reply was modified 2 years, 2 months ago by codepeople.
Viewing 15 replies - 1 through 15 (of 44 total)
  • The topic ‘Applying Dependency for Calculated Fied’ is closed to new replies.