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

Suppress a section based on multiple conditions 1

Status
Not open for further replies.

Trogg

IS-IT--Management
Feb 13, 2003
80
US
Good day all,
I am using Crystal 2011 with a SQL2008 DB. I will try to explain my problem. I am pulling insurance info on patient accounts using shared string variables to extract the Primary payor ({@primary}) and the secondary payor ({@secondary}). The report is grouped on invoice number and is a summary so the detail section is suppressed and the summary data is displayed in GF1. What I would like to do is suppress the section if 2 conditions are not met... first, if {@primary} <> 'MEDICARE' and second, {@secondary} <> 'MEDICAID' and cannot be blank or null. I only want to see records with Medicare primary having Medicaid secondary. In the section expert for GF1 I have tried a couple of things for the suppression formula. First I tried this:
{@primary} <> 'MEDICARE' and {@secondary} <> 'MEDICAID'

This gets me:
Medicare Medicaid
Medicare
Medicare Medicaid
The problem there is I don't want record 2. So I did some more research and tried this:

({@primary}<>'MEDICARE A AND B' and
isnull({@secondary})or length(trim({@secondary}))=0)

This gets me:
Medicare Medicaid
Blue Cross Medicaid
Medicare Medicaid
Tricare Medicaid

I get all Medicaid secondarys but get primarys that are not Medicare.
It is as if the two variables are in competition with each other or I have not done the suppression formula correctly. Your help is appreciated in advance and please let me know if I can provide any more info.

 
Is there a reason you need to suppress the unwanted sections, as opposed to excluding them from the report in the first place? It's generally best to not pull records into a report that won't be displayed, or will be discarded:

What happens if you don't suppress any sections, but in the select expert put:

{@Primary} = "MEDICARE" and {@Secondary} = "MEDICAID"

You mention shared variables - is there a subreport involved? If so, what is it doing?
 
Hi Brian... thanks for responding... the shared variables cannot be evaluated in the general select(must be evaluated later message). There is no subreport. I use the shared variables in order to get both insurances on the same line. All the insurances are in the same table. I am trying to do this without having to use a subreport to pull the secondary.
 
Have to run, but you could left join the insurance table twice (creating alias) - then in select expert specify:

InsuranceTable1.InsuranceOrder = 1
and
Insurance Table2.InsuranceOrder = 2

That should get them both in the same record.

I would write a SQL command to do the same thing a little cleaner, something like

Code:
select 
VisitID,
max(case when InsuranceOrderID = 1 then InsuranceID else '' end) as Insurance1,
max(case when InsuranceOrderID = 2 then InsuranceID else '' end) as Insurance2

from BarInsuranceOrder

group by VisitID

Then join that command object to your Visits table. Let me know what happens.

 
Thanks Brian... sometimes it's just best to "Old-School it" I guess... dropped the tables in there I needed twice and pulled it that way. I would like to know if it's possible to do it the other way just for my own knowledge. Thanks for your help!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top