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 counting down doesn`t
Topic Summary: Loop action with From > To never executes
Created On: 03/13/2014 05:44 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 JeanDelfosse, on Friday, March 14, 2014 12:13 PM

Answer:
John,
counterintuitively, to loop from 3 to 1 by -1 one needs to specify FROM 1 TO 3 BY -1
In fact FROM is the LOWER boundary and TO the UPPER one, in spite of their spelling.
Sample below
 03/13/2014 05:44 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

I just tried to use the Loop action with From = 3 and To = 1, and it wouldn't execute the content of the loop. I tried it both with the Step argument blank (hoping that AutoMate would be smart enough to default to a -1 increment) and with Step = -1. It wouldn't execute the loop content either way.

It doesn't throw an error. It just acts like it is comparing the value of its internal counter to the larger of the From and To arguments, regardless of which parameter the value was intended for.

Attached sample code includes a workaround.

(Also works this way when run on my Windows 7 dev station.)

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2



 03/13/2014 08:58 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

Answer Answer
John,
counterintuitively, to loop from 3 to 1 by -1 one needs to specify FROM 1 TO 3 BY -1
In fact FROM is the LOWER boundary and TO the UPPER one, in spite of their spelling.
Sample below

 Category Survey
AutoMate BPA Server 8 version:
Windows version:



Task Steps: (Right click, Select All, Copy to copy to the clipboard. Steps can then be pasted into the AutoMate Task Builder)


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 03/14/2014 12:13 PM
User is offline View Users Profile Print this message

Author Icon
JohnScott
Artisan (200-499)

Posts: 231
Joined: 10/27/2010

I have verified that your version works.

If the v10 action dialog still labels these fields as "starting index" and "ending index", may I suggest that rephrasing those labels is probably in order, or perhaps enhancing the documentation with an example of how to counterintuitively use them for decrementing loops?

Thanks, Jean!

 Category Survey
AutoMate BPA Server 8 version: 8.0.1
Windows version: Windows 2003 R2
 03/14/2014 12:38 PM
User is offline View Users Profile Print this message

Author Icon
JeanDelfosse
Supreme Guru (1000+)

Posts: 8883
Joined: 03/30/2005

You're welcome, John.
I don't know if N/A can switch the FROM/TO pair with negative increments, because this behavior has been there forever, and backward compatibility is important when version is migrated.
Maybe a better labeling of "lower index" and "upper index" in the GUI is feasible, while keeping in the AML the FROM and TO parameters, plus obviously an explanation/example in the help.

 Category Survey
AutoMate BPA Server 8 version:
Windows version:


-------------------------
Jean Delfosse - Automate Beta Tester
Win7 Pro 64 bits -Win XP Pro SP3 32 bits - AM8, AM7, BPA10, BPA9, BPA8, BPA7, AM6 Enterprise, AM4
 03/14/2014 03:54 PM
User is offline View Users Profile Print this message

Author Icon
Valentineo McGowan
HelpSystems

Posts: 766
Joined: 09/03/2013

Hello John,

Attached is a screenshot of what the Loop range action presently looks like in version 10. I will forward your suggestion on to the Developers to have an example of a -1 de-incrementation added to the Help file.
I think that is an excellent addition.

 Category Survey


Click for full image
Click for larger image



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

Valentineo McGowan | Technical Consultant
AutoMate | Division of HelpSystems
HelpSystems, LLC | T: +1 213.738.6966 | F: +1.213.738.7665
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 2034 guests browsing this forum, which makes a total of 2034 users using this forum.

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

Sitemap Network Automation Software Blog