Dim arrays & mapping fields

Jay R. Ashworth jra at baylink.com
Thu Jul 29 10:44:25 PDT 2004


On Thu, Jul 29, 2004 at 09:49:25AM -0400, Kenneth Brody wrote:
> However, associated fields (which you are using in your example) do not.
> If, for example, you have @WLFa1 processing, any reference to field "a2"
> will be the corresponding instance, regardless of their being contiguous
> or not.
> 
> For example:
> 
>     1 - a1) foo
>     2 - a2) bar
>     3 - a1)
>     4 - a2)
>     5 - something else
>     6 - a1)
>     7 - a1)
>     8 - a1)
>     9 - a2)
>    10 - another thing
>    11 - a2)
>    12 - a1)
>    13 - a2)
>    14 - a2)
> 
> If you leave the 3rd instance of a1 (field 6), then references to field
> a2 will refer to the 3rd instance of a2 (field 9).

That phrasing confuses me a bit, even though I know what's going on,
so, if you won't be offended, I'll expand a touch.  :-)

When you are running a report based on an index that includes an
associated field, then, in the context of the processing you run
against each record, the name of the associated field *group* (your a1
and a2) resolves to the real field that was the instance that caused the
current record to be selected -- it acts like a pointer would, in C.

I'd seen this in the context Ken mentions, @W*F code, but I'd rarely
seen it in mainline code, so it stonkered me for a while recently.
Ken?  Does the cross-ref generator catch these?  ISTR that it missed it.

@AF serves as an "array index" -- it tells you *which* of the associated
fields in the group is the one you're matched on; which one is the
current "row" of the "table" within the record you're working on.
This true even if those associated fields are not in sequential
real-field-number order in the table (correct, Ken?), though @FD is
much less useful there (it's primary purpose being to give you an array
index which you can use to index arrays mapped to other paired groups
of associated fields -- letting you get the quantity and price of the
current line of the invoice form after you figure out which item you're
processing).

But yes, if your fields are not in order, you're going to have to slog
through them one by one.

Cheers,
-- jra
-- 
Jay R. Ashworth                                                jra at baylink.com
Designer                          Baylink                             RFC 2100
Ashworth & Associates        The Things I Think                        '87 e24
St Petersburg FL USA      http://baylink.pitas.com             +1 727 647 1274

	"You know: I'm a fan of photosynthesis as much as the next guy,
	but if God merely wanted us to smell the flowers, he wouldn't 
	have invented a 3GHz microprocessor and a 3D graphics board."
					-- Luke Girardi


More information about the Filepro-list mailing list