[FlexSheet] Aggregate with formula

Posted by: james.ingham on 1 December 2019, 4:30 am EST

    • Post Options:
    • Link

    Posted 1 December 2019, 4:30 am EST - Updated 3 October 2022, 6:38 pm EST

    Dear support,

    Having used FlexGrid for years, I am starting to try FlexSheet, which looks pretty nice. Thanks a lot, Wijmo team!

    There’s an issue I met about group aggregate with formula values. I did following to show a column footer to display total aggregates:

    
               // flex is an instance of wjcGridSheet.FlexSheet
    ...
                let row = new wjcGrid.GroupRow();
                flex.columnFooters.rows.push(row);
                flex.bottomLeftCells.setCellData(0, 0, '\u03A3');
    
    

    Then I set aggregate = 1 for all numeric columns. You would see that aggregate does not count values in formula. See the snapshots.

    Is there a way to implement this?

  • Posted 1 December 2019, 4:31 am EST - Updated 3 October 2022, 6:38 pm EST

    Sorry, another snapshot which shows values in formula is not counted:

  • Posted 2 December 2019, 1:04 am EST

    Hi James,

    Thank you for feedback. We really appreciate it.

    Regarding aggregation:

    The aggregation in the formula column does not work properly because the aggregation is done using the actual data and not the data present in the FlexSheet. But in a column containing the formula, the actual data is string type and therefore, a summation cannot be performed on it. But, you can create your own method to aggregate the data and add it to the footer column. Please refer to the sample below:

    https://stackblitz.com/edit/angular-4vse8k

    Regards,

    Ashwin

  • Posted 2 December 2019, 6:44 am EST

    Perfect! Thanks a lot for your help.

    Didn’t know FlexSheet.getCellValue(i, col.index, false) can be used to return evaluated value.

  • Posted 2 December 2019, 7:27 am EST

    Hi James,

    There are many new methods present in FlexSheet. You can refer to the API link for the FlexSheet for more information:

    ~regards

Need extra support?

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

Learn More

Forum Channels