|
|
Tip # 38 - fileProŽ Array AliasesAn alias is another name for the same data. For example, Bugs Bunny also known as Bugsy, or your sweet mother, Mrs. John Smith aka MOM. Two names for the same thing. This can give us a great tool in filePro. Dummy variables and field numbers can be referenced with arrays by counting.
An alias gives us two names for the same piece of data. Now that you see what can be done, let's look at an example.
Array Lookup Aliases15 -- - - - - - - - - - - - - - - - - -If: Then: lookup nick=filename k=ky i=a -nx 16 - - - - - - - - - - - - - - - - - - If: Then: dim amount(8):nick(5) 'This array is mapped to the fields 5-12 in the lookup file. 17 --- - - - - - - - - - - - - - - - - - - - If: Then: dim ttl(8)(8,.2,g):ta ; xx(2,.0)="1" This array is collecting the totals and the fields ta-th can be displayed or printed. 18 --- - - - - - - - - - - - - - - - - - - - - - The neatest trick possible with this array alias logic is to use the CLEAR command to clear the data in a record. For example, 100 fields from 95 to 194 must be reset to zero. One way to do this is to type in the processing: 95="";96="";97="", and continue to 194="". Not my idea of fun. However, using the alias logic you can do the following: dim fields(100):95 You have just associated each field from 95 to 194 to an array element. Now issue the following command: clear fields At this point all the data in the fields has been erased. Isn't that simple? Written by Nancy Palmquist at nlp@vss3.com Copyright, 2003 by Virtual Software Systems. All rights reserved. |