Long Variable Name as Array Element#
GCC Consulting
gcc at optonline.net
Tue Aug 17 19:35:31 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 irrelevant 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.
> >
>
>
> I agree, it either on should work but the one where I use the Long
> Variable for the array element fails...everytime. I just
> tried to use
> a Long_Variable with another array, and it also fails with a
> similar error message. I think something is broken.
>
> I'm forwarding this to fp tech support.
I created the following test routine to test long variables. Fp Native ODBC 1.0.13 rclerk
59 ------- - - - - - - -
@keyl ◄ If:
Then: dim cassie(6)
60 ------- - - - - - - -
◄ If:
Then: declare counter(1,.0)
61 ------- - - - - - - -
◄ If:
Then: counter="1"
62 ------- - - - - - - -
loop ◄ If:
Then: cassie(counter)=counter
63 ------- - - - - - - -
◄ If:
Then: counter=counter+"1"
64 ------- - - - - - - -
◄ If: counter le "6"
Then: GOTO loop
65 ------- - - - - - - -
◄ If:
Then: aa=listbox(cassie)
66 ------- - - - - - - -
◄ If: @sk = "ENTR"
Then: END
67 ------- - - - - - - -
When run, the list box has the numbers 1 thru 6. Therefore the variable "counter" worked as expected. I even tested the value as count_er to see if that had an effect. It didn't.
Looking again at you posting above change cust_type(1,*) to (1,.0) or (1,#). Then test your code.
Richard Kreiss
GCC Consulting
More information about the Filepro-list
mailing list