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!

random problem 1

Status
Not open for further replies.

kevlar26

IS-IT--Management
Oct 16, 2009
8
US
Individually I can get these things to work, however when I put them together it doesnt. Any help greatly appreciated!

doing a report on coverage. I have a list of 6 or so coverages, each person may have multiple coverages. If they have one of them I want to show that person (ID), if they have several I only want to show them once.

in record selection I have:
if isnull ({Coverage.effective_to})
and
{Patient.case_status} = "A"
then
{Coverage.coverage_plan_id} = "MEDICAID"
or
{Coverage.coverage_plan_id} = "HLTHWAVE19"
or
{Coverage.coverage_plan_id} = "MCDWAIVER"
or
{Coverage.coverage_plan_id} ="MEDIKAN"
or
{Coverage.coverage_plan_id} ="MCAID EDS"
or
{Coverage.coverage_plan_id} ="MCAID QMB"
or
{Coverage.coverage_plan_id} ="VO_MCD"
or
{Coverage.coverage_plan_id} ="MCDWAIVEDS"
or
{Coverage.coverage_plan_id} ="MCD_TRANSP"

to get rid of the duplicates in the supress in the details I put:
{coverage.patient_id}=previous({coverage.patient_id})

I also need to pick a random 25% of these people.
I did the sort by Rnd()

When I do both of things together overrides the part I added to supress in details (since they are no longer in order)
 
I would simplify the record selection formula to:

isnull ({Coverage.effective_to}) and
{Patient.case_status} = "A" and
{Coverage.coverage_plan_id} in ["MEDICAID","HLTHWAVE19","MCDWAIVER","MEDIKAN","MCAID EDS","MCAID QMB","VO_MCD","MCDWAIVEDS","MCD_TRANSP"]

I think it would have a better chance of passing to the SQL query. Then you could do the following. Create a formula:

rnd()

Add this to the detail section. Insert a group on customer and then insert a maximum on the rnd formula at the customer level. Suppress the detail section, and go to report->group sort and choose maximum of rnd() as the group sort field. Then suppress the group header section by using this formula:

numbervar cnt := cnt + 1;
cnt > distinctcount({table.customer})*.25

I'm not sure whether this technically meets the criteria for randomness, but it might.

-LB
 
Sorry I'm fairly new to making these reports. You lost me at the detail section.

When I add a group, it makes a new header and footer.. not in the detail section. When I highlight the customer, go to insert.. group is not an option. I'm missing something here.

Group sort is always greyed out, so I cant get to it. Thanks for the help on the formula, that make much more sense.
 
Go to insert->group and select {coverage.Patient_ID} in order to create a group on patient. Place the rnd formula in the detail section->right click->insert summary->maximum->select "on change of group: patient ID". Then go to report->group sort. It will be activated once you insert a summary on the formula: rnd().

-LB
 
I think I figured out how to do what you were saying.

However something is still not right. I took out all but 2 of the coverage names for testing.

The report comes up as 17 pages. The first 7 are double spaced, and the last 10 arent. I changed the
cnt > distinctcount({table.customer})*.25
to
cnt > distinctcount({table.customer})*.75

and this added more pages of the double spaced pages. So Im assuming the double spaced pages are the 25% that I want to pull and it is showing the rest as single spaced pages. I do question the math on this, that seems awful high. I'll verify the number of customers that should really be there. After that how do I get the remaining 75% not to show on the report?

I am having the customers with multiple coverage show more then once... sort of. It is showing the customer number and coverage, then the next line shows the 2nd coverage. I did not notice this on the double spaced pages.

the random part is working.
 
First you should be suppressing the detail section so there is only one row per customer. You can also suppress the group footer. Please reread my earlier post and try again. You should be going into the section expert and adding the suppression formula on the group header NOT on the detail section.

-LB
 
Thank you very much for all of your help. I got everything going, and then I realized doing the report this way wont get me the information I need. Doing it like this doesnt give me the correct percentages :-(

I need to figure out how to lump everyone together and then do the percentages.

I'll try my best to explain:
lets say I have 100 people on medicare, 100 people on hw19 and 50 more people that have both. Grand total of 250 people. But doing it like I was was telling me that I had 300 people because it was counting the 50 that had both twice. Thus giving me the wrong percentages.

Even when I told it to supress duplicate patient_id it still counted them, they just werent displayed.

Any ideas? I'm lost again at this point. Is it possible to do what I need done? If a person has more then one coverage, then they will have more then one line in the table. Is there a way to skip a patient_id if it has already been counted? UNIQUE? DISTINCT?

 
You are not implementing this correctly. I did test this and it worked. Please try again. You should be grouping on Patient ID and displaying only the group header. It doesn't matter how many rows each patient has, since you are working with the header.

-LB
 
Well that's good news.. (other then the Im doing it wrong part). I'll give it another shot. I think I just caught what I did wrong.

Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top