RDLC How do I show/hide fields based on boolean

colingbradleycolingbradley Member Posts: 162
edited 2013-03-12 in NAV Three Tier
The client wants to have the option of a summary output without the Unit Price, VAT % or Amount.
I need to suppress printing both the captions and the values based on the boolean.

When the report is run, it sets the global variable vSummary, true or false.

So...
IF vSummary = True then AmountCaption Visibility = False

How and where do you put the code?

Just not at all sure of the syntax or if this is even possible.
:?
Experience is what you get when you hoped to get money

Comments

  • MarijnMarijn Member Posts: 69
    Well. The best approach imho is to avoid the need for code in a viewing layer like a report. Therefore, always try to avoid solving problems in your RDLC definition. For example, if you want to hide a caption if it's corresponding field has no value, declare a global var for the caption and leave it empty when you do not want to display it. Put code like this in the onaftergetrecord trigger:

    IF "External Document No." = '' THEN
    ExternalDocumentNoCaption := ''
    ELSE
    ExternalDocumentNoCaption := FIELDCAPTION("External Document No.");

    Then you don't have to do anything in your RDLC report.

    However, if you do find yourself wanting to hide somehing when designing a RDLC report then you have to write some simple expressions in the value property of the textbox, like this one which will display a Euro sign if the amount is not equal to zero (yes, and when the currecy is dollars too :))

    =IIF(Fields!Sales_Invoice_Line__Line_Amount_.Value <> 0, "€", " ")

    However, if you hide captions you will get gaps in most common situations which looks ugly. The next step would be to assign the captions which are to be displayed to an array and compress it like a typicial navision address array. That will look better.
  • sharadsharad Member Posts: 112
    Hi,

    You can use the following code in Hidden Expression for the Text box of caption

    =IIF(Fields!External Document No_.Value="",TRUE,FALSE)

    it means if Ext. Doc. No is blank then hidden True else false
    Sharad Gupta
    Navision Technical Consultant & .Net Developer
  • colingbradleycolingbradley Member Posts: 162
    Many thanks to both Marijn and Shared.
    I had started off thinking that to control the values in the Classic report but it meant using text vars for the column headings and so on.
    Just thought it may have been simpler to do it in RDLC.
    I think on balance, that the Classic option is the best way to go and then you have consistency when checking the Classic to RTC result.
    :D
    Experience is what you get when you hoped to get money
Sign In or Register to comment.