Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » BIRT » Change display text on parameter
Change display text on parameter [message #1843025] Mon, 12 July 2021 09:07 Go to next message
Mike Delaney is currently offline Mike DelaneyFriend
Messages: 5
Registered: July 2021
Junior Member
Hi,

I am new to BIRT and I have created a parameter for my report to filter by if a document has been sent or not.

In our database 0 = No and 1 = Yes

I want the combo box to show Yes and No instead of 0 and 1

I have used the following code in the expression builder to try get the results

if(params["param_InvSent"] == 1) {
"Yes";
} else {
"No";
}

This gave me 2 no options, i changed it to 1 '=' and this gave me 2 yes options

I have also tried

if(dataSetRow["isdocumentsent"] == 1) {
return "Yes";
} else {
return "No";
}

This gave me no options

I have been putting this in the expression builder on the param itself, is that the correct place for it?

Your help is appreciated.

Thanks.
Re: Change display text on parameter [message #1843039 is a reply to message #1843025] Mon, 12 July 2021 22:39 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
It is not clear why you are trying to do in an expression. The straight forward way to do it is as shown in the attached screenshot. If there is a reason for trying to do it outside of the parameter builder, let me know more detail and I will see if I can help
Re: Change display text on parameter [message #1843047 is a reply to message #1843025] Tue, 13 July 2021 06:59 Go to previous messageGo to next message
Robert Jones is currently offline Robert JonesFriend
Messages: 10
Registered: June 2021
Junior Member
your combo box looks fine. You want the value to be 0 or 1 because that is what the database uses and will filter on. When the combo box is being displayed for parameter entry, you should see Yes/No.

On the dataset, you will do something like

select blah from blat where isdocumentsent = ?

then select your parameter in the dataset parameters tab.

When you display this data, e.g. using a table, you can you use the map property tab on the data field. Select the data field on the table for isdocumentsent that usually says 1 or 0, then in the property editor section, select the map tab, then you can set Yes for condition row["isdocumentsent"] = 1, and No for 0.

You should not have to resort to any such code, you should remove it.
Re: Change display text on parameter [message #1843269 is a reply to message #1843047] Thu, 22 July 2021 08:11 Go to previous messageGo to next message
Mike Delaney is currently offline Mike DelaneyFriend
Messages: 5
Registered: July 2021
Junior Member
Thanks for your help guys. all sorted now
Re: Change display text on parameter [message #1843270 is a reply to message #1843039] Thu, 22 July 2021 08:21 Go to previous messageGo to next message
Mike Delaney is currently offline Mike DelaneyFriend
Messages: 5
Registered: July 2021
Junior Member
Jerry Sheets wrote on Mon, 12 July 2021 22:39
It is not clear why you are trying to do in an expression. The straight forward way to do it is as shown in the attached screenshot. If there is a reason for trying to do it outside of the parameter builder, let me know more detail and I will see if I can help


Thanks for your help with this, i have a separate query which is related here...

I am trying to do the same thing but i have multiple parts that will = yes, is that possible in birt?

To break it down so you better understand:

On my report i have trying to put a yes / no filter on whether an order includes an installation. In our system there are 7 installation options that can be picked. I want the parameter to look at those 7 parts if yes is picked. anything outside of those parts is a No.

I have played around with the SQL query and managed to get the report to show 7 yes's rather than just 1 yes for all items.

I hope this makes sense, i am finding it difficult to get it across clearly.

Thanks.
Re: Change display text on parameter [message #1843298 is a reply to message #1843270] Thu, 22 July 2021 23:14 Go to previous messageGo to next message
Robert Jones is currently offline Robert JonesFriend
Messages: 10
Registered: June 2021
Junior Member
I'm guessing you have 7 parameters now, each a yes/no.

I suppose what you are trying to do (assuming these are all yes/no i.e. 1/0) in the SQL is something like where installopt1 =? or installopt2 = ? or installopt3 = ? .... but that will match any, when you trying to match all, so do you need installopt1 = ? AND installopt2 = ? ....

you may want to share the SQL to explain further.
Re: Change display text on parameter [message #1843368 is a reply to message #1843298] Mon, 26 July 2021 13:06 Go to previous messageGo to next message
Mike Delaney is currently offline Mike DelaneyFriend
Messages: 5
Registered: July 2021
Junior Member
Hi,

Thanks for your reply robert.

I managed to sort this within the SQL by using my query as a table i.e.

SELECT *
FROM (SELECT blah.blah, etc
FROM ????
JOINS
) as x
WHERE
x.blah LIKE ?

Hope this makes sense.
Re: Change display text on parameter [message #1843376 is a reply to message #1843368] Tue, 27 July 2021 00:02 Go to previous message
Robert Jones is currently offline Robert JonesFriend
Messages: 10
Registered: June 2021
Junior Member
I think so, if suspicions were correct, this is where I would have headed next. Anyway, working, means win win :)
Previous Topic:NullPointerException in GroupInformationUtil.getStartingGroupLevel
Next Topic:Will vulnerability be addressed in v4.9?
Goto Forum:
  


Current Time: Thu Apr 25 08:55:04 GMT 2024

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

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

Back to the top