Skip to main content



      Home
Home » Archived » BIRT » Hiding chart on empty DataSet (please! have asked twice before)
Hiding chart on empty DataSet (please! have asked twice before) [message #178912] Wed, 19 July 2006 13:53 Go to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

I desperately need help on a problem I have asked about a couple of times.
My deadline is almost here.

I need a way to show an image instead of a chart (or any other entity in the
palette for that matter) if the DataSet is empty (valid query with no rows
returned).

Please, please help.

thx,
-d.
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #178938 is a reply to message #178912] Wed, 19 July 2006 16:50 Go to previous messageGo to next message
Eclipse UserFriend
There may be a better way of doing this, but what I did was to add a table
and put the chart in the header row.
I then set the chart to inherit the data from the container.

Next I put in a variable in my initialize called rwc and set it equal to 0.
I then added rwc+=1 to the onFetch method of the data set.

Finally I added a visibility condition on the table with the following
value:
if( rwc > 0 ){

false

}else{

true

}

I then added a text label below the table with a visibility property that is
opposite of the above.


Attached is the example. To see it work preview with the Web Viewer. Enter
119 as a parameter to see the chart.
Enter 111 (nulls the data set) to see the message.

Jason



"Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
news:e9lrie$t5j$1@utils.eclipse.org...
>I desperately need help on a problem I have asked about a couple of times.
> My deadline is almost here.
>
> I need a way to show an image instead of a chart (or any other entity in
> the
> palette for that matter) if the DataSet is empty (valid query with no rows
> returned).
>
> Please, please help.
>
> thx,
> -d.
>
>


Re: Hiding chart on empty DataSet (please! have asked twice before) [message #179123 is a reply to message #178938] Thu, 20 July 2006 11:37 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

Hi Jason -

First of all, I greatly appreciate your reply!

The example you sent would not work for me:

Data (id = 22):
- There are errors evaluating script "row["[result_set_col_name]"]".

However, I took your idea and ran with it a bit. I've attached a report I
created that illustrates my findings (the actual report I was working on was
way too bloated to have you look at it). I did an extensive search of both
the forums and the bug reports and came across the Total.count() property.
You can see in the attached report that Total.count() works great for
showing the Dynamic Text in place of the graph - so that would seem to solve
the one problem rather well. However, for some unknown reason (well, to me)
you can't script Total.count() in the onPrepare method of the Dynamic Text
(you can see where I commented it out) even though you can place it in the
actual expression.

I tried your idea of setting a variable on initialize, and then changing it
from the onFetch method of the DataSet. Didn't work. Thought maybe I had
to declare a global variable using reportContext. That didn't work either.

So instead of being able to script the Dynamic Text based on the DataSet, it
seems like I'm stuck with having two of them and setting the visibility on
each so I have one for when there's data and one for not data. Is this a
possible bug?

Anyway, thanks again for the help. I really do appreciate it.

best,
-d.

"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:e9m5tp$c56$1@utils.eclipse.org...
> There may be a better way of doing this, but what I did was to add a table
> and put the chart in the header row.
> I then set the chart to inherit the data from the container.
>
> Next I put in a variable in my initialize called rwc and set it equal to
> 0.
> I then added rwc+=1 to the onFetch method of the data set.
>
> Finally I added a visibility condition on the table with the following
> value:
> if( rwc > 0 ){
>
> false
>
> }else{
>
> true
>
> }
>
> I then added a text label below the table with a visibility property that
> is
> opposite of the above.
>
>
> Attached is the example. To see it work preview with the Web Viewer.
> Enter
> 119 as a parameter to see the chart.
> Enter 111 (nulls the data set) to see the message.
>
> Jason
>
>
>
> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
> news:e9lrie$t5j$1@utils.eclipse.org...
>>I desperately need help on a problem I have asked about a couple of times.
>> My deadline is almost here.
>>
>> I need a way to show an image instead of a chart (or any other entity in
>> the
>> palette for that matter) if the DataSet is empty (valid query with no
>> rows
>> returned).
>>
>> Please, please help.
>>
>> thx,
>> -d.
>>
>>
>
>
>


Re: Hiding chart on empty DataSet (please! have asked twice before) [message #179124 is a reply to message #179123] Thu, 20 July 2006 11:39 Go to previous messageGo to next message
Eclipse UserFriend
Danny,

What version of BIRT are you using?

Jason

"Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
news:e9o7v2$d9g$1@utils.eclipse.org...
> Hi Jason -
>
> First of all, I greatly appreciate your reply!
>
> The example you sent would not work for me:
>
> Data (id = 22):
> - There are errors evaluating script "row["[result_set_col_name]"]".
>
> However, I took your idea and ran with it a bit. I've attached a report I
> created that illustrates my findings (the actual report I was working on
> was way too bloated to have you look at it). I did an extensive search of
> both the forums and the bug reports and came across the Total.count()
> property. You can see in the attached report that Total.count() works
> great for showing the Dynamic Text in place of the graph - so that would
> seem to solve the one problem rather well. However, for some unknown
> reason (well, to me) you can't script Total.count() in the onPrepare
> method of the Dynamic Text (you can see where I commented it out) even
> though you can place it in the actual expression.
>
> I tried your idea of setting a variable on initialize, and then changing
> it from the onFetch method of the DataSet. Didn't work. Thought maybe I
> had to declare a global variable using reportContext. That didn't work
> either.
>
> So instead of being able to script the Dynamic Text based on the DataSet,
> it seems like I'm stuck with having two of them and setting the visibility
> on each so I have one for when there's data and one for not data. Is this
> a possible bug?
>
> Anyway, thanks again for the help. I really do appreciate it.
>
> best,
> -d.
>
> "Jason Weathersby" <jweathersby@actuate.com> wrote in message
> news:e9m5tp$c56$1@utils.eclipse.org...
>> There may be a better way of doing this, but what I did was to add a
>> table
>> and put the chart in the header row.
>> I then set the chart to inherit the data from the container.
>>
>> Next I put in a variable in my initialize called rwc and set it equal to
>> 0.
>> I then added rwc+=1 to the onFetch method of the data set.
>>
>> Finally I added a visibility condition on the table with the following
>> value:
>> if( rwc > 0 ){
>>
>> false
>>
>> }else{
>>
>> true
>>
>> }
>>
>> I then added a text label below the table with a visibility property that
>> is
>> opposite of the above.
>>
>>
>> Attached is the example. To see it work preview with the Web Viewer.
>> Enter
>> 119 as a parameter to see the chart.
>> Enter 111 (nulls the data set) to see the message.
>>
>> Jason
>>
>>
>>
>> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
>> news:e9lrie$t5j$1@utils.eclipse.org...
>>>I desperately need help on a problem I have asked about a couple of
>>>times.
>>> My deadline is almost here.
>>>
>>> I need a way to show an image instead of a chart (or any other entity in
>>> the
>>> palette for that matter) if the DataSet is empty (valid query with no
>>> rows
>>> returned).
>>>
>>> Please, please help.
>>>
>>> thx,
>>> -d.
>>>
>>>
>>
>>
>>
>
>
>
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #179125 is a reply to message #179124] Thu, 20 July 2006 11:42 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

2_1_0 (release)

"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:e9o839$ep2$1@utils.eclipse.org...
> Danny,
>
> What version of BIRT are you using?
>
> Jason
>
> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
> news:e9o7v2$d9g$1@utils.eclipse.org...
>> Hi Jason -
>>
>> First of all, I greatly appreciate your reply!
>>
>> The example you sent would not work for me:
>>
>> Data (id = 22):
>> - There are errors evaluating script "row["[result_set_col_name]"]".
>>
>> However, I took your idea and ran with it a bit. I've attached a report
>> I created that illustrates my findings (the actual report I was working
>> on was way too bloated to have you look at it). I did an extensive
>> search of both the forums and the bug reports and came across the
>> Total.count() property. You can see in the attached report that
>> Total.count() works great for showing the Dynamic Text in place of the
>> graph - so that would seem to solve the one problem rather well.
>> However, for some unknown reason (well, to me) you can't script
>> Total.count() in the onPrepare method of the Dynamic Text (you can see
>> where I commented it out) even though you can place it in the actual
>> expression.
>>
>> I tried your idea of setting a variable on initialize, and then changing
>> it from the onFetch method of the DataSet. Didn't work. Thought maybe I
>> had to declare a global variable using reportContext. That didn't work
>> either.
>>
>> So instead of being able to script the Dynamic Text based on the DataSet,
>> it seems like I'm stuck with having two of them and setting the
>> visibility on each so I have one for when there's data and one for not
>> data. Is this a possible bug?
>>
>> Anyway, thanks again for the help. I really do appreciate it.
>>
>> best,
>> -d.
>>
>> "Jason Weathersby" <jweathersby@actuate.com> wrote in message
>> news:e9m5tp$c56$1@utils.eclipse.org...
>>> There may be a better way of doing this, but what I did was to add a
>>> table
>>> and put the chart in the header row.
>>> I then set the chart to inherit the data from the container.
>>>
>>> Next I put in a variable in my initialize called rwc and set it equal to
>>> 0.
>>> I then added rwc+=1 to the onFetch method of the data set.
>>>
>>> Finally I added a visibility condition on the table with the following
>>> value:
>>> if( rwc > 0 ){
>>>
>>> false
>>>
>>> }else{
>>>
>>> true
>>>
>>> }
>>>
>>> I then added a text label below the table with a visibility property
>>> that is
>>> opposite of the above.
>>>
>>>
>>> Attached is the example. To see it work preview with the Web Viewer.
>>> Enter
>>> 119 as a parameter to see the chart.
>>> Enter 111 (nulls the data set) to see the message.
>>>
>>> Jason
>>>
>>>
>>>
>>> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
>>> news:e9lrie$t5j$1@utils.eclipse.org...
>>>>I desperately need help on a problem I have asked about a couple of
>>>>times.
>>>> My deadline is almost here.
>>>>
>>>> I need a way to show an image instead of a chart (or any other entity
>>>> in
>>>> the
>>>> palette for that matter) if the DataSet is empty (valid query with no
>>>> rows
>>>> returned).
>>>>
>>>> Please, please help.
>>>>
>>>> thx,
>>>> -d.
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>>
>
>
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #181259 is a reply to message #179123] Mon, 31 July 2006 05:41 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fake.mail.pl

Danny Rosenberg wrote:

> However, I took your idea and ran with it a bit. I've attached a report I
> created that illustrates my findings (the actual report I was working on was
> way too bloated to have you look at it). I did an extensive search of both
> the forums and the bug reports and came across the Total.count() property.
> You can see in the attached report that Total.count() works great for
> showing the Dynamic Text in place of the graph - so that would seem to solve
> the one problem rather well. However, for some unknown reason (well, to me)
> you can't script Total.count() in the onPrepare method of the Dynamic Text
> (you can see where I commented it out) even though you can place it in the
> actual expression.

Maybe I didn't understand your problem, but have you tried using setting
Visibility param of Dynamic Text in the Property Editor with
(Total.count(row.NAME_OF_COLUMN != null) == 0) ? For me that works - hides
report element when no data is returned.
Off course you must bind DataSet to your report element in order to see
column

--
Adam
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #181318 is a reply to message #181259] Mon, 31 July 2006 10:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

Hey Adam, thanks for the reply. That is, in fact, what I ended up doing.
The problem is, however, that it should be possible to actually ALTER the
text in the Dynamic Text object based on the properties of the DataSet, when
in fact, it's not.

So the solution becomes to have two different objects one which is hidden
and one which is shown, and toggle each based on Total.count(). I think
you'd agree the more maintainable solution would to not have to have a "set"
of objects where one should suffice.

Thanks for sharing some ideas though.

best,
-d.

"Adam" <fake@mail.pl> wrote in message
news:2c80abef26dde680245aa5196faceac4$1@www.eclipse.org...
> Danny Rosenberg wrote:
>
>> However, I took your idea and ran with it a bit. I've attached a report
>> I created that illustrates my findings (the actual report I was working
>> on was way too bloated to have you look at it). I did an extensive
>> search of both the forums and the bug reports and came across the
>> Total.count() property. You can see in the attached report that
>> Total.count() works great for showing the Dynamic Text in place of the
>> graph - so that would seem to solve the one problem rather well.
>> However, for some unknown reason (well, to me) you can't script
>> Total.count() in the onPrepare method of the Dynamic Text (you can see
>> where I commented it out) even though you can place it in the actual
>> expression.
>
> Maybe I didn't understand your problem, but have you tried using setting
> Visibility param of Dynamic Text in the Property Editor with
> (Total.count(row.NAME_OF_COLUMN != null) == 0) ? For me that works - hides
> report element when no data is returned.
> Off course you must bind DataSet to your report element in order to see
> column
>
> --
> Adam
>
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #181334 is a reply to message #181318] Mon, 31 July 2006 11:02 Go to previous messageGo to next message
Eclipse UserFriend
Dany,

You should have been able to set the value of a dynamic text element in
script or using the expression builder.

Jason

"Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
news:eal57q$32o$1@utils.eclipse.org...
> Hey Adam, thanks for the reply. That is, in fact, what I ended up doing.
> The problem is, however, that it should be possible to actually ALTER the
> text in the Dynamic Text object based on the properties of the DataSet,
> when in fact, it's not.
>
> So the solution becomes to have two different objects one which is hidden
> and one which is shown, and toggle each based on Total.count(). I think
> you'd agree the more maintainable solution would to not have to have a
> "set" of objects where one should suffice.
>
> Thanks for sharing some ideas though.
>
> best,
> -d.
>
> "Adam" <fake@mail.pl> wrote in message
> news:2c80abef26dde680245aa5196faceac4$1@www.eclipse.org...
>> Danny Rosenberg wrote:
>>
>>> However, I took your idea and ran with it a bit. I've attached a report
>>> I created that illustrates my findings (the actual report I was working
>>> on was way too bloated to have you look at it). I did an extensive
>>> search of both the forums and the bug reports and came across the
>>> Total.count() property. You can see in the attached report that
>>> Total.count() works great for showing the Dynamic Text in place of the
>>> graph - so that would seem to solve the one problem rather well.
>>> However, for some unknown reason (well, to me) you can't script
>>> Total.count() in the onPrepare method of the Dynamic Text (you can see
>>> where I commented it out) even though you can place it in the actual
>>> expression.
>>
>> Maybe I didn't understand your problem, but have you tried using setting
>> Visibility param of Dynamic Text in the Property Editor with
>> (Total.count(row.NAME_OF_COLUMN != null) == 0) ? For me that works -
>> hides report element when no data is returned.
>> Off course you must bind DataSet to your report element in order to see
>> column
>>
>> --
>> Adam
>>
>
>
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #181342 is a reply to message #181334] Mon, 31 July 2006 11:12 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: danny.rosenberg.weblayers.com

Yes, it should work that way, but it isn't. If you look back to the report
I sent on the 20th, you can see an example of this. I'm thinking it's a
bug, not that it hasn't been implemented. This was never confirmed though.
You asked what version of BIRT and that's the last we talked about it.

"Jason Weathersby" <jweathersby@actuate.com> wrote in message
news:eal61f$8vj$1@utils.eclipse.org...
> Dany,
>
> You should have been able to set the value of a dynamic text element in
> script or using the expression builder.
>
> Jason
>
> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
> news:eal57q$32o$1@utils.eclipse.org...
>> Hey Adam, thanks for the reply. That is, in fact, what I ended up doing.
>> The problem is, however, that it should be possible to actually ALTER the
>> text in the Dynamic Text object based on the properties of the DataSet,
>> when in fact, it's not.
>>
>> So the solution becomes to have two different objects one which is hidden
>> and one which is shown, and toggle each based on Total.count(). I think
>> you'd agree the more maintainable solution would to not have to have a
>> "set" of objects where one should suffice.
>>
>> Thanks for sharing some ideas though.
>>
>> best,
>> -d.
>>
>> "Adam" <fake@mail.pl> wrote in message
>> news:2c80abef26dde680245aa5196faceac4$1@www.eclipse.org...
>>> Danny Rosenberg wrote:
>>>
>>>> However, I took your idea and ran with it a bit. I've attached a
>>>> report I created that illustrates my findings (the actual report I was
>>>> working on was way too bloated to have you look at it). I did an
>>>> extensive search of both the forums and the bug reports and came across
>>>> the Total.count() property. You can see in the attached report that
>>>> Total.count() works great for showing the Dynamic Text in place of the
>>>> graph - so that would seem to solve the one problem rather well.
>>>> However, for some unknown reason (well, to me) you can't script
>>>> Total.count() in the onPrepare method of the Dynamic Text (you can see
>>>> where I commented it out) even though you can place it in the actual
>>>> expression.
>>>
>>> Maybe I didn't understand your problem, but have you tried using setting
>>> Visibility param of Dynamic Text in the Property Editor with
>>> (Total.count(row.NAME_OF_COLUMN != null) == 0) ? For me that works -
>>> hides report element when no data is returned.
>>> Off course you must bind DataSet to your report element in order to see
>>> column
>>>
>>> --
>>> Adam
>>>
>>
>>
>
>
Re: Hiding chart on empty DataSet (please! have asked twice before) [message #181357 is a reply to message #181342] Mon, 31 July 2006 16:16 Go to previous message
Eclipse UserFriend
Danny,

I believe the example you posted didnt work because the onPrepare methods
get called before dataset onFetch. You can also change the dynamic text in
on create like:
this.text = reportContext.getPersistentGlobalVariable('tmp');

Which will get called after the data set. Keep in mind that something in
the reprot should use the data set before you reference the variable that it
is modifying.

Jason


"Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
news:eal6lh$d3o$1@utils.eclipse.org...
> Yes, it should work that way, but it isn't. If you look back to the
> report I sent on the 20th, you can see an example of this. I'm thinking
> it's a bug, not that it hasn't been implemented. This was never confirmed
> though. You asked what version of BIRT and that's the last we talked about
> it.
>
> "Jason Weathersby" <jweathersby@actuate.com> wrote in message
> news:eal61f$8vj$1@utils.eclipse.org...
>> Dany,
>>
>> You should have been able to set the value of a dynamic text element in
>> script or using the expression builder.
>>
>> Jason
>>
>> "Danny Rosenberg" <danny.rosenberg@weblayers.com> wrote in message
>> news:eal57q$32o$1@utils.eclipse.org...
>>> Hey Adam, thanks for the reply. That is, in fact, what I ended up
>>> doing. The problem is, however, that it should be possible to actually
>>> ALTER the text in the Dynamic Text object based on the properties of the
>>> DataSet, when in fact, it's not.
>>>
>>> So the solution becomes to have two different objects one which is
>>> hidden and one which is shown, and toggle each based on Total.count().
>>> I think you'd agree the more maintainable solution would to not have to
>>> have a "set" of objects where one should suffice.
>>>
>>> Thanks for sharing some ideas though.
>>>
>>> best,
>>> -d.
>>>
>>> "Adam" <fake@mail.pl> wrote in message
>>> news:2c80abef26dde680245aa5196faceac4$1@www.eclipse.org...
>>>> Danny Rosenberg wrote:
>>>>
>>>>> However, I took your idea and ran with it a bit. I've attached a
>>>>> report I created that illustrates my findings (the actual report I was
>>>>> working on was way too bloated to have you look at it). I did an
>>>>> extensive search of both the forums and the bug reports and came
>>>>> across the Total.count() property. You can see in the attached report
>>>>> that Total.count() works great for showing the Dynamic Text in place
>>>>> of the graph - so that would seem to solve the one problem rather
>>>>> well. However, for some unknown reason (well, to me) you can't script
>>>>> Total.count() in the onPrepare method of the Dynamic Text (you can see
>>>>> where I commented it out) even though you can place it in the actual
>>>>> expression.
>>>>
>>>> Maybe I didn't understand your problem, but have you tried using
>>>> setting Visibility param of Dynamic Text in the Property Editor with
>>>> (Total.count(row.NAME_OF_COLUMN != null) == 0) ? For me that works -
>>>> hides report element when no data is returned.
>>>> Off course you must bind DataSet to your report element in order to see
>>>> column
>>>>
>>>> --
>>>> Adam
>>>>
>>>
>>>
>>
>>
>
>
Previous Topic:set y-Axis with decimal values
Next Topic:Parameters and sorting problem
Goto Forum:
  


Current Time: Wed May 07 20:13:02 EDT 2025

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

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

Back to the top