Calculation of formula in wijmo flexsheet

Posted by: 94sidharth on 14 November 2017, 4:01 pm EST

    • Post Options:
    • Link

    Posted 14 November 2017, 4:01 pm EST

    I am using calculated fields in my flexsheet. I have to round it off to three decimal places. But currently its automatically rounding off to two decimal places. Can you tell me how to manipulate the number of decimal places. Thank you.

  • Posted 15 November 2017, 3:33 pm EST

    Hi,

    You need to set format to n3 for corresponding column since default format is set to “n2” for Number data type column. Please refer to the code snippet:

    var jdata = JSON.stringify(getData(10));
                var flex = new wijmo.grid.sheet.FlexSheet('#theSheet');
                var cvData=new wijmo.collections.CollectionView(JSON.parse(jdata));
                flex.addBoundSheet("Sheet",cvData);            
                flex.columns.getColumn("downloads").format="n3";
    

    ~Manish

  • Posted 15 November 2017, 4:04 pm EST

    Thank you for you guidance.

    Now I have an another requirement. It is to round of the calculated result only if the number of decimal places is more than 3. That is, if the result is 10.1 then it should come as 10.1 and not 10.100.

    Can you help me on manipulating the evaluated result to meet the above requirement?

    Thank you.

  • Posted 19 November 2017, 4:29 pm EST

    Hi,

    For this, you can use “g” format for the same instead of “n”. In your case, this would be “g3”.

    ~Manish

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels