niiantiaye
Posts: 9
|
Posted: 03/12/2013, 1:34 PM |
|
Hi , I really need help on this. I have a report and it has two totals for two fields. Now , I want to subtract TOTAL A from TOTAL B and use a label to display the results . I have been trying to do this since yesterday but haven't found the solution. Can someone help me ? PLEASEEEEEEEE
|
|
|
Gena
Posts: 591
|
Posted: 03/12/2013, 1:42 PM |
|
try this
In the Data Source add a new Select filed like
(field1 - filed2) alias TotalSubst
then in the Report use TotalSubst as a Total (sum) field
_________________
Gena |
|
|
niiantiaye
Posts: 9
|
Posted: 03/12/2013, 3:54 PM |
|
Thanks , Gena but I don't really understand . Let me explain myself again i have two fields Dr and Cr. I am able to get the total for Dr and Cr using the report wizard. Now I have inserted a label in the report to display Balance which is Total Dr - TotalCr . Please help me , I will make a donation.
|
|
|
Gena
Posts: 591
|
Posted: 03/12/2013, 4:42 PM |
|
Open your Report
click on Data Source
select SELECT
in the Column/Expression write
(Dr - Cr)
in the Alias write what you want, like
SubstField
to see/check you can click on Review data - you will see a new field with the calculation
Then go to Designer of your Report, add new Label as usual, make it sum and use SubstField field
_________________
Gena |
|
|
saseow
Posts: 744
|
Posted: 03/13/2013, 10:57 AM |
|
Another way to do it is simply to create a session variable in the before show for the two labels and then use those to calculate in the before show of the result label.
|
|
|
niiantiaye
Posts: 9
|
Posted: 03/14/2013, 11:36 AM |
|
Thanks Gena. You are a genius. Expect a donation.
|
|
|
Gena
Posts: 591
|
Posted: 03/14/2013, 12:34 PM |
|
Great!
BTW withing Alias way you can make great things. For example, lets say you have date field (in standard mysql format yyyy-mm-dd HH:nn:ss) and want to Group just by years? Just create alias
year(my_date_filed) alias as MyYear
and the use MyYear as a GROUP BY!
etc etc So you can easy use any mySQL operations!
_________________
Gena |
|
|