web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Lookup Combo Box Datav...
Power Apps
Unanswered

Lookup Combo Box Dataverse Tables

(0) ShareShare
ReportReport
Posted on by 260

Hi all,

 

I have a combo box that returns Facility ID numbers from a Dataverse table called 'Facility IDS', however, the default selected value is from another table called 'New Projects' which gathers its information from an external form when it has been submitted.

As you can see, the combo box is returning the information in table 'New Projects' but when I put in a Text Input to show what the combo box should have selected it comes through as blank, this is because, I am assuming, it hasn't actually selected an ID and is only showing the data from the 'New Projects' table.

 

How do I get the combo box to Lookup the Facility ID that has been entered in the table 'New Projects' and select the correct one in the table 'Facility IDS'? and then if there isn't a match, show "Error, Facility ID does not exist" or something like that

carrieanne27_0-1710810702789.png

 

Categories:
I have the same question (0)
  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @carrie-anne27 -

     

    As I understand it so far. You have an Edit Form control on your screen (Form1). The DataSource property for this Form is a Dataverse table called "New Projects".

     

    You have another Edit Form control on your screen (Form2). The DataSource property for the Edit Form is a Dataverse table called "Facility IDS".

     

    Some initial questions:

    1. What is the data type for the Facility IDS field? (Single Line Text, LookUp, Choice etc)
    2. What have you entered into the Default Selected Items property for this ComboBox?
  • carrie-anne27 Profile Picture
    260 on at

    Hi @Amik 

    There are 2 tables.

    Table 1:

    'New Projects'

    Table 2:

    'Facility IDS'
     

    There is only 1 form

    This form is called fm_3CPR:

    DataSource: 'New Projects'

    Item: gl_CPR_Gallery_Selected

     

    fm_CPR3 Combo Box is called FacilityID_DCV:

    Default: {Value:Parent.Default}

    DefaultSelectedItems: {Value:Parent.Default}

    Items: 'Facility IDS'

     

    The column in table 'Facility IDS' is a text column

     

     

  • Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @carrie-anne27  - 

     

    Based on your responses, as I now understand it:

     

    You have an Edit Form control on your screen. The DataSource property for this Form is a Dataverse table called "New Projects".

     

    You have a Single Line Text field in 'New Projects', I will call this "TextColumn1". You have added this field as a DataCard into your Form.

     

    You have unlocked the DataCard for "TextColumn1and embedded a ComboBox inside the DataCard.

     

    The Items property for this ComboBox is a separate list called 'Facility IDS'. 

     

    Is that correct so far?

  • carrie-anne27 Profile Picture
    260 on at

    That is correct

  • Verified answer
    Ami K Profile Picture
    15,679 Super User 2024 Season 1 on at

    @carrie-anne27 - 

     

    Short answer:

     

    Try using applying the below to the DefaultSelectedItems property of the Combobox. Do not modify the Default property of the DataCard.

     

    LookUp(
     'Facility IDS',
     'Your Column From Facility IDS' = Parent.Default
    )

     

    Long answer:

     

    Typically, we create a Single Line Text Column in our data source, and then insert that Single Line Text Column into an EditForm control as a DataCard. We then remove the Text Input control inside the DataCard, and replace it with a different control (in your scenario, a Combobox control).

     

    We also set the Update property of the DataCard to point at the selected value from that Combobox. I assume you have done this.

     

    The ComboBox is expecting a Table. As a workaround, users typically force a display "Value" into the DefaultSelectedItems property using:

     

    {
     Value: Parent.Default
    }

     

    However, this approach does not work with Dataverse. As you have noticed, if you add a Label control and reference the ComboBox , even though a value is “displayed”, the Text will still return blank. This is will because we are supposed to pass a record into the control because that is what the ComboBox control expects.

     

    In many scenarios, this may not be an issue because we are confident that the correct value is being displayed. We know if the user selects a different value, the ComboBox will accept the selected item as a record and the selection will successfully save to our data source.

     

    However, if we are leveraging the existing selection currently displayed to do anything else, we run into trouble. For example, we may not be able use something like “!Parent.Valid” on the Visible property of a Star label. This is because the Valid property is looking for a record.

     

    To accommodate this, we can force the correct record into the ComboBox using Lookup.

  • carrie-anne27 Profile Picture
    260 on at

    Thank you @Amik 

    I have added that formula into the DefaultSelectedItems in my Combo Box.

     

    carrieanne27_0-1710815541364.png

     

    It is now passing this error "Incompatible types for comparison. These types can't be compared: Table, Text."

  • carrie-anne27 Profile Picture
    260 on at

    @Amik it is working now with formula: 

    LookUp('Facility IDS',Column1=Parent.Default)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 796 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard