RDLC How do I show/hide fields based on boolean

colingbradley
Member Posts: 162
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.
:?
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
0
Comments
-
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.0 -
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 falseSharad Gupta
Navision Technical Consultant & .Net Developer0 -
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.Experience is what you get when you hoped to get money0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions