Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

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

(0) ShareShare
ReportReport
Posted on by

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)

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,508

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,839

Leaderboard