Skip to main content



      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 11:57 Go to next message
Eclipse UserFriend
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 13:05 Go to previous messageGo to next message
Eclipse UserFriend
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.
Re: 3 data columns, one cell and IF statements? [message #1016947 is a reply to message #1016806] Fri, 08 March 2013 04:55 Go to previous messageGo to next message
Eclipse UserFriend
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 16:30 Go to previous message
Eclipse UserFriend
Great! Let us know whenever you have questions.
Previous Topic:Variable bar width in bar graph
Next Topic:Different header on the first page of report
Goto Forum:
  


Current Time: Fri Apr 18 13:36:17 EDT 2025

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

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

Back to the top