cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sienna28
Responsive Resident
Responsive Resident

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.
sienna28
Responsive Resident
Responsive Resident

Thanks - unsure if this works for my scenario.

I sent a message with more details.

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (5,808)