• Resolved Steven_Bradburn

    (@steven_bradburn)


    Hello,

    Is there a way to present the results of a calculated field in scientific notation?

    For example, instead of 650,000,000 I want the result to be: 6.5 ✕ 10^8

    Thanks,

    Steven

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

    (@codepeople)

    Hello @steven_bradburn,

    In Javascript the scientific notation corresponding to 650,000,000 would be: 6.5e+8 and can be gotten using the toExponential operation as follows:

    
    Number(650000000).toExponential()
    

    However, you can manage the result as a string to replace e+ with X10^ an get the result in the format you want.

    
    Number(650000000).toExponential().replace('e+', 'X10^')
    

    and that’s all, the result would be: 6.5X10^8

    Best regards.

    Thread Starter Steven_Bradburn

    (@steven_bradburn)

    Hello, Many thanks for the quick reply. Where do I enter the code, would this be in the ‘Set equation’ box? Thanks

    Plugin Author codepeople

    (@codepeople)

    Hello @steven_bradburn,

    Yes, the code should be entered as part of the equation into the attribute: “Set Equation” in the settings of the calculated field.

    For example, if your current equation is: fieldname1+fieldname2, it can be edited as:

    Number(fieldname1+fieldname2).toExponential().replace('e+', 'X10^')

    Best regards.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Display results in scientific notation’ is closed to new replies.