cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Cascading Combobox show loading message

Hello,

 

I'm trying to figure how how to inform the user while a combobox is loading.  I have 2 cascading combo boxes.  The first combobox is loaded with values on App start.  The user makes a selection in combobox 1, and this selection is used to filter the results for combobox 2.  This is a query that runs over the gateway and can take a second or two to load, so during this time, I'd like to display a "Please wait - loading . . " message in the 2nd combobox. 

What I have so far is in the 1st combobox OnSelect property I set a variable to as follows:
Set(IsLoading, True);

Then in the 2nd combobox InputTextPlaceholder method, I check this variable and display the message a message:
If(IsLoading, " Please wait", "Select choice");

Also, in the 2nd combobox Items property, I have a filter:
Filter ('datasource', ChoiceID = Combobox1.Selected.Choice).ID

 

What I can't figure out is once the Items have loaded in Combobox 2, how do I change the variable back to false?  I get an error if I place this in the ComboBox2.Items property:
Filter ('datasource', ChoiceID = Combobox1.Selected.Choice).ID;
Set(IsLoading, false);

"Behvaior function in a non-behavior property".

 

I can't seem to figure out a way to accomplish what I'd like to do. Any thoughts?

1 ACCEPTED SOLUTION

Accepted Solutions

Hey @Anonymous 

 

You are getting this error because the behaviour functions are not allowed in the "Items" property.
You cannot directly set this variable to false. As a workaround for this, you can create a local collection when the combobox1 control is selected and same collection can be used in items of combobox2 and the Placeholder text can be set based on the rows count in Collection.
 
Combobox1: OnChange -> Clear(MyCombobox2Coll);Collect(MyCombobox2Coll,Filter ('datasource', ChoiceID = Combobox1.Selected.Choice).ID)
 
Combobox2: Items -> MyCombobox2Coll
 InputTextPlaceholder -> If(CountRows(MyCombobox2Coll) = 0, " Please wait", "Select choice")
 
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!

View solution in original post

2 REPLIES 2

Hey @Anonymous 

 

You are getting this error because the behaviour functions are not allowed in the "Items" property.
You cannot directly set this variable to false. As a workaround for this, you can create a local collection when the combobox1 control is selected and same collection can be used in items of combobox2 and the Placeholder text can be set based on the rows count in Collection.
 
Combobox1: OnChange -> Clear(MyCombobox2Coll);Collect(MyCombobox2Coll,Filter ('datasource', ChoiceID = Combobox1.Selected.Choice).ID)
 
Combobox2: Items -> MyCombobox2Coll
 InputTextPlaceholder -> If(CountRows(MyCombobox2Coll) = 0, " Please wait", "Select choice")
 
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!
Anonymous
Not applicable

Thanks Yashag2255,

 

I understood why I couldn't set the variable, just couldn't construct another way of achieving the same objective.  Your method is perfect!

 

 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (3,425)