web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Microsoft Dynamics NAV (Archived)

expression on report to hide non-Boolean values?

(0) ShareShare
ReportReport
Posted on by

I am trying to create an expression on a sales quote report for the 'hidden' property in visual studio - to hide lines of the quote according to what I specify.

I am using the 'iif(' function which is fine for some things, but also need to show/hide based on whether the sales line type is 'item' or 'resource' and it seems to need a Boolean rather than specifying 'iif(saleslinetype=resource)'.

How can I show/hide the lines I need based on sales line type?

Thank you

*This post is locked for comments

I have the same question (0)
  • Community Member Profile Picture
    on at
    RE: expression on report to hide non-Boolean values?

    I am trying to create an boolean expression on selective vendor bill get to My Report.

    i want that which i select vendor name(boolean) get report vendor name raw field data which i selected not all vendor data.

    please suggest me.

  • Community Member Profile Picture
    on at
    RE: expression on report to hide non-Boolean values?

    Thank you that's very helpful!

  • Natalie Karolak - the BC Docs Librarian Profile Picture
    1,955 on at
    RE: expression on report to hide non-Boolean values?

    Go to data item RoundLoop, trigger OnAfterGetRecord.

    After the third line (SalesLine.NEXT;) insert new lines:

    IF ((A..) AND (B...) AND (C..)) OR

       ((X..) AND (Y...) AND (Z..))

    THEN

      CurrReport.SKIP;

  • Community Member Profile Picture
    on at
    RE: expression on report to hide non-Boolean values?

    Thank you Natalie this is very helpful.

    Please could you help with the CurrReport.SKIP command? - on the sales quote report, where in the C/AL code should this be inserted and are you able to give me an example of how to write it?  I have multiple options - ie hide if a and b and c are true, or also hide if x and y and z are true.

    Thank you!

  • Verified answer
    Natalie Karolak - the BC Docs Librarian Profile Picture
    1,955 on at
    RE: expression on report to hide non-Boolean values?

    Whenever possible, do not pass unneccessary records to RDLC. You can skip those records already in C/AL data items according to current user settings, using the CurrReport.SKIP command.

    Talking about iif: Which data type is required by RDLC, depends only on how the value is passed to RDLC. Thus: you decide already in C/AL.

    When passing option values, it is always best to pass option values as numbers to ensure multilanguage functionality. In order to pass an option value as integer, replace in C/AL SourceExpr SalesLine.Type with FORMAT(SalesLine.Type,0,2). The only disadvantage of passing as integer: it's quite hard to read in RDLC as you will need to know which integer represents which option value.

    In order to hide an element in RDLC, it is not strictly necessary to write an iif statemnt. Just formulate the expression so that it answeres the question: WHEN must be this element hidden? So, instead of =iif(Fields!SalesLineType.Value = 3) you can just write =Fields!SalesLineType.Value = 3. If it needs to be hidden in case of two possible values: =(Fields!SalesLineType.Value = 3) OR (Fields!SalesLineType.Value = 1)

  • Community Member Profile Picture
    on at
    RE: expression on report to hide non-Boolean values?

    Thanks jose,

    But I wanted to avoid having to do this if possible - does anyone know of anything you can do in the expression string or anything?

  • jcastro Profile Picture
    2,245 on at
    RE: expression on report to hide non-Boolean values?

    Hello Threeea,

    One of the easiest ways (although I'll admit not the most elegant one) would be to just have a boolean var in NAV that after getting the record checks for that condition and send that very same var to the report. That way you can use that var which is a Boolean for the property instead of trying to use the type field.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics NAV (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans