unable to do arithmetic operations for the fields of pojo class

Posted by: krishnan.m on 11 July 2021, 6:02 pm EST

  • Posted 11 July 2021, 6:02 pm EST

    Consider we have class A as below.
    Class A {
    int x;
    int y
    }


    In the grapecity template, I want the sum of x and y fields.
    I tried the following syntax after adding data source
    {{=ds.x+ds.y}}
    {{==ds.x+ds.y}}
    {{=={{ds.x}}+{{ds.y}}}}
    But none of them seems to be working.
    Pls let whether it is possible to do arithmetic operations for fields of pojo or not.
    If arithmetic operations is possible, pls let me know the syntax.
  • Replied 12 July 2021, 5:28 pm EST

    Hello,

    We are discussing this with the development team and will get back to you with the updates soon.
    [Internal Tracking ID: DOCXLS-4451]

    Regards,
    Prabhat Sharma.
  • Replied 15 July 2021, 10:41 pm EST

    Hello,

    As per the development team the first syntax {{==ds.x+ds.y}} should work properly.
    Are you able to get the values of x and y in the excel file?
    Please provide a stripped-down sample showing what you are doing exactly so that we can assist you further.

    Regards,
    Prabhat Sharma.
  • Replied 19 July 2021, 11:38 pm EST

    Hi,
    I am using grapecity version 4.0.3.
    I can get the values of ds.x and ds.y separately in the excel file. But I am unable to get the sum of ds.x and ds.y by using the syntax {{==ds.x+ds.y}}.

    Pls see attached files and suggest me the right way to do it

    files.zip
  • Replied 20 July 2021, 8:29 pm EST

    Hello,

    Thank you for sharing the files.
    Can you please also share the code snippet that you are using to populate the excel?

    Regards,
    Prabhat Sharma.
Need extra support?

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

Learn More

Forum Channels