cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Combo Box - How to update the DefaultSelectedItems getting the existing data from a different data source

Hi

 

I am trying to update the DefaultSelectedItems loading the existing records from a different data source.

 

For example the existing data exist in a table called "Sample Group Detail", but the combo box has a different data source table called "Sample".

 

I need to get the existing records from "Sample Group Detail" and add the records to "Sample" combo box to show the existing records that have already been selected.

 

The "Sample Group Detail" table contains a Lookup field called "new_sampleid".    The "Sample" table primary key is "new_sampleid".

 

I am trying to use the below formula, but this does not work.

 

ShowColumns(Filter('Sample Group Details',GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),"new_sampleid","new_name")

2 REPLIES 2
Highlighted
Community Support
Community Support

Hi @rthompsoneu ,

Could you please share a bit more about the daya source used in your app? Are they both CDS Entities?

Do you want to display the "new_name" column value from your "Sample Group Detail" data source within the Sample ComboBox as default selected value?

Could you please share more details about the formula you typed within the Items property of the Sample ComboBox?

 

Based on the issue that you mentioned, I think there is something wrong with your formula. Please consider modify your formula within the DefaultSelectedItems property of the Sample ComboBox:

ForAll(
            ShowColumns(Filter('Sample Group Details', GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),"new_sampleid","new_name"),
            {
                 Value: new_name
            }
)

If the SampleComboBox use ColumnA from your Sample data source as the display value, please modify above formula as below:

ForAll(
            ShowColumns(Filter('Sample Group Details', GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),"new_sampleid","new_name"),
            {
                 ColumnA: new_name
            }
)

Please take a try with above solution, then check if the issue is solved.

 

Best regards,

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.
Highlighted

Hi  

 

 

 

 

 

 

ForAll(
            ShowColumns(Filter('Sample Group Details', GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),"new_sampleid","new_name"),
            {
                 Value: new_name
            }
)

I did try changing the code to do something like this:

I am not sure what format the data should be on the Dataselecteditems

 

ForAll(
            ShowColumns(Filter('Sample Group Details', GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),"new_sampleid","new_name"),
            {
                 DisplayField: new_name,
                 ID: new_sampleid
            }
)

I also tried using the below formula without the Showcolumns

ForAll(
            Filter('Sample Group Details', GUID('Sample Group'.'Sample Group') = GUID(txt_SearchOption.Text)),
            {
                 ID: new_sampleid,
                 DisplayField: new_name
            }
)

Please see the attachment

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (8,669)