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

Combobox display fields with filter

Hi, 

 

I'm looking to try and display 2 lookup values in a combo box. At the moment i have a sharepoint data source that has 2 lists.... an employee list (LIST A) with name, status, date of birth, my powerapp is looking at a sign-in/out list which contains a lookup to the employee information. (LIST B)

 

My combo box is looking at LIST B employee name (lookup to LIST A), where the status is "OK" (LOOKUP to LIST A)... the problem i have is that there's the possibility that we have 2 people with the same name, to get around this i wanted to display in the combo box person name & DOB, under normal circumstances this would be quite easy, but since both fields are a lookup. for display fields it's set to "Value"

 

Info below on the current settings in the combobox, and ideally i want to show person_name value, and DOB value. so that the user can identify the correct person when siging in.

 

Items.JPGdisplay.JPG

 

Thanks,

 

Brian 

TimRohr
Level 10

Re: Combobox display fields with filter

The easiest way to accomplish what you're after is to go to the basic Properties pane, and click on your datasource. Change the combobox from "Single" to "Double", and select your primary and secondary fields for display.

double_combobox_example.PNG

You will then see, on the Advanced Properties pane, your DisplayFields have updated.

 

Alternately, if this is not a solution for you, you can use the AddColumn() statement in your combobox's Items property to add a column which is properly concatenated to display the information you're after. This thread has a pretty good example of that.

 

Post back if you need more help.

DangerousBrian
Level: Powered On

Re: Combobox display fields with filter

Hi Tim, I've tried that but i'm only allowed to select value on the dropdown again for the secondary value which just duplicates the results in the combo box. I've tried to modify the displayfields to be ["Value",'Person_NameSmiley Very HappyOB'.Value] but the result is the same. How would the addcolumn statement work in connection with the filter choices that i already have in my items selection? Thanks, Brian
TimRohr
Level 10

Re: Combobox display fields with filter

My apologies... It always takes a minute to spin my brain back into SharePoint list-mode. I more often work in CDS.

I believe something like this should work for the Items property:

AddColumns(Filter(Choices(...), ...), "yourNewColumnName", nameField & " (" & dobField & ")")

 

Once you have that, you should be able to set your DisplayField to yourNewColumnName.

Community Support Team Rank
Community Support Team

Re: Combobox display fields with filter

Hi @DangerousBrian,

Could you please share a bit more about the data structure of your List B ('Contractor Sign-In' list)?

Is the Person_Name a LookUp column in your List B?

Based on the needs that you mentioned, I think the AddColumns function could achieve your needs. I have made a test on my side, please take a try with the following workaround:2.JPG

 

3.JPG

Within the Edit form, set the Items property of the Combo Box control within the Person_Name Data card to following:

AddColumns(
Filter(Choices('20190104_case4_SignIn'.Person_Name), Value in Filter('20190114_case4_Inductions',RED_CARD_STATUS="OK").Person),
"DateOfBirth", /* <-- New added column */
Text(LookUp('20190114_case4_Inductions', ID = Id,'Date of birth'))
)

Note: The 'Date of birth' column is a Date type column in my '20190114_case4_Inductions' SP list.

On your side, you should type:

AddColumns(
Filter(Choices('Contractor Sign-In'.Person_Name), Value in Filter(Inductions, RED_CARD_STATUS = "OK").Person),
"DateOfBirth", /* <-- New added column */
Text(LookUp(Inductions, ID = Id,'Date of birth')) /* <- The 'Date of birth' represents the date of birth column in your Inductions list*/
)

Set the DisplayFields property of the Combo Box control to following:

["Value", "DateOfBirth"]

Please check the attached GIF screenshot for more details:

 

More details about the AddColumns function and LookUp function in PowerApps, please check the following article:

AddColumns function

LookUp function

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
DangerousBrian
Level: Powered On

Re: Combobox display fields with filter

Hi Kris, 

 

I tried my hardest to use the addcolumns in conjuction with the filter over the last few days but seemed to waste so much time. As a work around i have created a new column in the inductions list and used flow to concatenate person&DOB as Person_DOB then used the new field for the lookup in powerapps.

 

Thanks,

 

Brian 

Community Support Team Rank
Community Support Team

Re: Combobox display fields with filter

Hi @DangerousBrian,

Have you solved your problem?

I think the solution I provided above could achieve your needs. I think it is not necessary to add new column in your Inductions List, and use MS flow to populate that column.

Please take a try with the solution  I provided above, check if your issue is solved.

 

If you have solved your problem, please go ahead to click "Accept as Solution" to identify this thread has been solved for other users.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.