mibuso.com

Microsoft Business Solutions online community
It is currently Sat Nov 01, 2014 12:37 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 10 posts ] 
Author Message
 Post subject: [Solved] Report - IFF statement
PostPosted: Fri Jun 08, 2012 7:23 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
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?

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Fri Jun 08, 2012 8:55 pm 
Offline

Joined: Mon Jan 15, 2007 9:35 pm
Posts: 78
Location: Belgium
Country: Belgium (be)
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.


Top
 Profile  
 
 Post subject: Re: Report - IFF statement
PostPosted: Mon Jun 11, 2012 4:16 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
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 ](*,) :cry:

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Mon Jun 11, 2012 4:59 pm 
Offline

Joined: Mon Dec 20, 2010 9:25 am
Posts: 535
Location: Bergamo
Country: Italy (it)
[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:
Code: Select all
=IIF(Code.GetData(1,1) = "","There isn't a currency","There is a Currency")

_________________
~Rik~
It works as expected... More or Less...


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Mon Jun 11, 2012 6:34 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
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.

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Wed Jun 13, 2012 6:00 am 
Offline

Joined: Thu Jan 14, 2010 4:36 am
Posts: 121
Location: Atlanta,GA
Country: United States (us)
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)))))

_________________
Suresh Kulla
ArcherPoint, LLC http://www.archerpoint.com


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Wed Jun 13, 2012 2:16 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
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)))))

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Fri Jun 15, 2012 1:33 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
anyone have any other work around?

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Thu Jun 21, 2012 5:58 pm 
Offline

Joined: Fri Nov 19, 2010 7:27 pm
Posts: 213
Country: United States (us)
can anyone help me? The only option left is to redo the whole report :( :cry:

_________________
-rico1931


Top
 Profile E-mail  
 
 Post subject: Re: Report - IFF statement
PostPosted: Thu Jun 21, 2012 8:11 pm 
Offline
MVP Microsoft Dynamics NAV
NAV TechDays 2014 attendee

Joined: Mon Apr 04, 2005 2:49 pm
Posts: 251
Location: Sauðárkrókur
Country: Iceland (is)
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.com


Top
 Profile E-mail WWW  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 10 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: Google [Bot] and 9 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum


Search for:
Jump to: