Filtering Row Data [message #104405] |
Wed, 04 January 2006 17:05  |
Eclipse User |
|
|
|
I have a query that returns 4 rows with a column named "code" and the
values of "alpha", "beta", "delta", and "epsilon".
I have a data field in my report such that if this column contains
"delta", I want the value of "found" to be shown in the report,
otherwise "not found" is to be displayed. The following Expression is
not working. How would I go about implementing this behavior?
if (row["code"] == "delta") {
result = "Found";
} else {
result = "Not Found";
}
|
|
|
Re: Filtering Row Data [message #104440 is a reply to message #104405] |
Wed, 04 January 2006 17:26   |
Eclipse User |
|
|
|
You don't need to write code to do what you want. You can use the Visibility
property.
1) Create two text elements. One text element displays "found," the other
displays "not found."
2) Set the visibility property of each element.
To hide the "found" text element, specify this expression: row["code"] !=
"delta"
To hide the "not found" text element, specify this expression: row["code"] =
"delta"
Just remember to think the opposite when specifying the expression because
you are specifying when to hide the element, rather than when to display it.
The text element is hidden when the expression is True.
"Owen Funkhouser" <eclipse@dafunks.com> wrote in message
news:dphgt1$bpp$1@utils.eclipse.org...
> I have a query that returns 4 rows with a column named "code" and the
> values of "alpha", "beta", "delta", and "epsilon".
>
> I have a data field in my report such that if this column contains
> "delta", I want the value of "found" to be shown in the report,
> otherwise "not found" is to be displayed. The following Expression is
> not working. How would I go about implementing this behavior?
>
> if (row["code"] == "delta") {
> result = "Found";
> } else {
> result = "Not Found";
> }
|
|
|
Re: Filtering Row Data [message #104452 is a reply to message #104440] |
Wed, 04 January 2006 18:02   |
Eclipse User |
|
|
|
Thanks. I'm using BIRT v1.0 and it works opposite of what you
suggested. Is it correct to assume that this logic is reversed in v2.0?
Also, is there anyway to programmatically do this? There are some cases
where the possible values displayed are great in number or unknown until
report generation. Therefore, the text option is not a viable solution.
Diana Peh wrote:
> You don't need to write code to do what you want. You can use the Visibility
> property.
> 1) Create two text elements. One text element displays "found," the other
> displays "not found."
> 2) Set the visibility property of each element.
> To hide the "found" text element, specify this expression: row["code"] !=
> "delta"
> To hide the "not found" text element, specify this expression: row["code"] =
> "delta"
>
> Just remember to think the opposite when specifying the expression because
> you are specifying when to hide the element, rather than when to display it.
> The text element is hidden when the expression is True.
>
> "Owen Funkhouser" <eclipse@dafunks.com> wrote in message
> news:dphgt1$bpp$1@utils.eclipse.org...
>
>>I have a query that returns 4 rows with a column named "code" and the
>>values of "alpha", "beta", "delta", and "epsilon".
>>
>>I have a data field in my report such that if this column contains
>>"delta", I want the value of "found" to be shown in the report,
>>otherwise "not found" is to be displayed. The following Expression is
>>not working. How would I go about implementing this behavior?
>>
>>if (row["code"] == "delta") {
>> result = "Found";
>>} else {
>> result = "Not Found";
>>}
>
>
>
|
|
|
Re: Filtering Row Data [message #104480 is a reply to message #104452] |
Wed, 04 January 2006 18:52   |
Eclipse User |
|
|
|
In 2.0, you specify when to hide the element. I don't remember if the
visibility logic was the reverse for 1.0.
Anyway, it is possible to do the same thing programmatically. Here's the
code I attached to a data element, and it worked:
if(row["OFFICECODE"] == "1"){
result = "Office 1";
}
else{
result = "No Office"
}
"Owen Funkhouser" <eclipse@dafunks.com> wrote in message
news:dphk7o$gpd$1@utils.eclipse.org...
> Thanks. I'm using BIRT v1.0 and it works opposite of what you
> suggested. Is it correct to assume that this logic is reversed in v2.0?
>
> Also, is there anyway to programmatically do this? There are some cases
> where the possible values displayed are great in number or unknown until
> report generation. Therefore, the text option is not a viable solution.
>
>
>
>
>
> Diana Peh wrote:
> > You don't need to write code to do what you want. You can use the
Visibility
> > property.
> > 1) Create two text elements. One text element displays "found," the
other
> > displays "not found."
> > 2) Set the visibility property of each element.
> > To hide the "found" text element, specify this expression: row["code"]
!=
> > "delta"
> > To hide the "not found" text element, specify this expression:
row["code"] =
> > "delta"
> >
> > Just remember to think the opposite when specifying the expression
because
> > you are specifying when to hide the element, rather than when to display
it.
> > The text element is hidden when the expression is True.
> >
> > "Owen Funkhouser" <eclipse@dafunks.com> wrote in message
> > news:dphgt1$bpp$1@utils.eclipse.org...
> >
> >>I have a query that returns 4 rows with a column named "code" and the
> >>values of "alpha", "beta", "delta", and "epsilon".
> >>
> >>I have a data field in my report such that if this column contains
> >>"delta", I want the value of "found" to be shown in the report,
> >>otherwise "not found" is to be displayed. The following Expression is
> >>not working. How would I go about implementing this behavior?
> >>
> >>if (row["code"] == "delta") {
> >> result = "Found";
> >>} else {
> >> result = "Not Found";
> >>}
> >
> >
> >
|
|
|
Re: Filtering Row Data [message #104630 is a reply to message #104405] |
Thu, 05 January 2006 03:27  |
Eclipse User |
|
|
|
Hi!
Personally i would stick to function provided by BIRT that perfectly fits
your needs. I am refering to "Map rule". Just click on your Data field in
report designer, open property browser, switch to tab Map, create a new
rule like "if row["myField"] equals "delta" then display value "found".
That's it. I believe this should work also in 1.0.1.
|
|
|
Powered by
FUDForum. Page generated in 0.03675 seconds