• Resolved jayceezay

    (@jayceezay)


    Hi! Sometimes when the Calculated Field displays a value that is very large, or very small, the value is represented in scientific notation. Is there a way to “force” the Calculated Field to always display the value in decimal notation?

    • This topic was modified 10 months, 3 weeks ago by jayceezay.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author codepeople

    (@codepeople)

    Hello @jayceezay

    Please use the PREC operation.

    PREC(X, Y) rounds the number X with Y decimals. The PREC operation supports a third parameter with the value true or false (false is the default value). If the third para parameter is true and X is an integer number, the PREC operation returns the integer number without decimals. For example, if you have the operation fieldname1+fieldname2, and you want the result with four decimal places, you can edit it as follows:

    PREC(fieldname1+fieldname2, 4, true)

    Best regards.

    В якому м?сц? цю формулу потр?бно ставити для заокруглення?

    Ось я вставий цю функц?ю до формули. PREC((fieldname9)(fieldname7/100)(0,789/1000)/(fieldname2*fieldname6))

    Як мен? зм?нити цю формулу, щоб показувало в к?нцевомо розрахунку один знак п?сля коми?

    Plugin Author codepeople

    (@codepeople)

    Hello @doradvokat

    Thank you very much for using our plugin.

    The equations are entered through the “Set equation” attribute in the calculated fields, and the PREC operation must be the outermost operation in the equation.

    If you have a simple equation like fieldname1*fieldname2 and want the result with four decimals, the proces is straightforward:

    PREC(fieldname1*fieldname2, 4, true)

    However, in complex equations the process could not be evident.

    For example, in te equation:

    (function(){
    if(fieldname1 < fieldname2) return fieldname1 * fieldname2;
    else return fieldname1/fieldname2;
    })()

    In this case, there are two last operations in the equation, the return instructions. So, you must call the PREC operation in both.

    (function(){
    if(fieldname1 < fieldname2) return PREC(fieldname1 * fieldname2, 4, true);
    else return PREC(fieldname1/fieldname2, 4, true);
    })()
    

    Best regards.

    Plugin Author codepeople

    (@codepeople)

    Hello @doradvokat

    The PREC operation accept thre parameters, the value to round, the number of decimals, and true or false. If the third parameter is true, and the valis an integer, the operation does not include decimals to the result.

    So, if want rhe result with only one decimal place, the equation would be:

    PREC(fieldname9*(fieldname7/100)(0.789/1000)/(fieldname2*fieldname6),1,true)

    Note I included other important modifications in your code like the “*” operator and the correct decimal symbol “.”.

    Please note the plugin support does not cover implementing the users’ projects. If you need the specific implementation of the equations, you should contact us directly through the plugin website:

    https://cff.dwbooster.com/customization

    Best regards.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to force calculated field value to be in decimal notation’ is closed to new replies.