Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: dividing to fields to show percentage Post Reply Post New Topic
Author Message
bwsanders
Senior Member
Senior Member


Joined: 05 Sep 2012
Location: United States
Online Status: Offline
Posts: 177
Quote bwsanders Replybullet Topic: dividing to fields to show percentage
     Posted: 27 Mar 2013 at 4:01am
working on an overtime report and trying to get this to work

shared numbervar RegTotal := If({field}) = "Reg" Then Sum({field});
shared numbervar OtTotal := If ((Instr({field},"Over") >= 0)) Then Sum({field});

RegTotal / OtTotal * 100

seems pretty simple but it's returning 0 for some reason. if i remove the Sum portion of the above code it then returns 100.

i'm not really sure what i am missing or if i am missing something here. any help or guidance is definitely appreciated.

thank you!


IP IP Logged
Sastry
Moderator
Moderator
Avatar

Joined: 16 Jul 2012
Online Status: Offline
Posts: 537
Quote Sastry Replybullet Posted: 27 Mar 2013 at 10:15pm
Hi

Check this statement :

If ((Instr({field},"Over") >= 0)) Then Sum({field});

If it finds "Over" or not it will sum(field) because you are checking with '>=' Is it a requirement ? other wise use only '>'

Also create two different formulas for each condition and place in your report to check what it is returning.

Thanks,
Sastry
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum