cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
tuuman
Level: Powered On

Dropdown doesn't show values

I'm creating a helpdesk app and I'm currently creating search functionality. I currently have following setup:
1. Radio buttons to choose between status, creator(author), priority and class

2. Dropdown menu that displays values depending on which radio button is pressed.

3. Gallery that is filtered based on what dropdown value user has selected.

 

To the dropdown menu I've just inputted manually the values. For author however there's no way I can add every person to the list and it is not convenient to update the values everytime employees change. So I thought I make dynamic values based on author of ticket (author name collected automatically when user creates the ticket). And here comes the problem: No matter what I do, I get empty values to the dropdown.

 

First I tried to add Distinct(SharepointList; Author) and Distinct(Sharepointlist; Author) on the dropdown Items field but best I could get was blank options. Next I created a new collection by using ClearCollect(colAuthorList; Author.DisplayName) on screens OnVisible field, then adding Distinct(colAuthorList; Result) on dropdown Items field. Results were the same, only blank options.

 

Does this problem has something to do with the Author field? It was a ready column  in Sharepointlist that I just checked to be visible. I thought it would ease the use of the helpdesk app since user no longer have to manually add their name since Sharepointlist can automatically collect the users name during the creation of ticket.

Everything else seems work. Manually inputted dropdown values shows correctly but dynamically inputted values shows blanks. Only clue that I know I'm doing something right is that there as many blank values as there would be author names. Let say there's total of seven tickets but only three unique authors. I can get the dropdown to show three values even though they're all blanks.

 

EDIT: Okay tried to create dynamic values for other options too. The dropdown doesn't seem to be willing to show any values if I enter anything else than straight values on table (like ["option1";"option 2";"option 3"] etc).

1 ACCEPTED SOLUTION

Accepted Solutions
tuuman
Level: Powered On

Re: Dropdown doesn't show values

(SOLUTION BELOW)
Thank you for your reply and for possible solution. I was able to solve it myself though I honestly don't why my solution worked.

 

I tried using ONLY Distinct(colAuthors;Result) on dropdown and that apparently worked alone so I knew the syntax was right. Then I pasted back all the rest and suddenly the problem was reversed. Dropdown showed only values by colAuthors but not any of the hand inputted values. I deleted colAuthors line and suddenly everything came back and added colAuthors line back the problem was back again. I guess there's something wrong is Powerapps handling dropdown values if there's strings and collections in same If-statement.

I guess iamlee your solution might work though it looks kinda messy (no offense, if Powerapps requires this then there's no other way). I just don't understand since basic If-statement syntax is If([Condition];[True value];[Else value]) and you can nest multiple If-statements like If([Condition];[True value];[Condition];[True value]... ...[Condition];[True value];[Else value]. This helps clearing the code. Multiple If-statements can be also kinda hard to read.

 

SOLUTION:

I created new collections for Tila, Prioriteetti and Luokka and added them in the dropdown Items as Distinct(collection;Result) and now I got everything to show up properly.

If(
    HakuPeruste_Radio.Selected.Value="Tila";Distinct(colTilaHaku;Result);
    HakuPeruste_Radio.Selected.Value="Prioriteetti";Distinct(colPrioriteetti;Result);
    HakuPeruste_Radio.Selected.Value="Luokka";Distinct(colLuokkaHaku;Result);
    HakuPeruste_Radio.Selected.Value="Tekijä";Distinct(colAuthors;Result)
)
5 REPLIES 5
iamlee
Level 8

Re: Dropdown doesn't show values

Try displaying the output to a Label control first to see what is the data you're picking-up. This will help you validate whether your output file maybe doesn't match any of your data. It might be best to just user the 'User' function and save it to a single text column. 

 

Share your formula, that'll make it easier. I usually use 'Distinct(Filter(Table,Condition),Column)' when I want to do a dynamic drop down menu. 

tuuman
Level: Powered On

Re: Dropdown doesn't show values

So on the search page I have this on OnVisible:

ClearCollect(colAuthors;Distinct(Tikettijärjestelmä;Tekijä.DisplayName))

"Tikettijärjestelmä" is the Sharepoint list and "Tekijä" (Author) is a column I'm looking for the names.

I checked the collection from Files>Collections and there I can see colAuthors has picked three names which are the authors of our test tickets.

Next I have this on dropdown menu called Haku_Dropdown:

If(
    HakuPeruste_Radio.Selected.Value="Tila";["Avoin";"Työn alla";"Selvityksessä";"Suljettu";"Peruutettu"];
    HakuPeruste_Radio.Selected.Value="Prioriteetti";["Pieni";"Normaali";"Suuri"];
    HakuPeruste_Radio.Selected.Value="Luokka";["Hallinto";"Käyttäjäneuvonta";"Käyttölupa";"Laitteisto";"Ohjelmisto - sisäiset";"Ohjelmisto - ulkoiset";"Selvitystyö";"Verkkoyhteydet";"Ylläpito"];
    HakuPeruste_Radio.Selected.Value="Tekijä";Distinct(colAuthors;Result)
)

HakuPeruste_Radio is a bunch of radio buttons that user can use to select search term. Haku_Dropdown checks what radio button is chosen. This defines what options or values dropdown has. As you can see first three are manually hand inputted by me. The last one (Tekijä) should print the names from the colAuthors I've collected earlier. However the dropdown shows empty values (see images below).
1a.PNG1b.PNG

tuuman
Level: Powered On

Re: Dropdown doesn't show values


@iamlee wrote:

Try displaying the output to a Label control first to see what is the data you're picking-up. This will help you validate whether your output file maybe doesn't match any of your data. It might be best to just user the 'User' function and save it to a single text column.


I tried to print the info on text label but the problem is that label expect the format to be text or string and the collection is a table so it can't print it.

 

I can't use the User()-function because User()-function picks the current users information. However I need the names of people who have entries so I have to pick the names from my list or create a new collection (which I have done) that contains all the names. If I were to use User() in the dropdown it would only show current user's name and that's not what I'm looking for.

Highlighted
iamlee
Level 8

Re: Dropdown doesn't show values

Hi @tuuman , 

 

I tried this with your data set and I'm able to get a result out of the drop down. The only thing I could think of is PowerApps doesn't support your IF statement, you have to do a nested IF. PowerApps IF statement syntax is 

If(Condition,Value if True, Value if False). I have used this solution when I need to have a 'ALL' in my drop down menu as PowerApps cannot handle wild card syntax. 

 

//test if HakuPeruste_Radio.Selected.Value="Tila" is true//

If (HakuPeruste_Radio.Selected.Value="Tila",        

        ["Avoin";"Työn alla";"Selvityksessä";"Suljettu";"Peruutettu"],        

        //if false, then run IF again//

            If(HakuPeruste_Radio.Selected.Value="Prioriteetti",

            ["Pieni";"Normaali";"Suuri"],

            //if false, then run IF again//

                If(HakuPeruste_Radio.Selected.Value="Luokka",

                ["Hallinto";"Käyttäjäneuvonta";"Käyttölupa";"Laitteisto";"Ohjelmisto - sisäiset";"Ohjelmisto - ulkoiset";"Selvitystyö";"Verkkoyhteydet";"Ylläpito"],

               // if still false, run the formula below//

               Distinct(colAuthors;Result)

               )

        )

)

 

tuuman
Level: Powered On

Re: Dropdown doesn't show values

(SOLUTION BELOW)
Thank you for your reply and for possible solution. I was able to solve it myself though I honestly don't why my solution worked.

 

I tried using ONLY Distinct(colAuthors;Result) on dropdown and that apparently worked alone so I knew the syntax was right. Then I pasted back all the rest and suddenly the problem was reversed. Dropdown showed only values by colAuthors but not any of the hand inputted values. I deleted colAuthors line and suddenly everything came back and added colAuthors line back the problem was back again. I guess there's something wrong is Powerapps handling dropdown values if there's strings and collections in same If-statement.

I guess iamlee your solution might work though it looks kinda messy (no offense, if Powerapps requires this then there's no other way). I just don't understand since basic If-statement syntax is If([Condition];[True value];[Else value]) and you can nest multiple If-statements like If([Condition];[True value];[Condition];[True value]... ...[Condition];[True value];[Else value]. This helps clearing the code. Multiple If-statements can be also kinda hard to read.

 

SOLUTION:

I created new collections for Tila, Prioriteetti and Luokka and added them in the dropdown Items as Distinct(collection;Result) and now I got everything to show up properly.

If(
    HakuPeruste_Radio.Selected.Value="Tila";Distinct(colTilaHaku;Result);
    HakuPeruste_Radio.Selected.Value="Prioriteetti";Distinct(colPrioriteetti;Result);
    HakuPeruste_Radio.Selected.Value="Luokka";Distinct(colLuokkaHaku;Result);
    HakuPeruste_Radio.Selected.Value="Tekijä";Distinct(colAuthors;Result)
)