Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

While Printing Records Question

Status
Not open for further replies.

JMB7

MIS
May 19, 2004
26
US
Crystal 8.5
SQL Database

I have to write a report where I need to group specific charge codes by date. For example:

Svc CD Svc Date Service DTotal (trying to get this #)
3610079 4/1/2005 1
1671008 4/1/2005
3610079 4/2/2005 1
1671008 4/2/2005
3610079 4/3/2005 1
1671008 4/3/2005
3610079 4/4/2005 1
1671008 4/4/2005
3610079 4/5/2005 1
1671008 4/5/2005
3610079 4/6/2005 0

I need the service dtotal counted as '1' if the charge code is one of [1671007,1671008,1671014,1671016] AND [3610079 or 3610076}. The service dates need any combination of both sets of numbers, if the service does then I want it to be counted as 1 else 0.
 
You need to do this with a formula like {@value}:

if {table.svcCD} in [1671007,1671008,1671014,1671016] then 1 else
if {table.svcCD} in [3610079, 3610076] then 10000 else
0

First insert a group on {table.svcdate}. Then create a second formula:

if sum({@value},{table.svcdate}) >= 10001 and
remainder(sum({@value},{table.svcdate}),10000) <> 0 then 1 else 0

These are both detail level formulas. If what you are trying to do is to select those dates with both values, then instead of using the second formula, go to report->edit selection formulas->GROUP and enter:

sum({@value},{table.svcdate}) >= 10001 and
remainder(sum({@value},{table.svcdate}),10000) <> 0

-LB
 
Thank you so much for the help.
I used your first formula (I renamed the formula)
@Charge Validation
if {actv_detail_v.actv_cd} in ["1671007", "1671008", "1671014", "1671016"] then 1 else
if {actv_detail_v.actv_cd} in ["3610076", "3610079"] then 10000 else 0 ( I added the " " because I got an error message of a string required here.)

Yes, I am trying to select or sum only the dates with both values, so I enter the computation in the group selection but received "The Summary /running total field could not be created".
if sum ({@Charge Validation},{actv_detail_v.actv_dtime})>=10001 and
remainder(sum({@Charge Validation},{actv_detail_v.actv_dtime}),10000)<> 0 then 1 else 0

Do you have any more suggestions?

 
Either you didn't place the formula in the GROUP selection formula area or you do not have a group on actv_detail_v.actv_dtime}, so I would check those two things.

Once you have that working, if you intend to summarize across groups, not just within groups, you will need to use running totals, since the non-group selected records will contribute to any inserted summaries.

-LB
 
Your are correct - I missed the group on actv_dtime.
It works - thanks you so much for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top