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 / Create Collection from...
Power Apps
Unanswered

Create Collection from Dataverse Lookup Columns

(0) ShareShare
ReportReport
Posted on by 53

I have a Dataverse table, with two Lookup Columns, with One-To-Many relationships with one other table. When a collection is created, the two fields created a Type Table in the collection creating a patch error.

 

How can I create a collection text date for the two lookup columns…Thanks

 

Collect(

    colContact,

    {

        name: ThisItem._ContactID,

        firstname:inpFirstNameEG.Text,

        lastname: inpLastNameEG.Text,

        email: inpEmailEG.Text,

        ItemStatusLU: cbxItemStatusEG.Selected,

        CompanyLU: cbxCompany.Selected

    }

   

)

 

Syvenn_0-1674279357539.png

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    Hi @Syvenn ,

    Probably like this

    Collect(
     colContact,
     {
     name: ThisItem._ContactID,
     firstname:inpFirstNameEG.Text,
     lastname: inpLastNameEG.Text,
     email: inpEmailEG.Text,
     ItemStatusLU: cbxItemStatusEG.Selected.Value,
     CompanyLU: cbxCompany.Selected.Value
     }
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • VJ-22072138-0 Profile Picture
    53 on at

    Thanks for the reply! Collection will not accept .Value

  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    @Syvenn ,

    What type of column is ItemStatus and what are the Items of cbxItemStatusEG ?

  • VJ-22072138-0 Profile Picture
    53 on at

    The ItemStatus is a Lookup column, The parent table [ContactSy] has a One-To-Many relationship with the [lookupinfo] table. It is a text field. 

  • VJ-22072138-0 Profile Picture
    53 on at

    Sorry it's a Many-To-One relationship:

    Syvenn_0-1674288651210.png

     

  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    @Syvenn ,

    Yes, but what is the Items of cbxItemStatusEG and if you type in

    cbxItemStatusEG.Selected.

    what comes up underneath ?

  • VJ-22072138-0 Profile Picture
    53 on at

    Hello, thanks for the reply!

    The Items statement: Filter(Choices([@ContactSy].ItemStatusLU),EntCode = "PRO1" && Module="Contact" && Prompt="Status"), which provides two items in the cr965_itemvalue combobox: Active & Non Active

     

    If I type in: cbxItemStatusEG.Selected i get:

    Syvenn_0-1674329473789.png

    If I build the collection with this code (Cannot use Selected must use SelectedItems:

    Collect(
    colContact,
    {
    cr965_contactid:ThisItem.Contact,
    cr965_firstname:inpFirstNameEG.Text,
    cr965_lastname:inpLastNameEG.Text,
    cr965_email:inpEmailEG.Text,
    cr965_CompanyLU:cbxCompany.SelectedItems.CompanyName,
    cr965_ItemStatusLU:cbxItemStatusEG.SelectedItems.ItemValue,
    cr965_name:inpID.Text
    }
    );

    I get:

    Syvenn_1-1674329816151.png

    Which indicate the data type is unsupported for the 2 combo boxes.

    If I patch directly with this code:

    Patch(ContactSy, ThisItem, {FirstName:inpFirstNameEG.Text,LastName:inpLastNameEG.Text,email:inpEmailEG.Text, ItemStatusLU:cbxItemStatusEG.Selected, CompanyLU: cbxCompany.Selected});

     

    It works fine. Not that if I patch directly, I must use Selected w/out the column name. SelectedItems generates an error.

     

    Thanks for you time on this issue. 

     

     

  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    @Syvenn ,

    What I am after (note extra dot after Selected) is what comes up when you type in

    cbxItemStatusEG.Selected.

    essentially the output of the combo box. Another question here - is this a single or multi-select control ?

  • VJ-22072138-0 Profile Picture
    53 on at

    It is a single control.

    Requested Output:

    Syvenn_0-1674340045451.png

     

  • WarrenBelz Profile Picture
    153,717 Most Valuable Professional on at

    @Syvenn ,

    You should need whichever one of those produces the Text result you want. Try putting the values on a Label after you have selected something in the drop-down.

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…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 445

#2
WarrenBelz Profile Picture

WarrenBelz 386 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 321 Super User 2025 Season 2

Last 30 days Overall leaderboard