Calculates with 2 Data Sets [message #902553] |
Sat, 18 August 2012 07:27  |
Eclipse User |
|
|
|
Hi,
I have a question.
I have two databases one is access and other is MySql. I use information in tables and grid for each of these tables and using differents datasets, but when i want to create a DATA Cell with a result from 2 datasets from i have a problem, I don't know what can i do?.
My case is:
DataSet1 = Only it has a row with a number. TOTALSALES = 1112
DataSet2 = Only it has a row with a numbre. TOTALCOST = 345
I want show the value --> TOTALSALES - TOTALCOST in a grid, but i don't know if this is possible or impossible. The DATA CELL i would like to name = BENEFITS
BENEFITS = DataSet1.TOTALSALES - DataSet2.TOTALCOST
BENEFITS = 1112 - 345 = 767
Thanks.
(sorry for my english its no good)
[Updated on: Sun, 19 August 2012 08:48] by Moderator
|
|
|
Re: Calculates with 2 Data Sets [message #902861 is a reply to message #902553] |
Mon, 20 August 2012 14:32   |
Eclipse User |
|
|
|
You could do something like:
data set one table
in a table with ds 1 you could write a onCreate script for the data
filed that displays total sales.
reportContext.setGlobalVariable("TS", this.getValue());
or
reportContext.setGlobalVariable("TS",
this.getRowData().getColumnValue("TOTALSALES"));
do the same for the data set 2 total cost, but use a different variable
name, say TC.
Then below both tables add a data item (No binding needed) with the
expression:
reportContext.getGlobalVariable("TS")/reportContext.getGlobalVariable("TC");
You may want to get TC first and check for a 0 value.
Jason
On 8/18/2012 7:27 AM, JOSE LUIS wrote:
> Hi,
>
> I have a question.
>
> I have two databases one is access and other is MySql. I use information
> in tables and grid for each of these tables and using differents
> datasets, but when i want to create a DATA Cell with a result from 2
> datasets from i have a problem, I don't know what can i do?.
>
> My case is:
>
> DataSet1 = Only it has a row with a number. TOTALSALES = 1112
> DataSet2 = Only it has a row with a numbre. TOTALCOST = 345
>
> I want show the value --> TOTALSALES - TOTALCOST in a grid, but i don't
> know if this is possible or impossible. The DATA CELL i would like to
> name = BENEFITS
>
> BENEFITS = DataSet1.TOTALSALES - DataSet1.TOTALCOST BENEFITS = 1112 -
> 345 = 767
>
> Thanks.
> (sorry for my english its no good)
|
|
|
|
|
|
|
|
|
Re: Calculates with 2 Data Sets [message #908003 is a reply to message #906380] |
Tue, 04 September 2012 10:33  |
Eclipse User |
|
|
|
Verify that reportContext.getGlobalVariable("TS") or
reportContext.getGlobalVariable("TC") is not null before you do the
division.
Jason
On 9/1/2012 5:34 AM, JOSE LUIS wrote:
> Good Morning Jason,
>
> When I used this expression
> parseFloat(reportContext.getGlobalVariable("TS"))-parseFloat(reportContext.getGlobalVariable("TC"));
>
>
> Eclipse give me a error:
>
> Grid (id = 2825): + Can not convert the value of NaN to BigDecimal type.
> CONVERT_FAILS ( 1 time(s) )
> detail : org.eclipse.birt.report.engine.api.EngineException: Can not
> convert the value of NaN to BigDecimal type.
>
> Do you know what can we do?
>
> Thanks, Kindest regards
|
|
|
Powered by
FUDForum. Page generated in 0.05897 seconds