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: How to speed up looping a large variable?
Topic Summary: How-to speed up looping a variable by using Basic Script
Created On: 07/12/2018 01:56 AM
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.
 07/12/2018 01:56 AM
User is offline View Users Profile Print this message

Author Icon
DorelPureca
Apprentice (20-49)

Posts: 31
Joined: 12/20/2016

Hi there!


I have built an integration in which I use APIs in order to upload a file to a webpage.

One of the responses that I get, the amount of data is huge (by normal loop, it takes currently 45 seconds to find a value that I need).

I understood there is another way to speed up loop by writing a basic script, which I have no clue how to do that.
Did some research, but couldn't find any examples applicable for my situation... and I need to improve the performance of this integration, due to large amount of data and files.

Here's how my data looks like: %getDirectoriesResponse%:

id:1647330,parentId:889630,name:FolderName,level:1
id:1647331,parentId:1647330,name:From,level:2
id:1647332,parentId:1647331,name:2018,level:3
id:1647333,parentId:1647332,name:2018-01,level:4
id:1647334,parentId:1647332,name:2018-02,level:4
id:1647335,parentId:1647332,name:2018-03,level:4
id:1647336,parentId:1647332,name:2018-04,level:4
id:1647337,parentId:1647332,name:2018-05,level:4
id:1647338,parentId:1647332,name:2018-06,level:4
id:1647339,parentId:1647332,name:2018-07,level:4
id:1647340,parentId:1647332,name:2018-08,level:4

So what I am trying to achieve here is finding the current month ID, based on the Folder name.

How it works now:

1st loop: I loop through all data and check if one of the rows is ending with: "name:FolderName,level:1" (this row could be anywhere)

If so, I return id:1647730, which I will be using in next loop

2nd loop: I loop through all data and check if one of the rows is ending with: parentId:1647330,name:From,level:2

If so, I return id:1647331, which I will be using in next loop

3rd loop: I loop through all data and check if one of the rows is ending with: parentId:1647331,name:2018,level:3

If so, I return id:1647332, which I will be using in next loop

4th loop: I loop through all data and check if one of the rows is ending with: parentId:1647332,name:2018-07,level:4

If so, I return id:1647339, which I am looking for

Could someone help me build/write a basic script to achieve this? or perhaps there is another more eficient way?

Thank you in advance!

 Category Survey
AutoMate 10 version: 10.7.0
Windows version: Windows Server 2012 R2
 07/12/2018 05:19 AM
User is offline View Users Profile Print this message

Author Icon
DorelPureca
Apprentice (20-49)

Posts: 31
Joined: 12/20/2016

Today was a good day!

So, here's the work around discoverred:

1. Write the entire variable to a csv file
2. Read the csv and populate a dataset (dstemp), using as delimiter comma
3. Run following basic script:

Sub Main
For i=1 To dstemp.TotalRows
If "name:FolderName" = dstemp(i).Column3 Then
childrenLevel1=dstemp(i).Column1
Exit Sub
End If
Next
End Sub

and so on

 Category Survey
AutoMate 10 version: 10.7.0
Windows version: Windows Server 2012 R2


Edited: 07/12/2018 at 05:43 AM by DorelPureca
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 1048 guests browsing this forum, which makes a total of 1048 users using this forum.

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

Sitemap Network Automation Software Blog