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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with counting formulas

Status
Not open for further replies.

records333

Technical User
Mar 16, 2012
41
US
I have three formulas that count if a patient attended resources A, B, and C.

My goal is to count the patient once IF they attended at least 1 of the resources. I would like feedback on the best way to count the patient once.
 
Please provide some detail about the structure of the report (grouping, fields etc). An example of the report output and the result you are looking for would enable us to give more specific help.

Cheers
Pete
 
Hi there,

Group 1 - by Location

Running Totals:

Patients Newly Diagnosed
CLASS RESOURCE
VIDEO RESOURCE
CC RESOURCE

The last piece is TO create a formula to count patient if they had at least 1 of the resources to reflect patient was a program particpant
 
1) Create a formula named {@null} and save it empty.

2) Create a second formula that is:
if {resource} in ["A", "B", "C"]
then {Patient.ID}
else {@Null}

3) Do a Summary (distinct count) of the second formula

Note-Do not use "Default Values for Nulls" in the second formula or in file>report>Options
Note-if the Patient ID is a number use:

....
else Val({@Null})

Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guides to Formulas, Parameters, Subreports, Cross-tabs, VB, Tips and Tricks
 
During validation, I've notice that the formula is only evaluating the first statement not the OR STATEMENTS. Please see example:

IF (
({Command_DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) AND {Command_ORDER.DESCRIPTION} like "XXX*" )

OR ({Command_CLASSES.DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) and {Command_CLASSES.NAME} like ["*AAA*","BBB*","CCC*"])

OR ({Command_VIDEO.DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) AND {Command_VIDEO.ID} = "27479")
)

THEN 1 ELSE 0
 
See if this makes a difference:

IF (
({Command_DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) AND
and not(isnull({Command_ORDER.DESCRIPTION})) and {Command_ORDER.DESCRIPTION} like "XXX*" )

OR ({Command_CLASSES.DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) and
not(isnull({Command_CLASSES.NAME})) and {Command_CLASSES.NAME} like ["*AAA*","BBB*","CCC*"])

OR ({Command_VIDEO.DATE} in DateTime (2013, 07, 01, 00, 00, 00) to DateTime (2013, 12, 31, 00, 00, 00) AND and
not(isnull({Command_VIDEO.ID})) and{Command_VIDEO.ID} = "27479")
)

THEN 1 ELSE 0
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top