Variable with a Variable in the Name

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
glavender
Newbie
Posts: 10
Joined: Thu Aug 21, 2014 7:20 pm

Variable with a Variable in the Name

Post by glavender » Thu Aug 21, 2014 7:43 pm

Let>theIndex=4
Let>Person%theIndex%=1
//is there a way to reference the variable Person4 by the theIndex variable as in:
//MessageModal>Person%theIndex%=%Person%theIndex%%
//The %'s inside %'s does not work, but is there way to reference variable with a variable in the name?
Thank you,
Gerry

User avatar
JRL
Automation Wizard
Posts: 3526
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Variable with a Variable in the Name

Post by JRL » Fri Aug 22, 2014 4:41 am

Only a few functions can deal with an array variable so its always best to set the array variable value to a non-array variable before use

Code: Select all

Let>theIndex=4
Let>Person%theIndex%=1
Let>value=Person%theIndex%
MessageModal>value

glavender
Newbie
Posts: 10
Joined: Thu Aug 21, 2014 7:20 pm

Re: Variable with a Variable in the Name

Post by glavender » Sat Aug 23, 2014 7:26 pm

Thank you JRL. Looks like that should work.
Gerry

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts