Thank you for your help,
I have tinkered with grouping but never quite got what I was looking for, 
probably not understanding groups properly.
Have done as you suggested, this results in an appropriate list for allergies, 
but the medication is repeated twice (once for each ?item in the allergy band)
eg.
-allergy 1
        - med 1
        - med 2
- allergy 2
        - med 1
        - med 2

what I am looking for is 
- allergy 1             -med 1
- allergy 2             -med2   
                                -med3 etc
medication list tend to be much longer than allergies.

Does each new group nest below the group immediately above? or could the top 
level group have two groups directly below? -does this even make sense?

I presume rw.Cursor can only be run once for a report, in other words one 
cannot run separate sql queries and append the data for each run to same report?

Again, thanks for your help and such an excellent framework,
All the best for the new year, 
james



On 30/12/2011, at 6:56 AM, Paul McNett wrote:

> On 12/28/11 4:10 PM, James Bull wrote:
>> Wondering if I could get some pointers.
> 
> I will try!
> 
>> I have tables setup as
>>      Parent(person)
>>              -ChildA(many: medications)
>>              -ChildB(many: allergies)
> 
> Pretty standard.
> 
> 
>> The report I am trying to produce aims to have Parent details then below 
>> this 2 lists of childA and childB - to provide a summary report of 
>> medication one may be on and allergies.
> 
> You need to group on the parent's id, and put the "detail" of that parent in 
> the 
> group header for that group. Here's an example group definition (in rfxml 
> format 
> which you could carefully copy/paste into the <Groups> section of your 
> report's 
> .rfxml file)
> 
>               <Group>
>                       <expr>self.Record.patient_id</expr>
>                       <ResetPageNumber>True</ResetPageNumber>
>                       <startOnNewPage>True</startOnNewPage>
>                       <Objects>
>                               <GroupHeader>
>                                       <!-- once group defined, open designer
>                                            and add detail here. -->
>                               </GroupHeader>
>                               <GroupFooter>
>                               </GroupFooter>
>                       </Objects>
>               </Group>
>       
> You'll also need groups for the allergies and medications children, and to 
> put their 
> detail in their group headers. Leave the detail band empty. Here's a starting 
> example 
> for the allergy group:
> 
>               <Group>
>                       <expr>(self.patient_id, self.allergy_id</expr>
>                       <ResetPageNumber>False</ResetPageNumber>
>                       <startOnNewPage>False</startOnNewPage>
>                       <Objects>
>                               <GroupHeader>
>                                       <!-- once group defined, open designer
>                                            and add detail here. -->
>                               </GroupHeader>
>                               <GroupFooter>
>                               </GroupFooter>
>                       </Objects>
>               </Group>
> 
> 
>> My problem is as I understand it, reportwriter needs denormalized dataset - 
>> which to me means each 'row' contains all the same data with one unique 
>> element; so in the example dataset below the first 3 'rows' are unique on 
>> meds(and medpkid) and retain same allergy etc:
> 
> You don't actually need to fill the dataset with all repeated data, but that 
> is the 
> safest way. The reportwriter will need data for relevant fields while it 
> processes 
> the "records".
> 
>> 
>> ( {'meds': 'medication-test1', 'pkid': 21, 'allergy': 'penicillin-test', 
>> 'medid': 465, 'ptid': 465, 'medpkid': 217},
>>  {'meds': 'medication-test2', 'pkid': 21, 'allergy': 'penicillin-test', 
>> 'medid': 465, 'ptid': 465,  'medpkid': 471},
>> {'meds': 'drug-test', 'pkid': 21, 'allergy': 'penicillin-test', 'medid': 
>> 465, 'ptid': 465, 'medpkid': 472}, {'meds': 'medication-test1', 'pkid': 240, 
>> 'allergy': 'sulphur-test', 'medid': 465, 'ptid': 465, 'medpkid': 217},
>> {'meds': 'medication-test2', 'pkid': 240, 'allergy': 'sulphur-test', 
>> 'medid': 465, 'ptid': 465, 'medpkid': 471},
>> {'meds': 'drug-test', 'pkid': 240, 'allergy': 'sulphur-test', 'medid': 465, 
>> 'ptid': 465, 'medpkid': 472} )
> 
> Sorry, I didn't look at your dataset when composing my reply, but it looks 
> like you 
> have all the needed data to make your initial report.
> 
>> 
>> So in report I am trying to list for each unique person(ptid) a list 
>> allergies: pencillin,sulphur and list meds: medication-test1 etc, instead as 
>> the rw Cursor iterates over each element in tuple I have long list of 
>> allergies essentially repeated  in current example for each unique 
>> medication.
>> 
>> Have tried grouping but still cannot achieve what I envisage.
>> What am I doing wrong? Any help would be most appreciated.
> 
> Please let me know if I'm on the right track in helping you, after you've 
> tried the 
> grouping like what I've described.
> 
> By the way, I do have it on my list to enhance the report writer to allow the 
> Cursor 
> to be a bizobj, and the reportwriter could then figure out how to iterate the 
> bizobj 
> and the children. But it is a much simpler implementation how it is.
> 
> Paul
> 
> _______________________________________________
> Post Messages to: [email protected]
> Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
> Searchable Archives: http://leafe.com/archives/search/dabo-users
> This message: http://leafe.com/archives/byMID/[email protected]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to