CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> PHP

 report label to display value

Print topic Send  topic

Author Message
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
View profile  Send private message
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
View profile  Send private message
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.
View profile  Send private message
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
View profile  Send private message
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.
View profile  Send private message
niiantiaye

Posts: 9
Posted: 03/14/2013, 11:36 AM

Thanks Gena. You are a genius. Expect a donation.
View profile  Send private message
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
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

PHP Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.