Basic if statement RRS feed

  • Question

  • Hi folks

    I do MS D365 F&O development. It so happens that I (actually most developers in my line) very rarely do reporting. And then when one does - it is quite a headache because you know nothing. I have been struggling with an if statement for an hour plus now. Apologies for the basic question - I was hoping that someone can save me a few hours of frustration.

    The DataSet Field details looks like this:

    {I cannot post images - please verify my account. Field type is System.Int32, field name is isBreakdown and Alias is MyDataSet.1.isBreakdown()}

    My method returns an Enumeration of type NoYes (Yes == 1 ; No == 0). I do not understand why this is converted to Int32. Nonetheless, that is okay.

    And then in a ReportAutoDesign -> ReportTable -> Data node of mine I have the following "ReportTableDetailData" element:

    {I cannot post images - please verify my account. The Expression looks like this: =IIF(Fields!isBreakdown.Value = 1, 1, 0)}

    This does not display anything. The column is present when the report is generated, but no values display. I have tried various variations, like "1" or NoYes::Yes or "Yes" instead of 1, Yes instead of "Yes", etc. If I change the expression to ="Yes" then it works.

    What is wrong?

    Thanks for your time.

    Saturday, November 9, 2019 1:49 PM

All replies

  • Hi,

    Why the NoYes type is used in this scenario? Normally we are using Boolean type for this kind of data.

    Your expression seems OK, this problem could be caused by the NoYes type. You could try to convert them into Boolean first.



    MSDN Community Support Please remember to click Mark as Answer; the responses that resolved your issue, and to click Unmark as Answer if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact

    Monday, November 11, 2019 2:45 AM
  • Hi Lukas, thanks for the reply.

    I have not tried boolean yet. The NoYes enumeration is much more useful in my context - I did not create the method for the report, just using it in the report.

    I will test with boolean.

    On second thought about the Int32 - it makes sense that the enum gets converted to Int32. In that case, working with Int32, is my IIF statement still correct? I assume so...

    Tuesday, November 12, 2019 12:05 PM