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 / Count string occurrenc...
Power Automate
Unanswered

Count string occurrences to trigger condition

(0) ShareShare
ReportReport
Posted on by 32

Hi Community,

 

I'm building a scheduled flow that assesses the most recent iAuditor inspections and only sends an email notification if a particular condition is met. The condition is True when a string occurs in the underlying iAuditor data x times or greater. Part of the complication is that the iAuditor Connector doesn't work with Repeat Sections, which is how the iAuditor form is constructed, so the Filter Array/ Compose combination detailed here can't do what I require. 

 

Currently the Flow looks like this (the Compose actions in red are where I have been attempting to count the output):

2022-09-26_095137.png

 

I can see from the Raw Output that it contains the string I'm looking for:

String existsString exists

 

I did experiment with creating an Initialize Variable action but it won't work inside an 'Apply to each', so I'm not sure if that is the right path to go down.

I've also played with building a 'length' expression, but with no luck so far.

 

If someone could provide a little assistance to get me past this hurdle I would be most appreciative.

Categories:
I have the same question (0)
  • Courty Profile Picture
    32 on at

    I don't know if this is useful or not, but the same outcome can be achieved in Zapier using the following Python code (I'm aware that Python can be used in Power Automate desktop, but I'm trying to keep that as a last resort for only if all else fails):

     

     

    auth_header = {'Authorization': 'redacted'}
    api_url = 'https://api.safetyculture.io/audits/'
    audit_id = input['audit_id']
    audit_doc = requests.get(api_url + audit_id, headers=auth_header).json()
    
    for item in audit_doc['items']:
     if item.get('responses') and item['responses'].get('failed') == True:
     return{'proceed': True}
    
    return{'proceed': False}

     

     

    So I'm making an assumption that an expression that replicates the query part of this code would solve my problem? 

  • Courty Profile Picture
    32 on at

    I've done some more research and experimentation, and it appears that replicating the Python code is not possible as the specific output referenced is not available in Power Automate via the iAuditor connector. So the original query stands (an expression or similar to count occurrences of the string). Can anyone please assist?

  • Verified answer
    Courty Profile Picture
    32 on at

    Hi all,

     

    just communicating that this is now solved. I was able to get assistance from a programmer who found a workable solution.

     

    FWIW, he created a variable then used a combination of the skip, contains and indexOf functions to validate the presence of the string within a designated section of the output.

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 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard