Network Automation Software We are currently migrating this forum
over to our HelpSystems domain. Please
post all new threads in our new
HelpSystems Community Portal.
Post to the HelpSystems Forum
You are not currently logged on. You must be logged on in order to post. Log on
Or Create a new account
AutoMate Discussion
Decrease font size
Increase font size
Topic Title: Loop through muliple variables and set values
Topic Summary:
Created On: 11/01/2016 03:35 PM
Status: Read Only
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
View similar topics View similar topics
View topic in raw text format. Print this topic.
Answer This question was answered by JamesSupancic, on Monday, November 7, 2016 8:29 AM

Answer:
I found the following code works for my case. Thanks for your help Gijsberth!
 11/01/2016 03:35 PM
User is offline View Users Profile Print this message

Author Icon
JamesSupancic
Journeyman (50-99)

Posts: 85
Joined: 09/29/2005

I can't seem to figure out a simple way to loop through a set of variables and change the values as follows:

%Pointer1a%=(will have a value of 1, 2, or 3)
%Pointer1b%=(will have a value of 1, 2, or 3)
%Pointer2a%=(will have a value of 1, 2, or 3)
etc... (Probably about 100 of these)

What I would like to do is set any variables as follows:

if the variable = 1, set same variable to A
if the variable = 2, set same variable to B
if the variable = 3, set same variable to C

So, if %Pointer1a% = 1, then would like to change %Pointer1a% = A

Seems simple, but I can't seem to find a way to loop through a list of variables and reset the values without writing if statements for each one of the variable. Any help will be greatly appreciated.

Thanks, James



 Category Survey
 11/02/2016 12:33 AM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

I'm not sure I understand your problem, but are you saying that you want to change the value of a variable from a number to a letter? like 1 = A?

 Category Survey


-------------------------
I am an A-Team Member
 11/02/2016 06:10 AM
User is offline View Users Profile Print this message

Author Icon
JamesSupancic
Journeyman (50-99)

Posts: 85
Joined: 09/29/2005

Exactly.

 Category Survey
 11/02/2016 08:19 AM
User is offline View Users Profile Print this message

Author Icon
Alex Escalante
HelpSystems

Posts: 871
Joined: 02/26/2014

Hello James,

Unfortunately "if statements" will most likely be needed for this type of execution. This is in order to determine which letter to change the variable value to based on the number it is reading. You will need to write out the multiple if statements, then loop through the variables to change them.

We apologize for the inconvenience.

 Category Survey


-------------------------

Alex Escalante | Support Analyst
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1.213.738.1700 | F: +1.213.738.7665
 11/03/2016 05:15 AM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

Can you tell a bit more about the variable names? If you can use an array instead of a list of variables, it could become very simple....

 Category Survey


-------------------------
I am an A-Team Member
 11/03/2016 05:38 AM
User is offline View Users Profile Print this message

Author Icon
Gijsberth de Ruiter
Artisan (200-499)

Posts: 455
Joined: 03/30/2005

If I can loop through the variables, you can use %chr$(asc(variable)+16)% to change the value.

 Category Survey


-------------------------
I am an A-Team Member
 11/04/2016 07:11 AM
User is offline View Users Profile Print this message

Author Icon
JamesSupancic
Journeyman (50-99)

Posts: 85
Joined: 09/29/2005

Thank you Gijsberth, will try your formula tonight:-)

 Category Survey
 11/07/2016 08:29 AM
User is offline View Users Profile Print this message

Author Icon
JamesSupancic
Journeyman (50-99)

Posts: 85
Joined: 09/29/2005

Answer Answer
I found the following code works for my case. Thanks for your help Gijsberth!

 Category Survey



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)
Statistics
18258 users are registered to the AutoMate Discussion forum.
There are currently 0 users logged in.
The most users ever online was 5551 on 01/08/2018 at 11:11 AM.
There are currently 1710 guests browsing this forum, which makes a total of 1710 users using this forum.

FuseTalk Enterprise Edition v4.0 - © 1999-2020 FuseTalk Inc. All rights reserved.

Sitemap Network Automation Software Blog