Hello,
I have a dropdown that is created from two columns, like this:
Sort(ShowColumns(Filter([DataSource],[Column]=[FilteringCondition] ),"Description","Code"),Description,SortOrder.Ascending)
As a result, I have a dropdown with two fields available, "Description" and "Code". My Value property is set to Description field, so it shows all the descriptions from the list.
Similarly, the Default property is set to a variable that has a string that could be one of the descriptions possible, so it works fine and it positions the dropdown on the right element whenever the variable is set (if it is empty, shows the first element, as intended).
Question is: We can easily set Default by the Description content, but is there a way to Default it by the another column other than the one set in Value property? For instance, if I have a Code, can I use it to position the dropdown on the element that has that code, even though it is displaying Descriptions? Or are we "locked" to operations only on the Value-set column?
Thanks!
Thanks for the reply but that unfortunately does not solve, since I have duplicated descriptions and that's why searching for the code is relevant. For instance, if my dropdown is like this (Code / Description):
001 / TextA
002 / TextB
003 / TextB
004 / TextC
If I use the code mentioned above, searching for code 003 will return description "TextB" from the data source, which will set the dropdown to the first occurrence (due to the lookup) which is code 002, the wrong code.
What I need is that I can search directly the dropdown using code = 003 and position it on the right element so when later I use dropdown.SelectedText.code, for instance, I get the code 003 and not 002.
Looks like that even though PowerApps allows you to have multiple columns in the dropdown, you're stuck with the one set on the Value property for searching.
Hi @OCJ,
That is certainly possible, but will require a slight adjustment to the Default property. As said, searching via the value field is very easy. You can simply save text to a string and use that as the default property.
If we want to search via other fields, we will have to leverage a LookUp that returns the description of the record that matches our conditions:
LookUp(DataSource, Description = variableName || Code = variableName).Description
If this solves your question, would you be so kind as to accept it as a solution.
Thanks!