palmtree with sun behind it CONTACT US
Phone: (412) 835-9417
Email: sales@vss3.com

Tip # 37 - fileProŽ Simple Arrays


dim list(10)This would identify 10 variables; list("1"), list("2"), ... list("10")

Each of these could be the same type of data, in that case you can give an edit to the data as shown in the following example.

dim date(10)(8, mdy/)

This would identify 10 date variables with the edit (8,mdy/). Sometimes the elements in the array are all different types of data and can be specified as shown in the following array definition.

dim list((1, yesno)(3,.0)(8,.2)(10)) This array has 4 elements.

If line is not long enough to list all elements, break between )( and continue on next line.

-15 -- - - - - - - - - - - - - - - - - -
If:
Then: dim list( (1,yesno)(3,.0)(2,.0)(15,*)(30,*)(8,mdy/)(8,.2)
16 -- - - - - - - - - - - - - - - - - -
If:
Then: (10)(12)(15) )

This array has 10 elements, 7 defined on the first line and three on the second. Notice the double parenthesis at the beginning and the end to embrace each definition.

Arrays can be used to hold data that is not displayed on the screen, but is needed to do calculations or provide background information. For example, an array can hold a list of passwords to different functions.

dim passwd(5)(10,,g);passwd("1")="update"; passwd("2")="delete"; passwd("3")="addit"; passwd("4")="root";passwd("5")="restricted"

In different situations in your programming you can ask for passwords and match them against the correct passwd in the list. For example, if the user asked to delete a record the logic might be as follows:

25 ------- - - - - - - - - - - - - - - -
delask If: @bk eq "D" and pw ne passwd("4") 'last password given not root
Then: inputpw popup pw(10,,g) "Deletion Password: "
26 ------- - - - - - - - - - - - - - - -
If: delask and pw ne passwd("2") and pw ne passwd("4")
Then: errorbox "Access to this function not available.";return 'branch out of this
27 ------- - - - - - - - - - - - - - - -
loop If: 'do your delete function here
Then: delete record; return
28 ------- - - - - - - - - - - - - - - -

Written by Nancy Palmquist

Copyright, 1997 by Virtual Software Systems.  All rights reserved.

Contact Us by: Email to Virtual Software Systems or Phone: (412) 835-9417