Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Conditionally show data
Conditionally show data [message #634367] Thu, 21 October 2010 12:48 Go to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 55
Registered: July 2010
Member
Hello,

how to conditionally decide if the particular text is shown?

For example if the column sex has a value "male", show "X" front of it:

Person sex:

X Male
Female

And because the sex column doesn't have a value "female" the "X" front of the Female is not shown.

BR,

Mika
Re: Conditionally show data [message #634373 is a reply to message #634367] Thu, 21 October 2010 13:10 Go to previous messageGo to next message
Richard A. Polunsky is currently offline Richard A. Polunsky
Messages: 199
Registered: July 2009
Location: Houston TX
Senior Member

I have about five different ways to do this. I may be missing a couple.

Use a Data element:

if (dataSetRow["SEX"]=="male") {
"X " + dataSetRow["SEX"]
} else {
dataSetRow["SEX"]
}

Use a Dynamic Text element:

if (row["SEX"]=="male") {
"X " + row["SEX"]
} else {
row["SEX"]
}

Use the Map Rule:

In dropdown select "SEX"
Function select: "Equal To"
Value enter: "male" (NOTE: The quotes here are required!)
Display enter: X - male (NOTE: No quotes here!)

Add a Column to your Query:

select mytable.*,
case when sex = 'male' then 'x - male' else sex end showsex
from mytable

(and use showsex in the report design; note this may fail on nulls)

Add a Computed Column to your Data Set:

Add a new column of data type String, call it ShowSex
Use the following formula:

if (row["SEX"]=="male") {
"X " + row["SEX"]
} else {
row["SEX"]
}
Re: Conditionally show data [message #634374 is a reply to message #634367] Thu, 21 October 2010 13:10 Go to previous message
Missing name Missing name is currently offline Missing name Missing name
Messages: 55
Registered: July 2010
Member
I found the answer by myself. Add the javascript to the text box

sex = "";
if (dataSetRow["sex"] == "male") {
sex = "X";
}
sex;

Mika

[Updated on: Thu, 21 October 2010 13:11]

Report message to a moderator

Previous Topic:Top 8 Business Intelligence Trends
Next Topic:Horizontal span?
Goto Forum:
  


Current Time: Thu Oct 23 22:11:01 GMT 2014

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

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