cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sienna28
Post Patron
Post Patron

Execute search until no match found

Is it possible to keep running the search command until a match is not found in my collection?

I know there is no looping available in PowerApps.

I wonder if a timer could do it.

It would not matter if the whole procedure is run, but when a match is not found in the collection the timer should somehow end.

1 ACCEPTED SOLUTION

Accepted Solutions
mdevaney
Super User
Super User

@sienna28
I have an idea. It does not use any timer and it loops through all records but ensures only one record is returned.

Set(breakLoop,False);
ForAll(testCollection,
If(And(breakLoop=False, your other conditions here),
your true condition code here;
Set(breakLoop,True);
)
);

There’s also another option: you could COLLECT all the results and extract the first result using the FIRST function.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

2 REPLIES 2
mdevaney
Super User
Super User

@sienna28
I have an idea. It does not use any timer and it loops through all records but ensures only one record is returned.

Set(breakLoop,False);
ForAll(testCollection,
If(And(breakLoop=False, your other conditions here),
your true condition code here;
Set(breakLoop,True);
)
);

There’s also another option: you could COLLECT all the results and extract the first result using the FIRST function.

—-
Please Accept as Solution if this post answered your question so others may find it more quickly. If you found this post helpful consider giving it a Thumbs Up.

View solution in original post

Thanks - unsure if this works for my scenario.

I sent a message with more details.

Helpful resources

Announcements
2022 Release Wave 1 760x460.png

2022 Release Wave 1 Plan

Power Platform release plan for the 2022 release wave 1 describes all new features releasing from April 2022 through September 2022.

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (2,785)