Expressions in Section Reports - How?

Posted by: amanda.haskins on 8 October 2021, 5:52 am EST

  • Posted 8 October 2021, 5:52 am EST

    Hello everyone!

    I'm on Active Reports 15.2. I have a section report with an XML data source where if Amount 1 is greater than 0, I want the label to say 'Gross', but if not I want the text to say 'Net'.

    In Telerik Reporting, we did this via an Expression with an IIF statement (=IIF(Fields.[Amount1] > 0, "Gross", "Net") right in the label/text box. I'm not finding a way to do that in Active Reports though. I see in the documentation I should be able to, but I haven't found the right place to enter it in yet. Documentation page I'm referring too: https://www.grapecity.com/activereportsnet/docs/v15/online/expressions.html

    Just putting the Expression (modified for Active Reports) as the text for the box gets the box writing out the entire expression as text and that's DEFINITELY not what I want.

    Can anyone help me out? Thank you!
  • Replied 10 October 2021, 4:41 pm EST

    Hello,

    You can refer to the following link:
    https://www.grapecity.com/activereportsnet/docs/v15/online/add-field-expressions.html

    Thanks,
    Mohit
  • Replied 11 October 2021, 6:57 am EST

    mohitg said:
    Hello,

    You can refer to the following link:
    https://www.grapecity.com/activereportsnet/docs/v15/online/add-field-expressions.html

    Thanks,
    Mohit


    Thank you Mohit for the link!

    Unfortunately it's not working as expected and maybe someone can clue me in to what I'm missing. My report source is a variable XML document - by that, I mean sometimes I'll have Amount1 and sometimes I won't (if Amount1 is not 0, I have it - if not, I don't).

    I do see in the link you've sent me this example to check for Null:

    =(UnitsInStock == System.DBNull.Value) ? "No Units In Stock" : UnitsInStock


    So, I am trying to get it to work for me:

    =(Amount1 == System.DBNull.Value) ? 0 : Amount1


    However, I get the following error:

    Control Script failed for control textBox14 , Source=


    I get the error even when I have Amount1 in the datasource.

    Any hints on what I'm missing?
  • Marked as Answer

    Replied 11 October 2021, 6:08 pm EST

    Hello,

    Please refer to the following example.

    Thanks,
    Mohitee.zip
  • Replied 12 October 2021, 3:32 am EST

    Thank you Mohit for all your help!

    I think there's something odd about my way of loading up this XML that's the root of this issue. It's not as straight forward as pointing to an XML file and loading it in. I'll dig into that and if I have any more questions, I'll be sure to ask!
Need extra support?

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

Learn More

Forum Channels