Long Variable Name as Array Element#
Scott Walker
scottw1 at alltel.net
Tue Aug 17 11:28:19 PDT 2004
> -----Original Message-----
> From: Nancy Palmquist [mailto:nlp at vss3.com]
> Sent: Tuesday, August 17, 2004 1:20 PM
> To: Scott Walker
> Cc: 'Kenneth Brody'; Filepro List - No spam
> Subject: Re: Long Variable Name as Array Element#
>
>
> Scott Walker wrote:
>
> >
> >>-----Original Message-----
> >>From: Kenneth Brody [mailto:kenbrody at bestweb.net]
> >>Sent: Monday, August 16, 2004 10:11 PM
> >>To: Scott Walker
> >>Cc: Filepro List - No spam
> >>Subject: Re: Long Variable Name as Array Element#
> >>
> >>
> >>Scott Walker wrote:
> >>
> >>>Can you use a Long Variable name as an array element.
> >>
> >>Yes.
> >>
> >>
> >>>I can't seem to on 5.0.13 rclerk.
> >>
> >>Define "can't seem to".
> >>
> >>
> >
> >
> > Real simple:
> >
> > dim Redhat_Sell[6](12,,2):aa
> >
> > declare Cust_Type(1,*)
> >
> > Cust_Type=order_file(82) 'Will be a value of 1 - 6
> >
> > 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.
> >
> Scott,
>
> Make the Cust_Type a number instead of a literal
>
> declare Cust_Type(1,.0)
>
> Subscripts are numeric not literal. It might behave
> correctly. I might also add a check to see that Cust_Type ge
> "1" and Cust_Type le "6"
>
> so you are sure that it will post correctly.
> Nancy
>
>
> --
> Nancy Palmquist
> Virtual Software Systems
> PHONE: (412) 835-9417 Web site: http://www.vss3.com
>
>
Nancy,
I already tried that and it did not make a difference, nor should it
because, as shown above, the short variable was ty(1,*) and that works
fine...why would the Long Variable have to be (1,.0) for it to work.
That does not make sense....afterall declare Cust_Type(1,*) and ty(1,*)
are just two different names for the same animal, right? And I'm sure
the value of Cust_Type is between "1" and "6"...if it was not, then the
code using ty as the variable name would fail also, and it runs fine.
Anyhow, Ken says it should work, and several others say the code snippet
above does work fine, so it must be something else in my prc table
causing the problem. I play with it some more later today.
Thanks to all for their thoughts
More information about the Filepro-list
mailing list