I am building an autocomplete textbox control in Powerapps, using SharePoint as a datasource.
I have added a Gallery below the textbox. OnSelect,OnChange of the textbox, I have set the Gallery visibility flag to true.
UpdateContext({showgalleryflag:true});
In the Gallery, Items property, I have populated the datasource as below
If(Not(DataCardValue5.Text=""),Filter('DS',DataCardValue5.Text in Event));
In the Gallery, OnSelect,
UpdateContext({showgalleryflag:false,Event:ThisItem.Event});
In the Gallery, Visible
showgalleryflag
Still i notice, that the autocomplete doesn't work. The Gallery doesn't shows up, even when the Event is changed/selected.
Any technical advice would be helpful. Thanks.
Solved! Go to Solution.
Can you please confirm that the "Default" property of the textbox is set to Event variable?
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @Kumar9024021 ,
It sounds like you have a gallery that you want to populate with options that match the text typed into the field. The "in" operator is non-delegable with SharePoint and is resulting in options not appearing that you may expect.
Instead, I suggest restructuring your filter:
If(
!IsBlank(DataCardValue5.Text),
Filter('DS',
StartsWith(Event,DataCardValue5.Text)
)
)
This means, "If the text in the input field is NOT blank, Filter the 'DS' table to show all Events that start with the given string."
I would also check to make sure the text input field has a Default of "" instead of completely blank as both are treated differently.
Let me know if this was the case.
Mr. Dang
Hi @Mr-Dang-MSFT ,
Thanks for the response. I noticed that the auto-complete now works.
When I key-in text Sam in the textbox, I can see Sample1, Sample2 which is correct. However when I select Sample2 from the auto-complete results, it doesn't gets selected. If i click on Sample2, it should appear in the Event textbox.
Also, I notice the autocomplete results overlap other fields adjacent to it. Anyway we can avoid this ?
@Kumar9024021 wrote:
Hi @Mr-Dang-MSFT ,
Thanks for the response. I noticed that the auto-complete now works.
When I key-in text Sam in the textbox, I can see Sample1, Sample2 which is correct. However when I select Sample2 from the auto-complete results, it doesn't gets selected. If i click on Sample2, it should appear in the Event textbox.
Also, I notice the autocomplete results overlap other fields adjacent to it. Anyway we can avoid this ?
Hi @Kumar9024021 ,
I'm not sure how you set up the rest of your autocomplete feature. What OnSelect actions have you set up? Where are they located and what do those formulas look like?
Can you clarify what you mean by 'autocomplete results overlap other fields'?
Hi @Mr-Dang-MSFT ,
The Gallery OnSelect formula is
UpdateContext({showgalleryflag:false,Event:ThisItem.Event});
Can you try to update the configuration to:
Gallery OnSelect -> UpdateContext({showgalleryflag:false,Event:ThisItem.Event});Reset(DataCardValue5)
Also, in the Default property of the DataCardValue5, use the Event variable.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @yashag2255 ,
Thanks for the response. When I tried to update the Gallery configuration, I get below error on the Reset(DataCardValue5)
Any advice would be helpful. Thanks.
Hey @Kumar9024021
To resolve this error, you can create a variable to reset the property as:
Gallery-> OnSelect -> UpdateContext({showgalleryflag:false,Event:ThisItem.Event});Set(ResetVar,true);Set(ResetVar,false)
DataCardValue5 -> Reset -> ResetVar
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hi @yashag2255 ,
I added the above code and noticed that the code works fine in Preview without any issues.
However, when I save and publish the app, the selected autocomplete results gets reset to blank and the textbox shows blank.
I refreshed the browsing history, cache but still its the same.
Can you please confirm that the "Default" property of the textbox is set to Event variable?
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
User | Count |
---|---|
176 | |
116 | |
85 | |
44 | |
41 |
User | Count |
---|---|
239 | |
153 | |
131 | |
77 | |
72 |