Report - IFF statement

rico1931
Member Posts: 295
Hi everyone,
Does anyone know how to write and iff statement for a report on this expression?
=Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177))))
I've used the below code for my other reports but it seems to not work on the above..
=IIF(Code.GetData(24,3) = "CAD","CAD","USD")
can anyone give me some pointers?
Does anyone know how to write and iff statement for a report on this expression?
=Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177))))
I've used the below code for my other reports but it seems to not work on the above..
=IIF(Code.GetData(24,3) = "CAD","CAD","USD")
can anyone give me some pointers?
-rico1931
0
Answers
-
Can you explain what you're trying todo? Where and why are you using the expression?
=IIF(expression, IfExpressionIsTrueThisIsTheResult,IfExpressionIsNotTrueThisIsTheResult)Debugging is twice as hard as writing code. Therefore if you write the code as cleverly as possible you are by definition not smart enough to debug it.0 -
azerty74 wrote:Can you explain what you're trying todo? Where and why are you using the expression?
=IIF(expression, IfExpressionIsTrueThisIsTheResult,IfExpressionIsNotTrueThisIsTheResult)
Hi,
All i'm trying to do is the following : If there is no Currency code present (meaning "Blank") Show USD..
I'm trying to do this on the Purchasing Order report where they have the following code in the header
=Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177))))
This and the Purchasing quote are the only reports where I find they write the expressions like this. Every other report is much more simpler using the Code.GetData () ...all i want to do is write a simple IIF statement ](*,)-rico19310 -
[quote="rico1931
All i'm trying to do is the following : If there is no Currency code present (meaning "Blank") Show USD..
I'm trying to do this on the Purchasing Order report where they have the following code in the header
[/quote]
Not sure I understood your problem but...
You could try with something like the following:=IIF(Code.GetData(1,1) = "","There isn't a currency","There is a Currency")
~Rik~
It works as expected... More or Less...0 -
ok let me see if I can start over.
=Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177))))
Above is the expression in the text box that returns the Customer Cards Foreign Currency. What I need is a IIF statement that says something like the following
=IIF(Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))) = This part I need help on
We have multiple currency like CAD, EUR, etc.. the above "This part I need help on" I want to put IIF =Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))) = BLANK to always return USD
that's it..
and i've been having a complete brain fart on how to write that part..
I hope this is better explained.. i'm sorry everyone.-rico19310 -
Did you try like this
=IIF(Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))) = "","USD",Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))))0 -
Hi skulla,
Thanks for the reply but this is actually the first thing I tried and I got a syntax error. It doesn't like Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))) being used twice as an expression in the report header.skulla wrote:Did you try like this
=IIF(Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))) = "","USD",Cstr(Choose(16,Split(Cstr(ReportItems!PageHeaderCaptions.Value),Chr(177)))))-rico19310 -
anyone have any other work around?-rico19310
-
can anyone help me? The only option left is to redo the whole report-rico19310
-
Hi Rico
You can use the same approach as in Code.SetData and Code.GetData
If you are already doing a SetData you can simply add this to the code in your Report.
For example if you create a function like this (given that the currency code is in Data1):
Public Function GetCurrencyCode as Object
if Cstr(Choose(16, Split(Cstr(Data1),Chr(177)))) = "" then
Return "USD"
else
Return Cstr(Choose(16, Split(Cstr(Data1),Chr(177))))
end if
Then use Code.GetCurrencyCode in your report________________________________
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com0
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