Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Slider Component setting to default after sliding

(1) ShareShare
ReportReport
Posted on by 36
I built a slider component that I use as a swipe feature in my app. My starting view is a document. The default value of the slider is 50. If I move the slider to the right, i.e., to 100, the status changes, and a new document is displayed. Now the slider value should jump back to 50, its default value. I don't know how to do this. I already tried using Set, but it doesn't work.





  • YoshiIsTesting Profile Picture
    YoshiIsTesting 36 on at
    Slider Component setting to default after sliding
    @tsa-svd2srv yes :) in this way it works, i dont know why but it works :) 
    thanks a lot
  • Verified answer
    tsa-svd2srv Profile Picture
    tsa-svd2srv 192 on at
    Slider Component setting to default after sliding
    Sorry, your right. Try this:
     
    In the Components panel (not Screens) and with the component selected, create a New custom property. I named mine "ResetTrigger". Use the settings in the image below:
     

     
    For the Component (yours: cmp_Swipe), you now have a property called ResetTrigger, set it to 50.
     

     
    Then set its OnReset property to "Reset(Slider2)", (or whatever your slider control's name is in the Component).
     

     
    The Slider control's Default property, I left mine blank.
     

     
    Finally, back on the Screens panel, in my button's OnSelect, set it to Reset("ComponentName". In your case, probably something like, "cmp_Swipe_1"
     
     
    Hopefully you understand you could put that Reset() in a string of functions, Maybe even at the end of your OnChange functions.
     
    Let me know if it works
  • YoshiIsTesting Profile Picture
    YoshiIsTesting 36 on at
    Slider Component setting to default after sliding
     
    thanks for response. I can only access Slider2 within the component, not in the app. Therefore, Refresh doesn't work because refresh doesn't recognize Slider2.



  • Suggested answer
    tsa-svd2srv Profile Picture
    tsa-svd2srv 192 on at
    Slider Component setting to default after sliding
    It may be as easy as adding Reset in the place (somewhere near or at the end) amongst your code.
    Set(MySliderNumber, SwipeComponent_4.SliderValue);
    If(
       MySliderNumber > 50,
       Patch(
          ApprTable, 
          LookUp(ApprTable,
             Dokumentnummer = ApprTableID), 
             { 'Status (new_status)': 'Status (ApprTable)'.Genehmigt }
          );
          Notify("Patched Accepted"),
       Patch(
          ApprTable, 
          LookUp(
             ApprTable,
             Dokumentnummer = ApprTableID),
             { 'Status (new_status)': 'Status (ApprTable)'.Abgelehnt });
          Notify("Patched Denied")
       );
    
    Refresh(ApprTable);
    
    UpdateContext(
        {
            SelectedIDRecord: LookUp(ListItemswithID, ID = SelectedRecord.ID)
        });
    
    If(IsBlank(SelectedIDRecord),
        Back(),
    //else
        UpdateContext(
            {
                SelectedRecord: LookUp(ApprTable, Dokumentnummer = SelectedIDRecord.Record.Dokumentnummer)
            });
    ResetForm(Form2_1););
    
    Reset(Slider2)
     

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,475

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,767

Leaderboard