cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Dropdown/combobox in gallery doesn't behave consistently

In a gallery (named myGallery) connected to myCollection, I have a dropdown control with 3 items : "0%", "8%", "10%". 

 

The idea is that, user would select the rate from the dropdown and it will update the collection. 

 

I have set the dropdown.OnChange as follows 
     

 

Patch(myCollection, ThisItem, {Col2: Dropdown2.Selected.Value})

 

 

It would work but not consistently. 

  1. when i click on 8%, it would change the value to 8% but the control would still remain 0%
  2. when i click 0% on the third item, the value of first item was changed.

see attached gif. 

I had similar issues with combobox. 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted

Hi @kcchong :

I did a test and I think I understand where the problem is. Because the records in myGallery are not unique (for example, with a primary key), the patch function always cannot find the correct record.Please try this code:

 

Collect(myGallery, {rate:"",ID:CountRows(myGallery)+1})

 

1.gif

Best Regards,

Bof

View solution in original post

12 REPLIES 12
Highlighted
Super User III
Super User III

@kcchong ,

What is the Text property of the label on the left and what is the Items property of the Gallery?

Highlighted
Community Support
Community Support

Hi @kcchong :

Could you tell me:

  • Have you set the dropdown2's Default property to "ThisItem.Col2"?

 I'v made a smilar test but did not encounted the problem you mentioned:

My data source:

 

ClearCollect(myCollection,{NO:1,Col2:" "},{NO:2,Col2:" "},{NO:3,Col2:" "},{NO:4,Col2:" "},{NO:5,Col2:" "})

 

1\Add a gallery control.

2\Add a drop drown control into this gallery.

Default:

 

ThisItem.Col2

 

OnChange:

 

Patch(myCollection, ThisItem, {Col2: Dropdown2.Selected.Value})

 

Items:

 

["0%", "8%", "10%"]

 

13.gif

Best Regards,

Bof

 

Highlighted

@kcchong ,

Happy to assist further when you provide the details I requested.

Highlighted

the text property is set as 

 

ThisItem.Rate

 

"Rate" being the name of the column in collection. 

 

items property is set as 

 

myGallery

 

where it's the name of the collection.

Highlighted

 


Could you tell me:

  • Have you set the dropdown2's Default property to "ThisItem.Col2"?

No, i left it as is when the drop down is created. 

 

"1"

 

apart from this, the only thing different was that i was using collect instead of clearcollect.

 

 

Highlighted

for some reason, i created the exact same step as you did, i couldn't reproduce the error. 

i attached file in case anyone would like to have a look at it. 

first screen was what i created. 

2nd screen was the exact step of what you did. 

the difference being 
i. i used collect as opposed to clearcollect. 

ii. initially, i didnt change the 'default' property but then subsequently i amended to 

 

thisitem.rate
Highlighted

Hi @kcchong :

Based on the GIF you provided above, the problem you mentioned earlier seems to be solved.
Could you tell me what is your problem now?

Best Regards,

Bof

Highlighted

Sorry for not making it easier to spot what's wrong with the gif. 

in this gif, i shorten to only where it went wrong and also highlighted where to focus on in red box. 

Highlighted

Hi @kcchong :

OK.Can you give me the code in OnSelect porblem in the Button? I will provide you with the complete solution.

Best Regards,

Bof

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (9,668)