Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...What a great service! This is the best site I've ever seen!!! It totally restores my faith in humanity when people take time out to help other people..."

Geography

Where in the world do Tek-Tips members come from?
mohsinhasan87 (Programmer)
1 Aug 12 8:00
Hi,
I have one group on my report which has two fields Gross and Net.On details I have their details and on the group footer I have their summary as sum of both gross and net and on the report footer again sum summary of gross and net.

Eg:
Details :
Name Gross Net
ABC 100 200
XYZ 200 300
----------------
Group Footer:
300 500
----------------
Name Gross Net
DEF 200 300
----------------
Group Footer :
200 300
-----------------
Report Footer :
500 800

What I want to achieve is subtract report footer field
Eg: 500-800 = -300.

How can I achieve this? I tried this formula
sum({field1}) - sum(field2) but it says result should be boolean then I did this
sum({field1}) - sum(field2) > 0. No errors but also no data.
Please help .
Thank you
mohsinhasan87 (Programmer)
1 Aug 12 8:20
I am trying to use this as suggested by some users.I dont know what to use a Instance1? Further I have only one group which is string network name.When I save this formula it says "Result of selection formula must be boolean". What should I do?
whileprintingrecords;
numbervar A;
numbervar B;
if {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK} = "Instance1" then
A := Sum ({dt_VU_GETMSG_SERVICE.TOTALAMOUNT_}, {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK});
B := Sum ({dt_VU_GETMSG_SERVICE.AmountAfterSPShare_}, {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK});
mohsinhasan87 (Programmer)
1 Aug 12 11:35
Please help.. Anyone??
Helpful Member!  CoSpringsGuy (IS/IT--Management)
1 Aug 12 12:49
not sure why this wouldnt work although I did notice you had () in one example instead of {}

sum({gross.field}) - sum({net.field})
for report footer

sum({gross.field},{group}) - sum({net.field},{group})
for group footer

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

Helpful Member!  lbass (TechnicalUser)
1 Aug 12 22:09
I think you are creating the formula in the wrong place. You need to create this formula in the field explorer->formulas->new:

sum({field1}) - sum({field2})

-LB
mohsinhasan87 (Programmer)
2 Aug 12 1:30
I used field explorer then created a new formula then under "Selection Formulas" > "Group Selection" I chose my sum fields and wrote this formula.
Sum ({dt_VU_GETMSG_SERVICE.TOTALAMOUNT_})-Sum ({dt_VU_GETMSG_SERVICE.AmountAfterSPShare_}) but it still says the result of selection formula must be boolean.
mohsinhasan87 (Programmer)
2 Aug 12 1:36
okay It worked. I was using expert all the time after creating new though I am not an expert. I used editor and it worked. Thank you so much.I have 2-3 queries as well, so shall I create a new thread or ask in this one?
mohsinhasan87 (Programmer)
2 Aug 12 4:56
I have one formula which shows the percentage according to gross we just calculated above. I used this formula to show percentage of gross.
shared numbervar rtTotal;
local numbervar thisTotal;
thisTotal :={dt_VU_GETMSG_SERVICE.TOTALAMOUNT_} % Sum ({dt_VU_GETMSG_SERVICE.TOTALAMOUNT_}, {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK});
rtTotal :=rtTotal+thisTotal;

and created a new formula for displaying the summary like this
shared numbervar rtTotal;
rtTotal;

but on my report it keep adding the record in the next field.
For Eg:

Details:
Name Percentage
ABC 20%
XYZ 29% ---> Original Value 9%
DFG 31% ---> Original Value 2%

At the end on group footer it shows 31%(last value).

I want to sum all the percentage field on details and show them on group footer.How can I achieve this?

Thank you
CoSpringsGuy (IS/IT--Management)
2 Aug 12 13:15
are you using the results of this formula in a subreport? You havent mentioned that. If you are not.... then I think (someone feel free to correct me if I am wrong) you are making your formulas more difficult than you need to.

If that formula is not being used except as you have explained then the following will get you the same result and read a little cleaner.. You dont need variable declarations

{dt_VU_GETMSG_SERVICE.TOTALAMOUNT_} % Sum ({dt_VU_GETMSG_SERVICE.TOTALAMOUNT_}, {dt_VU_GETMSG_SERVICE.FSERVICE_NETWORK})

_____________________________________
Crystal Reports 2008 and XI
Intersystems Cache 2012 ODBC connection

mohsinhasan87 (Programmer)
2 Aug 12 13:40
No I am not using the results on sub report.My main issue is I am not able to show the summary of percentage on group footer. I am able to show the percentage by simple formula as well the way you have mentioned but I need summary on group footer for that I have taken variables to show summary result on group footer.Using this formula

shared numbervar rtTotal;
rtTotal;

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close