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 Apps / Order of running the "...
Power Apps
Answered

Order of running the "OnSelect" and "OnChange" triggers

(0) ShareShare
ReportReport
Posted on by 84

Hi,

 

I'm trying to create a power app in which i have a questionnaire, with possibility to add a picture if a specific value is selected.

I'm Using a Form, and due to Lay-out limitations i can not  have the capture picture together in the "Edit Form" Control.

 

So in case a picture needs to be taken, the current form will be submitted. and in the next screen the picture will be added. After this the user will be returned to the first screen.

 

in order to reduce the amount of clicks, i use a slicer (in below example called Req02) to enter the values. with a minimum value of 1, and a maximum value of 5. I also would like to change the Fill color of the DataCard in case the question was answered in a previous screen. (this to make it clear to the user which questions he already has answered.)

 JeanPhilippevb_0-1670242251722.png

For this i use in the "Fill" section of the datacard below function

If(ReqVal02=Blank(),

     RGBA(0,0,0,0),

     RGBA(226, 250, 230, 0.7))

Via the "OnChange" i would fill in the Variable

Set(ReqVal02,Req02.Value)

 

But because the use of the Slicer: at the moment it will submit the form (to take the picture), it will select automatically the lowest  Value, and thus it will always change the 'blank()' Value of the field even i the user didn't change them. So All questions will be marked as green (Value 1).

 

I tried to fix this by using the "OnChange" property of the slicer: i was hoping to block this off, So it would only register "manual" changes to the slicer:

 

"OnSelect":

UpdateContext({OnSel02: 1})

"OnChange" 

If(OnSel02=1,

     Set(ReqVal02,Req02.Value);UpdateContext({OnSel02: 0}),

     Set(ReqVal02,Blank()))

"Default"

If(ReqVal02=Blank(),1,ReqVal02)

 

But it seems the "On Change" is triggered before the "OnSelect", so with this setup it is not possible to change the value of the slicer at all.

 

I have the feeling i'm over complicating it, though i don't see much alternatives now (using a dropdown would make it possible, though the user experience would not be the same).

Any advice you can give me?

 

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @Jean-Philippevb 

     

    • UI-wise, use a Radio control instead of a slider. This makes it easy for users to select the option they want navigating from 1 to 5 every time.
    • As for your case, if you want to stay with Slider, use only the OnChange

    I did a short demo for both: https://youtu.be/XuY7PelXtiM

     

    Advice for your app:


      ✔️
    Just in case my response helped you solve your problem, please mark/accept this as a SOLUTION This helps community members if they experience a similar issue in the future.

     

      🔗
    🕸bistek.space  🐦 @cha_bistek  📺 @BisTekSpace 
  • Verified answer
    Jean-Philippevb Profile Picture
    84 on at

    Hi Cha_Cha,

     

    I found the solution: 

    Via the "OnChange" i would fill in the Variable

    Set(ReqVal02,Req02.Value)

    "OnSelect":

    UpdateContext({OnSel02: 1})

    and with the OnVisible parameter of the Screen i put:

    If(OnSel02<>1,Set(ReqVal02,Blank()));

     

    so i'm blanking out the Values in case the values had not been changed manually. (which allowed me to keep using the slider).

    The radio control could have worked, to the feeling of it is different.

     

    Regarding the delegation warning, i did follow the tips and tricks from Reza (see minute 7:10), so i'm filtering in my data as much as possible on validated fields, but in order to get the value of a specific record i understand i Best use the "first()" instead of the Lookup function, This did fix the delegation warning now.

    JeanPhilippevb_1-1670251125987.png

     

    For the tabs, i'm using it in other apps, and will definitely do it also in the monthly audit form (to be added later).

     

    Kind Regards,

    Jean-Philippe

     

  • cha_cha Profile Picture
    4,932 Moderator on at

    Hi,

     

    Happy that you got it sorted. You should mark your response as the answer as maybe someone might stumble on the same issue in the future.

     

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 Apps

#1
WarrenBelz Profile Picture

WarrenBelz 711 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 319 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard