web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / PAD - VBscript Looping
Power Automate
Unanswered

PAD - VBscript Looping

(1) ShareShare
ReportReport
Posted on by 204

Hi everyone,

I'm currently using the "List rows present in a table" action to retrieve data, which is being stored in a list of connector objects variable within my Power Automate Desktop flow.

Now, I need to use a VBScript to loop through this list and count the number of times the "Service Provider" field equals "test123".

I've been experimenting with various approaches, but I consistently encounter an error with the line For Each CurrentItem In "%Tracker_Data%". I suspect the issue lies in how the Tracker_Data variable is being referenced within the VBScript context. I'd rather loop through using VBscript than using the loops within PAD because it's a lot quicker especially with larger datasets.

Could anyone offer some guidance on the correct way to access and iterate through this list of connector objects in VBScript? Any help would be greatly appreciated!

Thanks!

 
 
 
VBScript
Dim count
 Dim filterServiceProviderValue
 Dim itemServiceProvider

 ' Set the value to filter by
 filterServiceProviderValue = "test123"

 ' Initialize the count
 count = 0

 ' Loop through each item in the Tracker_Data list
 For Each CurrentItem In "%Tracker_Data%" 
 
  itemServiceProvider = CurrentItem("Service Provider")

  If Trim(LCase(itemServiceProvider)) = LCase(filterServiceProviderValue) Then
   count = count + 1
  End If
 Next

 ' Output the total count
 WScript.Echo  count
 

 
 
 
 
 
 
 
 
 
Categories:
I have the same question (0)
  • christian12 Profile Picture
    204 on at
    If i do "%Tracker_data.value[0]['Service Provider']%" it works but i want to get all the values and count them. 
     
    If i try "i" as a variable where 0 is doesnt work. If I try count the rows in tracker data doesnt work either. Scrip fails
  • Suggested answer
    eetuRobo Profile Picture
    4,204 Super User 2025 Season 2 on at
    Hi,

    I think your assumption is correct that the VBScript is having trouble with the Tracker_Data variable. I think the issue is that VBScript is not able to use List of connector objects since that is not native to VBScript.

    One thing you could do is filter the table in the List rows present in a table -action and the just check the count.
     



    that should return only rows with test123 in Service Provider column. Then with Set variable get the Count with %GetItemsResponse.value.Count%
     



    If you don't want to do it that way then I would recommend reconsidering building the logic with PADs low code actions.
     
    I'd rather loop through using VBscript than using the loops within PAD because it's a lot quicker especially with larger datasets.
    That’s only true when you're running the flow from within the editor window. In that mode, execution is intentionally slowed down for debugging and development purposes, so you can see each step as it runs.
     
    If you close the editor and run the flow should be as fast as running vbscript even with large datasets.
     
    The editor runs the flow in debug mode, which intentionally slows down execution so you can visually follow each step. This helps with testing and troubleshooting, as you can see what's happening in real time. If the actions ran at full speed like they do outside the editor, they'd complete too quickly for you to observe or catch any issues.

    So if you close the editor window and run the flow from the PADs main window then the flow is much quicker.



    Or if you plan to start it from the Power Automate cloud flow at somepoint (either attended or unattended) then the same applies.


    If you really want to use scripting action then maybe try with Run .NET script -action with C# since that can take more complex variable types.
     
  • christian12 Profile Picture
    204 on at
    Thank you @eetuRobo
     
     
    I like the filter query option although I also need to filter via a date column. So example date request column needs to eq todays date as well.
     
     
    I'm unsure if we can do dates as its in serial number format on import (even though the original text is date format) and we have the option to convert it to

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 503 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 321 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard