Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2020 : Technical Questions
Message Icon Topic: Formula Field Problem Post Reply Post New Topic
Author Message
mian_ghous
Newbie
Newbie


Joined: 31 Jan 2008
Location: Pakistan
Online Status: Offline
Posts: 5
Quote mian_ghous Replybullet Topic: Formula Field Problem
    Posted: 31 Jan 2008 at 6:32am
hi there
 
i have three columns in ma source tabel
say   TruckQty, AttachmentQty  and  Class nad SOnum "for group"
 
first 2 colmn are int type
and calss is string having 2 values only say class1 and class2
 
now i want sum of att+model for class1 and same for class2
,,,i have used this in a formula field
 
if {Details.CLASS}="Class 1"
then
Sum ({Details.AttachmentQty}) +Sum({Details.TruckQty})
 
same for 2nd formula field for class 2
 
but problem is that on completing the report
it only populate formula field accoring to the last record class
.......mean ma last record has class 1
so it will sum these for class 1 and leaving 2nd formula filed to 0 ,although it has records for class 1 and class 2 both....
so please tell
 
 
 
IP IP Logged
Lugh
Senior Member
Senior Member
Avatar

Joined: 14 Nov 2007
Online Status: Offline
Posts: 377
Quote Lugh Replybullet Posted: 31 Jan 2008 at 8:14am
This is a classic problem.  Take another look at the logic of your statement:

If (the Class of the current record is "Class 1")
Then
(take the sum of all AttachmentQty)
added to
(take the sum of all TruckQty)

This is, clearly, not what you want.

Instead, create a pair of formulas for each record (i.e., put in the details section).  Each formula should look like:

If {Details.CLASS} = "Class 1" //or "Class 2" in the second formula
Then {Details.AttachmentQty} + {Details.TruckQty}

Then, take the Sum of each of these formulas.


IP IP Logged
mian_ghous
Newbie
Newbie


Joined: 31 Jan 2008
Location: Pakistan
Online Status: Offline
Posts: 5
Quote mian_ghous Replybullet Posted: 14 Feb 2008 at 10:01pm
thanks :)
IP IP Logged
mian_ghous
Newbie
Newbie


Joined: 31 Jan 2008
Location: Pakistan
Online Status: Offline
Posts: 5
Quote mian_ghous Replybullet Posted: 15 Feb 2008 at 4:48am

dear is it possible to assign default value to formula field...

like in our previous case some time sum is 0 but formula field does not show any thing,,,i want it to show 0;;
 
so please tell me how to do this
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.016 seconds.