Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Using a form's DE / getting all the child records
Message
From
29/07/1999 03:27:33
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
28/07/1999 14:34:27
General information
Forum:
Visual FoxPro
Category:
Reports & Report designer
Miscellaneous
Thread ID:
00247149
Message ID:
00247547
Views:
15
>Well, I really would rather not have to re-run all my record-selection queries every to print a report. These are big databases -- I'm looking at about two million records in the finished product -- and queries take time. The user has already defined the record set he wants. I would like to be able to use the existing filtered table.
>
>However, the SET SKIP does seem to be the key. Although you don't want SKIP to be on when viewing the form (you need to advance once for each child record to move the parent), you DO want it on for the report. (Interesting difference here. I'm not sure I understand it.) The following test code does seem to work, at least in a small and well-defined system:
>
>
>*-- test of sharing the data environment
>*-- between a form and report,
>*-- to avoid having to spend time duplicating queries
>*--
>*-- in this system, imNeg is the parent of imPrint,
>*-- in a 1:M relationship
>
>public vFPtr
>
>*-- open form with reference pointer
>do form forms\imnegfrm name vFPtr linked
>
>*-- move to form's private data session
>*-- so we can make sure the report is using the same DE
>set datasession to vFPtr.datasessionid
>
>* -- now let the report use the form's data environment
>select imNeg		&& probably not necessary -- it's already selected
>set skip to imPrint	&& allow multiple children in report
>
>*-- add a NOWAIT to examine things from the command window
>report form reports\imrel_r1 preview
>
>select imNeg 		&& just making sure...
>set skip to		&& preserve normal behavior in form
>
>*-- control returns to form
>*-- in an actual program,
>*-- we would also want to return to the same record
>
>
>Can anyone tell me if this is dangerous?
>
>Thanks,
>BEW
Not dangerous Barbara you could do it. Keep in mind that report would move rec pointer. It could cause (if it's the case) ie: a row buffered table to update. Normally before entering a report session validations would already be done. It would be OK to move rec pointer and set back to original.
In a report you want reccount(child) records to be processed so set skip provides it. Instead of set skip, another thing I sometimes do is to revert the relation temporarily for report.
Original relation :
Parent.pk -> child.keyfield
Reverted :
child.keyfield -> parent.pk
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform