• 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 14 replies - 31 through 44 (of 44 total)
  • Thread Starter Asjad Aamir

    (@asjad492)

    I have used it like this:

    (function(){
    IGNOREFIELD(fieldname17|n);
    IGNOREFIELD(fieldname18|n);
    if(AND(fieldname5 == 'Remaining Balance')){
        ACTIVATEFIELD(fieldname17|n);
    } else if(AND(fieldname5 == 'Amount of money')){
        ACTIVATEFIELD(fieldname18|n);
    } 
    })();
    
    The calculated field form in which I inserted this code if fieldname16 and set it to hidden.
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    The plugin replaces the fields’ names in the equation with their corresponding values. The |n modifier, like fieldname17|n, tells the plugin that you are referring to the fields’ names and that it should not replace them with the fields’ values.

    The INGOREFIELD and ACTIVATEFIELD operations do the same dependencies but by code.

    https://cff.dwbooster.com/documentation#managing-fields-module

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Are all these three have same meaning?

    ACTIVATEFIELD(1);
    
    ACTIVATEFIELD('fieldname1|n');
    
    ACTIVATEFIELD('fieldname'+'1');
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    There is an issue in your second alternative, you should not use quotes:

    ACTIVATEFIELD(fieldname1|n);

    And in the third option the quotes in the number are unnecessary:

    ACTIVATEFIELD('fieldname'+1);

    Best regards.

    • This reply was modified 2 years, 2 months ago by codepeople.
    Thread Starter Asjad Aamir

    (@asjad492)

    Can you please tell, German languages don’t work? Now, I’m trying to do same for German language and it isn’t working.

    (function(){
        if(AND(fieldname5 == 'Online kaufen', fieldname7 == 'EEA')){
            return fieldname2*0.00;
        } else if(AND(fieldname5 == 'Online kaufen', fieldname7 == 'Gro?britannien')){
            return SUM(fieldname2*0,fieldname2*0.0129);
        } else if(AND(fieldname5 == 'Online kaufen', fieldname7 == 'USA & KANADA')){
            return SUM(fieldname2*0,fieldname2*0.0199);
        } else if(AND(fieldname5 == 'Online kaufen', fieldname7 == 'Alle anderen L?nder')){
            return SUM(fieldname2*0,fieldname2*0.0299);
        } 
    })();
    Thread Starter Asjad Aamir

    (@asjad492)

    Hi, leave it. Working now

    Thread Starter Asjad Aamir

    (@asjad492)

    Can you please tell how to apply this condition in your previous function that you gave it to me?

    5.00% of the transaction amount or the following minimum / maximum fee:

    • Minimum = 0.99 EUR
    • Maximum = 3.99 EUR
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    If you have an equation, for example, fieldname1+fieldname2 and you want the minimum accepted result be 0.99 and the maximum 3.99, you can use the MAX and MIN operations:

    MAX(MIN(fieldname1+fieldname2, 3.99), 0.99)

    Please, instead of including more and more entries to your support thread not related to the original one, it is preferred to create a new support thread to help other users to find an answer to their questions.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Hi, just one small thing thats why I am not creating new ticket. Can you please tell where I will incorporate that 5%. Actually I want that it either calculate 5% of the amount or minimum 0.99 and maximum 3.99

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    Your question is too general.

    You have two alternatives, you can include it as part of the own equation, or with another calculated field.

    If your equation is fieldname1+fieldname2 it can be re-implemented as follows:

    fieldname1+fieldname2+MAX(MIN((fieldname1+fieldname2)*0.05, 3.99), 0.99)

    Or if you want to implement it with function structure:

    (function(){
    var result = fieldname1+fieldname2;
    return result+MAX(MIN(result*0.05, 3.99), 0.99);
    })()

    If you want to calculate it in another field, and first calculated field is fieldname3, the code could be similar to previous one:

    fieldname3+MAX(MIN(fieldname3*0.05, 3.99), 0.99)

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Hi, I want to use a function. So lets say my function is same as what you initially gave at the very start of this conversation

    (function(){
        if(AND(fieldname5 == 'Online kaufen', fieldname7 == 'EEA')){
            return fieldname2*0.05;
    
    now I want that the return result shows either minimum 0.99 or 5% of fieldname2 value or maximum 3.99 i.e. any of these 3 values. How to do that? 
    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    You only should replace fieldname1+fieldname2; in the following equation with your current function:

    (function(){
    var result = fieldname1+fieldname2;
    return result+MAX(MIN(result*0.05, 3.99), 0.99);
    })()

    I’m sorry, but we cannot implement your project through the WordPress forum.

    If you need a developer to implement your project, you should contact us on the plugin website.

    Best regards.

    Thread Starter Asjad Aamir

    (@asjad492)

    Can you please tell, does IGNOREFIELD function also hides the field?

    Plugin Author codepeople

    (@codepeople)

    Hello @asjad492

    Yes, the IGNOREFIELD operation hides the field and disables it. The ignored fields’ values are managed as zero from the equations and excluded from the form submissions.

    I explained the use of the IGNOREFIELD from your other support thread. It is the reason why I recommended do not merge dissimilar questions because it would be difficult to find their answers.

    Learn more about the IGNOREFIELD and the other Manage Fields operations module by reading the plugin documentation:

    https://cff.dwbooster.com/documentation#managing-fields-module

    Best regards

Viewing 14 replies - 31 through 44 (of 44 total)
  • The topic ‘Applying Dependency for Calculated Fied’ is closed to new replies.