Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Dynamic Text(Use Logic Statements in Dynamic Text)
Dynamic Text [message #715293] Sat, 13 August 2011 06:22 Go to next message
karvesh ghunsam is currently offline karvesh ghunsamFriend
Messages: 95
Registered: July 2011
Member
Dear All,
I am currently looking how to use the Dynamic text control in BIRT.

I am having an issue:

I have 3 fields in my dataset: Address1, Address2, Address3

I want to display the 3 fields concatenated in a dynamic text that i set to HTML and Dynamic. The 3 addresses are then separated by a comma (","). Yet, if an address is blank (""), i dont want to show it.

So, in the edit window, i added the following code with a javascript if statement:


if(<VALUE-OF>row["Add1"]</VALUE-OF> == "")
{
"";
}
else
{
<VALUE-OF>row["Add1"]</VALUE-OF> + ",";
}



Unfortunately, it does not seem to work. Could anyone please please advise me here how to use it properly?

Thanking you in advance

Karvesh

Re: Dynamic Text [message #715296 is a reply to message #715293] Sat, 13 August 2011 07:04 Go to previous messageGo to next message
karvesh ghunsam is currently offline karvesh ghunsamFriend
Messages: 95
Registered: July 2011
Member
Dear All,

Myself again. After some searching and struggling, the nearest I could get to is:

<VALUE-OF>if(row["Add1"] == "") {"";}else{row["Add1"]+", \n";}</VALUE-OF> <VALUE-OF>if(row["Add2"] == "") {"";}else{row["Add2"]+", \n";}</VALUE-OF> <VALUE-OF>if(row["Add3"] == "") {"";}else{row["Add3"];}</VALUE-OF>


It seems to handle it ok. The only issue now is that i cannot get the addresses to appear on a separate line. The javascript special character for new line "\n" does not seem to force the following addresses on a new line...

Any idea here please?

Thanks in advance
Karvesh
Re: Dynamic Text [message #715785 is a reply to message #715296] Mon, 15 August 2011 14:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason WeathersbyFriend
Messages: 9167
Registered: July 2009
Senior Member

Try adding +"<br>" and use the format=HTML attribute:

<VALUE-OF format="HTML">if( true){
"<br>";
}</VALUE-OF>

Jason

On 8/13/2011 3:04 AM, karvesh wrote:
> Dear All,
>
> Myself again. After some searching and struggling, the nearest I could
> get to is:
>
> <VALUE-OF>if(row["Add1"] == "") {"";}else{row["Add1"]+",
> \n";}</VALUE-OF> <VALUE-OF>if(row["Add2"] == "")
> {"";}else{row["Add2"]+", \n";}</VALUE-OF> <VALUE-OF>if(row["Add3"] ==
> "") {"";}else{row["Add3"];}</VALUE-OF>
>
> It seems to handle it ok. The only issue now is that i cannot get the
> addresses to appear on a separate line. The javascript special character
> for new line "\n" does not seem to force the following addresses on a
> new line...
>
> Any idea here please?
>
> Thanks in advance
> Karvesh
Re: Dynamic Text [message #715794 is a reply to message #715785] Mon, 15 August 2011 15:08 Go to previous message
karvesh ghunsam is currently offline karvesh ghunsamFriend
Messages: 95
Registered: July 2011
Member
Dear Jason

thanks for the tip. its working!

Karvesh
Previous Topic:MySql Nested Select
Next Topic:Question on log4j configuration for ReportEngine logs when using Viewer
Goto Forum:
  


Current Time: Tue Mar 19 08:14:01 GMT 2024

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

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

Back to the top