• Resolved ramanandmehta

    (@ramanandmehta)


    “fieldname1” is my calculated value field.
    If this number is more than 8 digits, convert it to scientific e notation otherwise show it in normal form.

    if i use this formula: Number(fieldname1).toExponential();
    It converts all value. But I want to do it only if pass the condition.

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

    (@codepeople)

    Hello @ramanandmehta

    Thank you very much for using our plugin. You can use conditional operations in the equation:

    IF(10000000<=fieldname1, DECIMALTOSCIENTIFIC(fieldname1), fieldname1)

    Best regards.

    Thread Starter ramanandmehta

    (@ramanandmehta)

    If I want to conditionally change decimal to scientific or scientific to decimal then how can I achieve this? I am using this code in calculated field value (Fieldname3) but it’s not working:

    if (typeof Fieldname1 === 'number') {
        Fieldname1 = DECIMALTOSCIENTIFIC(Fieldname1);
    } else if (typeof Fieldname1 === 'string' && /^[+-]?\d+(\.\d+)?[eE][+-]?\d+$/.test(Fieldname1)) {
        Fieldname1 = SCIENTIFICTODECIMAL(Fieldname1);
    }
    Plugin Author codepeople

    (@codepeople)

    Hello @ramanandmehta

    Javascript is a case sensitive language. Please enter the fields names in lowercase (fieldname1).

    You can implement the equation as follows:

    
    (function(){
      try{
        return IF(typeof fieldname1 === 'number', 
                DECIMALTOSCIENTIFIC(fieldname1),
                SCIENTIFICTODECIMAL(fieldname1));
      } catch( err ){ return fieldname1; }
    })()

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘If condition passes, convert decimal to scientific e nation’ is closed to new replies.