Tip of the Day! Arrays and Dummy Variables Relationship

Kenneth Brody kenbrody at bestweb.net
Fri Nov 30 06:54:39 PST 2007


Quoting fp (Fri, 30 Nov 2007 05:23:30 -0700):

> This tip will cover several things as they are basically one
> in the same or very closely related.
>
> -------------------------------------------------------------
> (1) Did you know that you can clear all dummy variables
> using arrays?  Well try this:
>
> then: dim dummy(702):a; clear dummy.

Well, _I_ knew that.  :-)

[...]
> -------------------------------------------------------------
> (2) Did you know that you can define an array, associated to a
> number of dummy variables and give each variable a unique edit?
> Well, try this:
>
> if:   '             aa        ab      ac        ad
> then: dim array( (10,mdyy/)(2,state)(10,zip)(14,phone) ):aa
>
> You can even go multiple lines in your processing table like so:
[...]

You can also intersperse the multi-line definition with comments:

     dim array( (10,mdyy/)   ' aa - birthday
                (2,state)    ' ab - current state
                (10,zip)     ' ac - zip code
                (14,phone)   ' ad - phone number
              ):aa

> You are not limited to two lines ... I do not even know the limit
> if any but I know I have used several lines without problems.

Well, if aliased to AA, you would be limited to 703 lines simply
because there are only 702 dummy fields.

> -------------------------------------------------------------
> (3) Did you know that if you defined an array of
>
> then: dim dummy(702):a
>
> in your automatic process and did same in all of your processes,
> all variables are global but the edits are not?

By "the edits are not [global]", I assume you mean you have declared
them to have no type/length, and they therefore they take on the
type/length of what is assigned to them, just as if you didn't have
the DIM to "create" the fields.

[...]
> Note that this has its UP and DOWN side.  It is great for called
> processes that will use variable in similar format but could be
> trouble if the format changes unexpectedly (I guess this will be
> true no matter what you use).  Another DOWN is that 'every' dummy
> variable is, well, GLOBAL.

Use DECLAREd variables, and then you have explicit control over
GLOBAL/LOCAL visibility.

> Hope you find these interesting!

Good tips.

-- 
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list