Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

GRIP: Variable named data list and arrays...

Status
Not open for further replies.

Shadowspawn

Aerospace
Sep 23, 2004
259
Hi folks,
I'm creating a grip for std notes based on the type of drawing it will be and product line. All the notes are being pulled from our standard library, with each note in a separate text file. The file names of the notes are contained in a data list and the routine cycles through the array of note names to pull the notes in and write them to the drawing. The routine works, but I'm trying to streamline it (it's getting pretty hairy at this point...).
My problem is that I'm trying to set a string variable equal to the datalist name, and then assign that variable to the name of an array.

...EXISTING CODE SNIPPET...
IFTHEN/r1==5,tfn=dir+OLGbx(x)+'.txt'
nlist(x)=OLGbx(x)
d=3 $$ # of notes in datalist, to term loop
ELSEIF/r1==6,tfn=dir+OLPump(x)+'.txt'
nlist(x)=OLPump(x)
d=10
ELSEIF/r1==7,tfn=dir+OLLSP(x)+'.txt'
nlist(x)=OLLSP(x)
d=10
...
Above is a snippet of my existing code. I'm trying to set a variable == OLGbx, OLPump, OLLSP, or whatever data list I need to use, and then set an array equal to that variable name for use in the code, something like below (although this code doesn't work obviously...)
...
IFTHEN/ r1==5, ndl='OLGbx'
d=3
ELSEIF/ r1==6, ndl='OLPump'
d=10
ELSEIF/ r1==7, ndl='OLLSP'
d=10
ENDIF
tfn=dir+ndl(x)+'.txt'
nlist(x)=ndl(x)
IF/x==d, done=1
...

Okay....so what am I missing??? Everything from a simple nudge to a smack in the noggin would be appreciated, and of course TIA. :)

SS
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor