Change display text on parameter [message #1843025] |
Mon, 12 July 2021 09:07  |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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   |
Eclipse User |
|
|
|
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 #1843270 is a reply to message #1843039] |
Thu, 22 July 2021 08:21   |
Eclipse User |
|
|
|
Jerry Sheets wrote on Mon, 12 July 2021 22:39It 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   |
Eclipse User |
|
|
|
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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04034 seconds