Writing out multiple records to a subfile from a single recor
d
Pickering, John (NORBORD)
PICKERIJ@norbord.com
Thu, 7 Jun 2001 11:40:01 -0400
Good suggestion Mark.
I have found this technique quite useful. Useful to the extent that my
database has a table called LOOPS. For key value 1 there is 1 record; for
key value 2 there are 2 records; for key value 3 there are 3 records; I
think you get the picture. There is also a column with the record number
within the key value. I think the unique key (for those databases that
insist on having a unique key) is "1 of 2", "2 of 2", etc.
I have an import job which validates the data much as for George's edit
task. Rather than multiple passes to check a hundred or so error conditions
I access all of the tables necessary for validation and then to a specific
key in the LOOPS table. Linking to key value 5 allows me to check 100 error
conditions with 20 subfile statements.
Then the code looks something like:
>define d_error_1 char*30 &
> = "error message one" &
> if 1 = record_no of loops and [error condition 1] &
> else "error message two" &
> if 2 = record_no of loops and [error condition 2] &
> else "error message three" &
> if 3 = record_no of loops and [error condition 3] &
> else "error message four" &
> if 4 = record_no of loops and [error condition 4] &
> else "error message five" &
> if 5 = record_no of loops and [error condition 5]
>subfile errors alias errors_1 append &
> if "" ne d_error_1 include [whatever],d_error_1
This is repeated so that there are 20 defines and 20 subfile statements
giving 100 errors.
I have also found this LOOPS table useful for creating varying numbers of
copies with Quiz. The receiving dock wants a label to stick to each item
received. If they receive 10 bearings, they want 10 labels. On the same
receipt there might be 5 of something else requiring 5 labels. And for a 4
litre jug of goop they only want one label even though they received 4
litres. The Quiz label program simply links "number_of_labels" to the key of
LOOPS.
Regards,
JWP
> -----Original Message-----
> From: Bruin, J.M. de [SMTP:Bruin@wt.tno.nl]
> Sent: Thursday, June 07, 2001 4:02 AM
> To: powerh-l@lists.swau.edu
> Subject: RE: Writing out multiple records to a subfile from a single
> recor d
>
> Why not 'create' multiple record complexes using a additional file with
> 'dummy'
> records in it?
> And output to subfile if condition occurs with one of the complexes?
> Haven't tried it and haven't worked it out, but .......
> This way you won't have to bother about the # of files etc. /request/run
>
>
> Mark
>
> -----Original Message-----
> From: George_DeWolf@midhosp.org [mailto:George_DeWolf@midhosp.org]
> Sent: Thursday, June 07, 2001 03:05
> To: powerh-l@lists.swau.edu
> Subject: Writing out multiple records to a subfile from a single record
>
>
> Many thanks to all that responded to my question about writing multiple
> records to a subfile from a single record. I will be using multiple
> SUBFILE
> {name} ALIAS {alias} IF {condition} statements to create the multiple
> records. Thanks, in particular for the information on maximum number of
> subfiles which can be declared. I will definitely exceed the limit of 63
> file declarations so will need to use multiple passes.
>
> George DeWolf
> Middlesex Hospital
>
>