Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Replacing one column with another column if null(How to replace column result if null with another column result)
Replacing one column with another column if null [message #1844602] Fri, 17 September 2021 11:11 Go to next message
Stuart Oxley is currently offline Stuart OxleyFriend
Messages: 8
Registered: January 2020
Junior Member
Hi,

I would really appreciate some advice with this

I have two columns which are giving results, one as email addresses and one as contact numbers = telephone, mobile, mobile2.

When the email result is null then the contact number contains a number.

These are separate communication methods from a table in sql.

What I would like to do is create a new computed column for both the email address and the telephone number, when emailaddress is null then replace with contactnumber = contact

I've looked at a few similar questions and found that entering the below script into the birt expression builder is accepted when you click validate, but it is not loading the report in the erp software I am using.

Is the expression itself correct?

if(row["destination"] == null){
row["contact"];
}
else if(row["contactnumber"] == null){
row["contact"];
}
else{
return true;
}


Kind regards,

Stuart
Re: Replacing one column with another column if null [message #1844612 is a reply to message #1844602] Fri, 17 September 2021 14:41 Go to previous messageGo to next message
Jerry Sheets is currently offline Jerry SheetsFriend
Messages: 76
Registered: July 2009
Location: Salt Lake City, UT
Member
You might try something like this

if(row["emailaddress"] == null){
row["contactnumber"];
}
else {
row["emailaddress"];
}

What error are you getting from your erp?
Re: Replacing one column with another column if null [message #1844617 is a reply to message #1844612] Fri, 17 September 2021 16:30 Go to previous message
Stuart Oxley is currently offline Stuart OxleyFriend
Messages: 8
Registered: January 2020
Junior Member
Hi Jerry,

Your script worked, thank you very much, brilliant

The erp I'm using was previously giving me a page cannot be displayed message with my java expression..

Best wishes,

Stuart
Previous Topic:2 FIlters with OR not AND
Next Topic:BIRT with Latest Eclipse Verion
Goto Forum:
  


Current Time: Thu Mar 28 23:19:46 GMT 2024

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

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

Back to the top