How to get Row Count of dataset through scripting [message #219093] |
Thu, 15 February 2007 02:33  |
Eclipse User |
|
|
|
Hi All,
Does anyone have idea how to get row count of fetched dataset using
scripting? I tried out total.count() method in BeforeClose() method of
dataset. Is there another way to do the same and where should i put the
code? Currently I am using BIRT 2.1.0 .
Thanks in advance.
-Parimal
|
|
|
|
|
|
|
Re: How to get Row Count of dataset through scripting [message #219540 is a reply to message #219111] |
Fri, 16 February 2007 16:48  |
Eclipse User |
|
|
|
Originally posted by: johnw.innoventsolutions.com
The easiest way to do this is to create a hidden table with the
total.count() method. Then on the onRender event for the data element
containing the total.count(), assign a count variable the value. Thats
probably the easiest.
As far as assigning a query string, you can do it a few ways.
Globally, it can be done by
reportContext.getReportRunnable().getDesignInstance().getDat aSet( "dataSetName").queryText
= "";
But if you do that, you are responsible for recalling the dataset
generation, etc. I am not even sure you can do this from script.
The othehr way is from an event in the dataset, just calling
this.queryText.
What it sounds like, your best option is to use an external Java object
as your data source and use the scripted data source option. Then, you
can add in all the logic in your java code to do the switching of query
strings. So in your Java object, you use a JDBC/JNDI call to get your
data, determine if there is anything in the result set, and make another
call if necessary, then you just return.
Let me know if you need any advice on where to get info on how to do this.
John
Parimal wrote:
> Hi Christian,
>
> Thanks for your reply.
> Actually I want to check whether a dataset returns data or not. If there
> is no data available in the datset then I have to bind another query. Do
> u have any idea how to check whether dataset is returning data or not? I
> feel, Scripting need to be done inside dataset script so that another
> query can be bound if no data available. What you say?
>
> Thanks,
> Parimal
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.08439 seconds