Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Conditionally show data
Conditionally show data [message #634367] Thu, 21 October 2010 12:48 Go to next message
Mika Tapanainen is currently offline Mika TapanainenFriend
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. PolunskyFriend
Messages: 212
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
Mika Tapanainen is currently offline Mika TapanainenFriend
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: Fri Mar 29 12:36:15 GMT 2024

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

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

Back to the top