Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » 3 data columns, one cell and IF statements?
3 data columns, one cell and IF statements? [message #1016787] Thu, 07 March 2013 16:57 Go to next message
Steve Brown is currently offline Steve BrownFriend
Messages: 4
Registered: March 2013
Junior Member
Hi, I'm new to this site, BIRT and Javascript so please be gentle with me! I apologise if this has already been covered but I as I'm new to this, I wasn't sure on the techical terms to search on.

I am converting a report into BIRT and have come across a field that in the old report seems to have an if statement to determine what data is displayed. The statement is saying:

If data in database column customerid does not equal '' (blank, not NULL) then display the data from column customerid...
If data in database column supplierid does not equal '' (blank, not NULL) then display the data from column supplierid...
If data in database column worksorderid does not equal '' (blank, not NULL) then display the data from column worksorderid...
Otherwise display nothing (would like BIRT to display "Not Applicable")

How do I go about writing an expression to do this? All the 3 columns referred to are in one Data Set in BIRT and all are in the same table in the SQL database. As I mentioned I'm a novoice so a step-by-step guide would be really helpful!

Thanks in advance!
Steve
Re: 3 data columns, one cell and IF statements? [message #1016806 is a reply to message #1016787] Thu, 07 March 2013 18:05 Go to previous messageGo to next message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

You could either make a computed column for this, so you could just drag it from your dataSet, or you could put this in a dynamic text box or as a data element's expression, in your table.

if(row["customerid"] != "" && row["customerid"] != null){
row["customerid"];
}
else if(row["supplierid"] != "" && row["supplierid"] != null){
row["supplierid"];
}
else if(row["worksorderid"] != "" && row["worksorderid"] != null){
row["worksorderid"];
}
else{
"Not Applicable";
}

Hope this helps.


Michael

Developer Evangelist, Silanis
Re: 3 data columns, one cell and IF statements? [message #1016947 is a reply to message #1016806] Fri, 08 March 2013 09:55 Go to previous messageGo to next message
Steve Brown is currently offline Steve BrownFriend
Messages: 4
Registered: March 2013
Junior Member
Hi Michael,

Thanks for your quick reply and the code. I've just tried it and it works perfectly! Thank you again Smile
Re: 3 data columns, one cell and IF statements? [message #1017081 is a reply to message #1016947] Fri, 08 March 2013 21:30 Go to previous message
Michael Williams is currently offline Michael WilliamsFriend
Messages: 1925
Registered: July 2009
Senior Member

Great! Let us know whenever you have questions.

Michael

Developer Evangelist, Silanis
Previous Topic:Variable bar width in bar graph
Next Topic:Different header on the first page of report
Goto Forum:
  


Current Time: Tue Apr 16 12:10:27 GMT 2024

Powered by FUDForum. Page generated in 0.30574 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top