|
Re: Set a variable using the output of a SQL query [message #851110 is a reply to message #850798] |
Fri, 20 April 2012 16:54 |
|
If you create a dataset and then use the dataset in a table in the
report (Even if the table is hidden) you can get the row values and
store them in a variable. For example, on a table's detail row you
could add an oncreate script like:
myvar = this.getRowData().getColumnValue("QTY");
Look at the bindings tab in the property editor to get the column names.
Once you have the var you can also store it globally lie:
reportContext.setGlobalVariable("mygvar" , myvar); or like
reportContext.setPersistentGlobalVariable("mygvar" , myvar)
You can then use this variable downstream by calling
reportContext.getGlobalVariable("mygvar"); or
reportContext.getPersistentGlobalVariable("mygvar");
Jason
On 4/20/2012 6:41 AM, ing omini wrote:
> Hi people,
> a question regarding variables...
>
> Up to now I always used variables defined in report context to filter
> dataset results (for example by using those variables inside parameters
> and filters options of a dataset).
>
> Now I want to understand if it's possible to go in the other way.
> Is it possible to set the value of a variable using the dataset content?
> For example, if my dataset is:
>
> select first_day, last_day from external_config_table
>
> can I assign the output query values to report variables??
>
> pseudocode example:
> my_variable_firstday = row[1].first_day ;
> my_variable_firstday = row[1].last_day ;
>
> Thanks in advance...
>
|
|
|
|
Powered by
FUDForum. Page generated in 0.02869 seconds