Peter,

Could you be looking for lingo's value function?

The following code produces the same output in the message window:
        gStandard1DataRef = [1,2,3]     
        put gStandard1DataRef
        x = 1
        put value("gStandard" & x & "DataRef")

Hope that helps,
Charles



-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Peter Witham
Sent: Monday, October 20, 2003 3:35 PM
To: [EMAIL PROTECTED]
Subject: RE: <lingo-l> Accessing global variables with sent parameters


Hi Kerry,

   Thanks for the tip, I'll give it a go. If it helps here is the
handler the other code and a static gStandard1DataRef showing how it
fits in the code that I'm trying to automate. I'm wondering if the dot
syntax is going to cause me a problem with my idea. I know this code
works as is, the global variable gStandard1DataRef is a list of around
60 variables and it works it's way thru the list loading the data.

LoadListData is another handler just for ref.

on LoadDataSet datadir
  Global gStandard1DataRef
  x = 1 
  repeat while x < gStandard1DataRef.count + 1
    LoadListData (datadir, gStandard1DataRef[x])
    x = x + 1
  end repeat
end

Regards,
Peter

Peter Witham
Internet and Multimedia Solutions
http://www.evolutiondata.com
icq: 4436851
MSN: [EMAIL PROTECTED]

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Kerry Thompson
Sent: Monday, October 20, 2003 2:45 PM
To: [EMAIL PROTECTED]
Subject: RE: <lingo-l> Accessing global variables with sent parameters

>    I have an embarrassing question that I should know the
> answer too but my memory is waaaay faulty today. Below is a 
> code snippet, what I'm trying to do is access a global 
> variable to use it's value for something in a function but 
> part of the variable name is being sent as a parameter, it's 
> a number from 1 to 10. So the code below for example should 
> be accessing this
> 
> Global gStandard1DataRef
> 
>    If I use
> 
> LoadDataSet 1
> 
> Here's my faulty code
> 
> on LoadDataSet stdnum
>   Global "gStandard"&stdnum&"DataRef"
> End

There may be a way to construct a variable name on the fly, like you can
in Flash, but I'm not certain if/how it's done.

I would make the variable a list and access it by list reference.
Something like:

on LoadDataSet stdnum
  Global glStandardDataRef
  return glStandardDataRef.getAt(stdnum)
End

[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]).
Lingo-L is for learning and helping with programming Lingo.  Thanks!]


[To remove yourself from this list, or to change to digest mode, go to
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email
[EMAIL PROTECTED]  (Problems, email [EMAIL PROTECTED]).
Lingo-L is for learning and helping with programming Lingo.  Thanks!]



[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to