• Resolved supersvetodiod

    (@supersvetodiod)


    Good afternoon! I have two calculated fields. fieldname1 and fieldname2.

    As a rule, both fields always have values.

    But there are cases when one field has a value, and the second does not (equal to zero).

    How can I implement a calculated field that is equal is zero was it not shown in the results of calculations?

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

    (@codepeople)

    Hello @supersvetodiod

    You can use conditional operations o hide the result if zero.

    For example, assuming your current equation is fieldname1+fieldname2, you can edit is as follows:

    (function(){
    var result = fieldname1+fieldname2;
    return IF(result, result, ''); 
    })()

    Best regards.

    Thread Starter supersvetodiod

    (@supersvetodiod)

    With this code, no value is output. But the field itself remains. It is possible to implement somehow so that the field is not shown in the results of calculations

    https://disk.yandex.ru/i/JkWJLqay2h4uRg

    Plugin Author codepeople

    (@codepeople)

    Hello @supersvetodiod

    Assuming the field’s name is fieldname123, you can implement the equation as follows:

    (function(){
    var result = fieldname1+fieldname2;
    
    
    if(result) SHOWFIELD(fieldname123|n);
    else HIDEFIELD(fieldname123|n);
    
    return result; 
    })()

    The plugin replaces the fields’ names with their values before evaluating the equations, the |n modifier tells the plugin you want to use the field’s name instead of its value.

    Best regards.

    Thread Starter supersvetodiod

    (@supersvetodiod)

    if(result) SHOWFIELD(fieldname123|n);
    else HIDEFIELD(fieldname123|n);
    
    return result; 
    })()

    Hmmm… does not work… there is a field 3 that should be displayed or not displayed. I correct field 123 to field 3. And field 3 becomes inactive in no imaginary is not displayed at all under any parameters.

    (function(){
    var result = fieldname1+fieldname2;
    return IF(result, result, ''); 
    })()
    
    

    However, this one works

    Plugin Author codepeople

    (@codepeople)

    Hello @supersvetodiod

    If the calculated field is the fieldname3, the equation would be:

    (function(){
    var result = fieldname1+fieldname2;
    
    
    if(result) SHOWFIELD(fieldname3|n);
    else HIDEFIELD(fieldname3|n);
    
    return IF(result, result, ''); 
    })()

    For additional questions, please, indicate the URL to the page that contains the form to check the equation in action.

    Best regards.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘how to hide a field if the calculation is zero’ is closed to new replies.