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

Community site session details

Session Id : B5secf0zWa17V8YR+sEAmk
Power Apps - Building Power Apps
Unanswered

Dropdown reset itself after selection caused by patch in OnChange-property

Like (0) ShareShare
ReportReport
Posted on 30 Sep 2022 10:08:08 by

Hi everybody,

haven't found an answer yet.

 

I am using a dropdown control in a gallery to update values to ThisItem.
These values are then saved with a button "save" in a collection "colFragenToSave" (also in ThisItem).
The button should be disabled as long as no selection has been made.
In the collection I added a column called "SaveVisible" which returns true or false and thus controls the DisplayMode.

I put the OnChange-property of this dropdown to:

Patch(colFragenToSave;ThisItem;{SaveVisible:true})

The button then is in DisplayMode.Edit, but the selection of the dropdown felt back to default - what it shouldn't do.

 

Hope U understand my problem 🙂 

 

What am I doing wrong? 

 

Categories:
  • Knoll-TQEUser Profile Picture
    7 on 10 Oct 2022 at 07:01:22
    Re: Dropdown reset itself after selection caused by patch in OnChange-property

    Hi,

    I've solved it by a workaround:

    When I navigate to that screen, I set a variable for the Default-property to " " (which means empty). With the Patch-function of the OnChange-Property from the Dropdown, I set this variable to the dropdown.selected.value.

     

    Works fine 😉

  • Knoll-TQEUser Profile Picture
    7 on 04 Oct 2022 at 05:32:55
    Re: Dropdown reset itself after selection caused by patch in OnChange-property

    sure 🙂

    In "Gallery.png" you can see the whole screen. The others show what happens.

    Hope that helps...

  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on 04 Oct 2022 at 05:17:56
    Re: Dropdown reset itself after selection caused by patch in OnChange-property

    Sorry I didn't clearly get what is the issue being faced by you?
    Could you share multiple screenshots of the issues being faced by you?

    @Knoll-TQEUser 

  • Knoll-TQEUser Profile Picture
    7 on 04 Oct 2022 at 04:28:23
    Re: Dropdown reset itself after selection caused by patch in OnChange-property

    thanks for your prompt answer @Manan-Malhotra .

     

    I've set everything you've mentioned. Now in the whole gallery the Save-Button is active - it only should be at "ThisItem". (That's the reason, why I try to force it within the collection.) Also the Dropdowns of all questions (or ThisItem) is set to the first selected. 

     

    Any other suggestions?

    Maybe I describe more background:

    I try to create an Audit-App for suppliers. In one collection I store the questions, in the gallery the purchaser give the answer a rate, add a note and hit the Save-Button to save the results in an other collection. (Everything also works as an offline-app) 

    here the code for the OnSelect-Property of the save-button:

     

    If(ThisItem.Farbe=White; //if background color eq white means it's a new question to save - else Lookup in Results for the saved results. Farbe = own column in the collection
    Patch(colResults;Defaults(colResults);{AuditIdentify:First(colLieferantGewählt).Lieferantennr&Text(Now();"[$-en]ddmmyy");Bewertung:Value(Dropdown3_1.Selected.Value);ErgEbeneOKat:ThisItem.EbeneOKat;ErgEbeneUKat:ThisItem.EbeneUKat;ErgOberKat:ThisItem.OberKat;ErgUnterKat:ThisItem.UnterKat;FragID:ThisItem.ID;Frage:ThisItem.Frage;Gewichtung:Value(Dropdown1_1.Selected.Value);'zur Kenntnis genommen':DataCardValue16_1.Value;LiefIDKredListe:First(colLieferantGewählt).ID; Notiz:TextInput1_1.Text;Title:First(colLieferantGewählt).Lieferantennr });
    Patch(colResults;LookUp(colResults;FragID=ThisItem.ID);{AuditIdentify:First(colLieferantGewählt).Lieferantennr&Text(Now();"[$-en]ddmmyy");Bewertung:Value(Dropdown3_1.Selected.Value);ErgEbeneOKat:ThisItem.EbeneOKat;ErgEbeneUKat:ThisItem.EbeneUKat;ErgOberKat:ThisItem.OberKat;ErgUnterKat:ThisItem.UnterKat;FragID:ThisItem.ID;Frage:ThisItem.Frage;Gewichtung:Value(Dropdown1_1.Selected.Value);'zur Kenntnis genommen':DataCardValue16_1.Value;LiefIDKredListe:First(colLieferantGewählt).ID; Notiz:TextInput1_1.Text;Title:First(colLieferantGewählt).Lieferantennr }));;
    If(And(DataCardValue16_1.Value;Dropdown3_1.Selected.Value=" "); // Change Backgroundcolor of ThisItem
    Patch(colFragenToSave;ThisItem;{Farbe:RGBA(220; 220; 220; 1);IsChosen:false});
    Patch(colFragenToSave;ThisItem;{Farbe:RGBA(166; 166; 166; 1);IsChosen:false}));;
    Set(varFragenBeantwortet;CountIf(colFragenToSave;!IsChosen));;
    If(varAnzahlFragen=varFragenBeantwortet;Set(varPopupFertig;true));; //Gives a Popup after all questions been answered
    SaveData(colFragenToSave;"SavedFragenkatalog");;SaveData(colErgebnisse;"SavedErgebnisse")

     

    The save-button should be disabled as long as either Dropdown3_1 or toggle "zur Kenntnis genommen" wasn't used.

     

    Puuhh. difficult to describe if you're mothertounge is not english 😄 so sorry for that.

     

  • Manan-Malhotra Profile Picture
    621 Super User 2024 Season 1 on 30 Sep 2022 at 11:47:13
    Re: Dropdown reset itself after selection caused by patch in OnChange-property

    On the Visible property of save button use this code 

    If(IsBlank(Dropdown_Name),false,true)

    On the advance properties of dropdown  select "AllowEmptySelection"=true 

    Also, set the Default value to Blank() for drowdown from advances settings

     

    Remove other codes, no need for collection in this scenario

     

    Hopefully this helps 

     

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

Telen Wang – Community Spotlight

We are honored to recognize Telen Wang as our August 2025 Community…

Announcing our 2025 Season 2 Super Users!

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 637 Most Valuable Professional

#2
stampcoin Profile Picture

stampcoin 570 Super User 2025 Season 2

#3
Power Apps 1919 Profile Picture

Power Apps 1919 473

Loading complete