Hello, Not sure if this was raised here already but I still cannot figure this out and I have also searched a lot for this but still found no answer: I have a dropdown = MainCategory which looks up from a sharepoint list so this is automatically populated based on a combo box selection which is the NameEmployee. However, when I click Edit, it does not remember the initial choice and is showing blank. I would want it to remember the initial entry.
This is the formula of MainCategory dropdown:
ITEMS: Sort(Distinct(Filter('Master Employee',NameEmployee=ComboBoxEmpName.Selected.Result),Category),Result) DEFAULT: ThisItem.MainCategory
Photo A: Initial entry is automatically populated based on the choice in the previous combo box
Photo B: In detail screen, it is showing and then I click on the Edit button
Photo C: So when I click on the Edit button, the dropdown is not showing Factory anymore. It is blank. The idea is that users may be able to edit
thanks in advance!!
Solved! Go to Solution.
Could you please tell me how you set the Items and DefaultSelectedItems property of the Combo Box?
I think the key is how you set the Items property of the Combo Box. If you use the Distinct() function, the DefaultSelectedItems should be set with something related to "Result".
In my scenario, I set the Items property of the Combo Box as below:
Distinct('Master Employee',NameEmployee)
Set the DefaultSelectedItems property of the Combo Box as below:
{Result:ThisItem.NameEmployee}
Set the Items property of the Dropdown as below:
Filter(
[@'Master Employee'],
NameEmployee = ComboBox1.Selected.Result
)
Set the Default property of the Dropdown as below:
LookUp(
'Master Employee',
NameEmployee = ComboBox1.Selected.Result,
Category
)
Note: Please do follow my workaround to check if it works.
Hope it could solve the problem this time.
Best Regards,
Qi
Hi@CatPagulayan,
Based on the issue that you mentioned, do you want to make the dropdown control corresponding to the MainCategory selected display when you edit?
Could you please share a bit more about the scenario:
From the screenshots, I could not get why you use Distinct(xxx, Category) to filter the 'MainCategory'.
Please do answer the above questions.
Best Regards,
Qi
Hi @v-qiaqi-msft ,
To reply to your questions:
Based on the issue that you mentioned, do you want to make the dropdown control corresponding to the MainCategory selected display when you edit? - Yes. So what I would want is when I click on Edit, whatever is defined there initially (in my example - factory) should be automatically displayed as well and not blank.
Could you please share a bit more about the scenario:
Is this MainCategory dropdown a Combo Box or a Dropdown, which determines which you need to set, the Default property, or the DefaultSelectedItems property? - MainCategory is a Dropdown and not a combo box so the Default property is the one I set.
What is the column type of the NameEmployee, MainCategory, and Category, are they all Text columns? - NameEmployee is a combo box, MainCategory is a dropdown, Category is the name of the column in my Sharepoint list (which actually is the MainCategory. MainCategory is just the name of the dropdown, but the data is coming from a Sharepoint list where the column's name is Category)
What is the relationship between the 'MainCategory' and 'Category'? - they are the same. Category is just the column name in my sharepoint list while MainCategory is the name of my dropdown in PowerApps (the datacardkey name)
From the screenshots, I could not get why you use Distinct(xxx, Category) to filter the 'MainCategory'. - i use distinct because MainCategory information should show results based on NameEmployee which is a list of employee names in a sharepoint list.
Hope the above clarifies 🙂 let me know if you still have other questions. Thanks in advance for your help!
Hi@CatPagulayan,
Do you want to filter the Dropdown based on the Combo Box selected and make the Dropdown selected keep when editing?
Thanks for the response and your description do a big favor.
My bad for not describing what a column type is. This refers to the corresponding data type of the column in your data source, such as a Single line of text, Choice, Person, and so on.
Combine that with the formula you provided, I assume that the NameEmployee and Category are all Single-line-of-text column type.
The following is my scenario, you could check for reference.
Please try the following workaround.
Set the Items property of the Dropdown as below:
Distinct('Master Employee',Category)
Set the Default property of the Dropdown as below:
ThisItem.Category
Set the Update property of the Dropdown as below:
Dropdown1.Selected.Result
Note: Please note that you should refer to the column name from your SP list directly rather than the control name.
Hope it could help.
Best Regards,
Qi
Hi @v-qiaqi-msft ,
My columns are single line of text.
It is almost perfect 🙂 however, I have a cascading dropdown so whatever is in the Master employee selection, the Main Category dropdown should automatically show. In the case of what you have advised, all of the categories are showing and not just the category of the employee selected. Hope you can help, we are almost there 🙂
Hi@CatPagulayan,
Do you want to make the Dropdown populated with the only item based on the Combo Box selected?
If my understanding is correct this time, you just need to set the Items property of the Dropdown. There is no need to set the Default property of the Dropdown.
Set the Items property of the Dropdown as below:
[
LookUp(
'Master Employee',
NameEmployee = ComboBoxEmpName.Selected.Result,
Category
)
]
Note: Please do remember the brackets "[" "]".
Hope we get there this time.
Best Regards,
Qi
Hi @v-qiaqi-msft ,
It is okay for new creation, but when I edit, again the dropdown doesn't show :(.
I made the Default of MainCategory dropdown as blank.
Could you please tell me how you set the Items and DefaultSelectedItems property of the Combo Box?
I think the key is how you set the Items property of the Combo Box. If you use the Distinct() function, the DefaultSelectedItems should be set with something related to "Result".
In my scenario, I set the Items property of the Combo Box as below:
Distinct('Master Employee',NameEmployee)
Set the DefaultSelectedItems property of the Combo Box as below:
{Result:ThisItem.NameEmployee}
Set the Items property of the Dropdown as below:
Filter(
[@'Master Employee'],
NameEmployee = ComboBox1.Selected.Result
)
Set the Default property of the Dropdown as below:
LookUp(
'Master Employee',
NameEmployee = ComboBox1.Selected.Result,
Category
)
Note: Please do follow my workaround to check if it works.
Hope it could solve the problem this time.
Best Regards,
Qi
Now this solved it!!! thank you @v-qiaqi-msft ! really appreciate you looking into this 🙂 🙂 🙂
Hi @v-qiaqi-msft ,
sorry but I ran into another problem.. seems your solution is applicable only if there is only 1 selection?
Because I tried it in this sample: this is my sharepoint list - single line of text still
ComboBoxA | DropDownB |
Yes | Yes |
No | Yes |
No | No |
so my scenario is i choose ComboBoxA = Yes, DropDownB automatically becomes a Yes (this is ok and working fine)
but when I choose ComboBoxA = No, DropDownB only shows Yes. The idea is that I will be able to choose between yes or no.
If there is any way i can deal with that, again, considering that what I will be choosing initially will be reflected even if I click Edit. Combo box or dropdown does not matter as long as I get the result 🙂
thanks in advance!
User | Count |
---|---|
224 | |
99 | |
95 | |
57 | |
31 |
User | Count |
---|---|
283 | |
113 | |
107 | |
63 | |
61 |