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

If Then Else statement 2

Status
Not open for further replies.

slh020

Technical User
Oct 14, 2005
22
US
I am using crystal reports 10 and need a report that will return all clients from each nursing home. I am using the following if then else statement:

IF {TrustClient.LevelOfCare}="078" or {TrustClient.LevelOfCare}="69" THEN
"NursingHomeName"
Else IF {TrustClient.LevelOfCare}="031" Then
"NursingHomeName"
Else IF {TrustClient.LevelOfCare}="029" or {TrustClient.LevelOfCare}="033" THEN
"NursingHomeName"
Else IF {TrustClient.LevelOfCare}="028" or {TrustClient.LevelOfCare}="034" THEN
"NursingHomeName"
Else IF {TrustClient.LevelOfCare}="040" or {TrustClient.LevelOfCare}="041" THEN
"NursingHomeName"
Else IF {TrustClient.LevelOfCare}="046" or {TrustClient.LevelOfCare}="048" THEN
"NursingHomeName"
The statement will work but it also returns all clients that have not been assigned to a nursing home (hospital clients). I tried using an End If but got error message "The remaining text does not appear to be part of the formula". Could someone please help?? I am new to crystal reports and I am lost once again...
 
It looks to me like you could use:

{TrustClient.LevelOfCare} in ["078","69","031","029","033","028","034","040","041","046","048"]

...as your record selection formula. Then place the "NursingHomeName" field on your report. If these codes include people from hospitals, then you need to identify the field that will distinguish hospitals from nursing homes and add that into your record selection criteria.

-LB
 
Hi,
Where in the report are you using that formula?

Also, why not test for all the values at one go..
If {TrustClient.LevelOfCare} in ["078","69","031",..)
then
"NursingHomeName"



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Thanks for replying so quickly... I am sorry I am so confused, I left out important info...We have six different nursing homes, so I had to write if statements for each. We have some clients that have not been assigned any unit until they have been evaluated and can be placed. I tried to compensate for this by using
IF {TrustClient.LevelOfCare}="078" or {TrustClient.LevelOfCare}="69" THEN
"NursingHomeName1"
Else IF {TrustClient.LevelOfCare}="031" Then
"NursingHomeName2"
Else IF {TrustClient.LevelOfCare}="029" or {TrustClient.LevelOfCare}="033" THEN
"NursingHomeName3"
Else IF {TrustClient.LevelOfCare}="028" or {TrustClient.LevelOfCare}="034" THEN
"NursingHomeName4"
Else IF {TrustClient.LevelOfCare}="040" or {TrustClient.LevelOfCare}="041" THEN
"NursingHomeName5"
Else IF {TrustClient.LevelOfCare}="046" or {TrustClient.LevelOfCare}="048" THEN
"NursingHomeName6"
Else "No Unit"
but using the "Else no unit" I get 800 extra pages to report. The report is supposed to generate a financial statement for each client in each nursing home to send to family. I have probably totally confused you now..sorry
 
Hi,
OK..Now for my first question..Where are you placing this formula ?

To eliminate records for those not yet assigned to a nursing home you need to create a record selection formula that would only return those with {TrustClient.LevelOfCare} values that would indicate assignment to a home..

You could use the formula you posted ( leave off the last else..) as a group by object so each Nursing HOme would have its own details..




[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
I am using the formula in the gh1 section:
@strBuildingName
Admit Name Admit Date
Client ID Number

this lists every client in each nursing home, then the financial statement is listed with a beginning and ending balance. In the detail section I have each transaction date and revenue code for each client. Does this help....or am I confusing you???
 
Hi,
Nope, no more confused than I usually am[smile]
Is That group based on that formula are you just displaying it as the name?
Have you tried the selection formula to eliminate any non-assigned records?



[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
Well since I have started working with cr, it's total confusion on a daily basis for me...[dazed]..I have the report grouped on the strBuildingName using the formula to (I thought..) pull only the clients from the nursing homes. I am not sure I know what you mean by the selection formula..[dazed]
 
Hi,
Use the 'Report..Selection Formula..Record' tab in the CR designer and
enter something like

{TrustClient.LevelOfCare} in ["078","69","031","029","033","028","034","040","041","046","048"...etc]


To limit the records returned from the database to just those that have a Nursing Home registration..

Cannot be more exact, since I do not know how your data model determines if someone is assigned to a Nursing Home.

[profile]

To Paraphrase:"The Help you get is proportional to the Help you give.."
 
[thumbsup]...don't know why I made that so hard...Thanks for all your help...It finally sank into this thick head what you had been trying to explain all the time..."selection formula"....duh...it now works...Have a great day and Thanks again....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top