• Resolved tyronius

    (@tyronius)


    Is there a way to display a negative number in parentheses instead of a “-” in front of the number?

    I would like to display (1,000) instead of -1,000

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

    (@codepeople)

    Hello @tyronius

    Thank you very much for using our plugin.

    If you are referring to the calculated field results, you can implement its equation as follows:

    Assuming you have the equation fieldname1-fieldname2, you can edit it as below:

    (function(){
    let result = fieldname1-fieldname2;
    if(result < 0) return '('+ABS(result)+')';
    return result;
    })()

    Best regards.

    Thread Starter tyronius

    (@tyronius)

    Thanks!!! The calculated field now shows the negative value in parentheses, but it does not separate thousands by “,”

    is there a way to show all negative values on a form in parentheses, and use the default “,” separator? I would like to be able to apply this to number fields…not only calculated fields

    here is the form

    https://loanproposal.kobusprinting.com/dir/?cff-form=12

    • This reply was modified 1 year, 3 months ago by tyronius.
    Plugin Author codepeople

    (@codepeople)

    Hello @tyronius

    You must format the number as part of the equation’s code. Continuing with the previous equation, it can be edited as follows:

    (function(){
    let result = fieldname1-fieldname2;
    let args = {groupingsymbol:',', decimalsymbol: '.'};
    
    if(result < 0) return '('+FORMAT(ABS(result), args)+')';
    return FORMAT(ABS(result), args);
    
    })()

    Learn more about the FORMAT operation by reading the following section in the plugin documentation:

    https://cff.dwbooster.com/documentation#mathematical-module

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display Negative Number in Parenthesis’ is closed to new replies.