Associated fields question
Nancy Palmquist
nlp at vss3.com
Wed Mar 29 06:43:27 PST 2006
Jaime Perry wrote:
> Hello,
>
> I am having a problem with a report that is based on a file that
> contains several grouping of associated fields that can contain up to 10
> elements each. I have included a screen shot of a record to use as an
> example. My selection is based on a date range and the last three
> characters of the department field (which is a union code). The date
> criteria is generic to the whole record (not associated, one field for
> this). My sorts need to be union code, job number and employee code.
>
> RECORD NUMBER: 5
> EMPLOYEE CODE: 789
>
> DEPT JOB NO. COMP COST CODE RATE TYPE
> HOURS EXTENSION
> 000D10 000000 DE953 5200¦ 000 39.50 R
> 8.00 316.00
> 228D10 228000 DE953 5200¦ 000 39.50
> R 8.00 316.00
> 243D10 243000 DE953 5200¦ 000 39.50
> R 8.00 316.00
> 266D20 266000 DE953 5200¦ 000 39.50
> R 8.00 316.00
> 274D10 274000 DE953 5200¦ 000 39.50
> R 8.00 316.00
>
> My problem is that I need to select and sort the record for each
> instance where the union code matches the selection criteria. In the
> above example, 4 of the 5 lines would pass (the D10 union codes). I
> built an index on the job number associated field (J1) and this works
> fine as far as letting me select the record multiple times, but the real
> problem I am having is that I cannot determine which instance I am
> dealing with. The index gives me this record 5 times but I only need
> 4. I need a way to determine the instance so I can filter out unneeded
> instances and pass the correct job number to the sort. I thought @af
> would work, but it reports a "1" each time I hit the record. I am not
> sure if @af is supposed to work in a selection process or not or if some
> environmental variable is set wrong/not set that affects @af. If there
> is another way to select a record more than once, that would work as well.
> Thank you
> Jaime Perry
>
> _______________________________________________
> Filepro-list mailing list
> Filepro-list at lists.celestial.com
> http://mailman.celestial.com/mailman/listinfo/filepro-list
>
>
Jamie,
I am not usually a proponent of a work file, but for sanity sake this
might be a good example where it is very helpful and saves a bunch of
programming time.
Set up a file with the data fields you need to generate the sorts,
selections and report output you need.
Clear the file. Then add a record for each associated occurance in the
data that you want to consider.
Once that is done, the selections, sorts and reports are very simple.
Your complex sort and selection can make this solution very attractive.
Of course, you can do it with the associated field logic but it can be
tricky.
Since the work file is cleared and loaded each time, it is important
that two users are not running the same report at the same time. It
would be possible to make a work file for each user to eliminate any
possible overlap if that could be an issue. ("key"{@id on Unix, who
knows on windows.)
Nancy
--
Nancy Palmquist MOS & filePro Training Available
Virtual Software Systems Web Based Training and Consulting
PHONE: (412) 835-9417 Web site: http://www.vss3.com
More information about the Filepro-list
mailing list