Long Variable Name as Array Element#

Kenneth Brody kenbrody at bestweb.net
Mon Aug 16 19:43:17 PDT 2004


Scott Walker wrote:
[... rclerk 5.0.13 ...]
>         dim Redhat_Sell[6](12,,2):aa
>         declare Cust_Type(1,*)

I would use (1,.0) for clarity, but that's irrelevent to the question
at hand.

>         Cust_Type=order_file(82)    'Will be a value of 1 - 6

I would insert:

    mesgbox "Cust_Type = '" & Cust_Type & "'"

What does it show?

>         Redhat_Sell[Cust_Type]=Redhat_Sell[Cust_Type]+8  'Add up Total
> Sales for Customer Type
> 
> The fourth line gives me a syntax error when I run it.  Says:
> 
>         "A filepro error has occurred"
> 
>         "Array Index Out of Range:  dim redhat_sell(6) -- Index: 0"
> 
> If I change it to this:
> 
>         dim Redhat_Sell[6](12,,2):aa
>         ty(1,*)
>         ty=order_file(82)
>         Redhat_Sell[ty]=Redhat_Sell[ty]+8
> 
> It works like a champ.

Assuming that orderfile(82) is the same in both cases, both should work
the same way and give the same results.

-- 
+-------------------------+--------------------+-----------------------------+
| Kenneth J. Brody        | www.hvcomputer.com |                             |
| kenbrody/at\spamcop.net | www.fptech.com     | #include <std_disclaimer.h> |
+-------------------------+--------------------+-----------------------------+



More information about the Filepro-list mailing list