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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Bug switch button - lo...
Power Apps
Unanswered

Bug switch button - loop on recursive function who change their value

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

hello, I made an app on power apps and on a canvas I control 2 values of data who are linked between them.

this is what i have : 

Orelian_0-1625831516791.png

I make 2 function, one for when I enable the switch button and for when I disable the switch button

 

on check : 

 

 

 

Patch(
 WaitingExecutionStepsCollection;
 First(
 Filter(
 WaitingExecutionStepsCollection;
 SK = ThisItem.ParentExecutionStepSK
 )
 );
 {ValidationStatus: true}
 )

 

 

 


on uncheck : 

 

 

 

Collect(
 StepCollection;
 Filter(
 WaitingExecutionStepsCollection;
 ParentExecutionStepSK = ThisItem.SK
 )
);;
If(
 ThisItem.SK = uncheckStart;
 Patch(
 StepCollection;
 Defaults(StepCollection);
 ThisItem
 )
);;
If(
 IsBlank(
 Filter(
 WaitingExecutionStepsCollection;
 ParentExecutionStepSK = ThisItem.SK
 )
 );
 ForAll(
 StepCollection;
 {ValidationStatus: false}
 )
);;
UpdateIf(
 WaitingExecutionStepsCollection;
 !IsBlank(
 LookUp(
 RenameColumns(
 StepCollection;
 "SK";
 "SK1"
 );
 SK1 = SK
 )
 );
 {ValidationStatus: false}
)

 

 

 

 

on select :

 

 

 

Set(
 uncheckStart;
 ThisItem.SK
);;
Patch(
 WaitingExecutionStepsCollection;
 ThisItem;
 {ValidationStatus: tg_Status.Value}
);;
Clear(StepCollection)

 

 

 

 

on change : 

 

 

 

UpdateIf(
 Filter(
 WaitingExecutionStepsCollection;
 ProcessingType = "Error" && RootFailedSequenceSK = ThisItem.FailedSequenceSK
 );
 true;
 {ValidationStatus: tg_Status.Value}
);;

 

 

 

With this when I put true for a data, all the parent has their value put in true but when I make false, I have a problem, just the last children are put in false or I have an infinite loop in the first parent or nothing change. I see that the value change because  the switch button change of value, but my apps change the value just after (that cause a loop sometime)

Categories:
I have the same question (0)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 476

#2
WarrenBelz Profile Picture

WarrenBelz 365 Most Valuable Professional

#3
Vish WR Profile Picture

Vish WR 339

Last 30 days Overall leaderboard