• Resolved andyro

    (@andyro)


    I’d like to allow calculations that return a value below a certain threshold ie. 0.15, but if the value is less than the threshold ie. 0.14, a conditional formatting rule is applied as a gentle error code… ie. font or cell turns red or a text error is thrown that this value is out of range. Is this possible? I am using the dev version.

    The page I need help with: [log in to see the link]

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

    (@codepeople)

    Hello @andyro,

    You have multiple alternatives.

    The easier solution would be to enter 0.15 through the “min” attribute in the calculated field’s settings and tick the checkbox “Validate the equation results”. The plugin will display the error message if the equation result is lower than 0.15.

    Another alternative would be to display the error message directly as part of the equations.

    For example, assuming you have the fieldname1*fieldname2 equation in the calculated field fieldname3 and want to display the error text if the equation’s result is lower than 0.15. In this hypothetical equation, you can edit the equation as follows:

    (function(){
    let result = fieldname1*fieldname2;
    return IF(result < 0.15, 'Error Message', result);
    })()

    You can even modify the field background and color:

    (function(){
    let result = fieldname1*fieldname2, background = 'white', color='#cccc';
    
    if(result < 0.15) {
    background = 'red';
    color = 'white';
    }
    
    getField(fieldname3|n).jQueryRef().find('input').css({'background': background, 'color': color});
    
    return IF(result < 0.15, 'Error Message', result);
    })()

    Additionally, you can insert an “Instruct. Text” field in the form with the error message and configure it as dependent on the calculated field to display it if the equation result is lower than 0.15.

    Best regards.

    Thread Starter andyro

    (@andyro)

    amazing, thanks for the prompt response!

    Thread Starter andyro

    (@andyro)

    The error is thrown on a readonly field, is it possible to modify the preset warning from ‘Please enter a value greater than or equal to 0.15.’ to ‘Value must be greater than X.XX’? Where does this text reside?

    Thread Starter andyro

    (@andyro)

    nevermind – found it!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Conditional format for Errors’ is closed to new replies.