cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
rthompsoneu
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
Community Support
Community Support

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

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.
rthompsoneu
Frequent Visitor

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

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
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

Attending MBAS? Claim your badge

Attending MBAS? Claim your badge

Whether you’re streaming the digital event live, or watching on-demand, claim your attendee badge to sport on your profile.

‘Better Together’ T-Shirt Contest – Winner Announced!

‘Better Together’ T-Shirt Contest – Winner Announced!

And the winner is...

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Apps Community!

Power Platform 2020 release wave 1 plan

Power Platform 2020 release wave 1 plan

Features releasing from April 2020 through September 2020

‘Better Together’ Integration Forum Launch

‘Better Together’ Integration Forum Launch

We're launching a how-to forum where you can learn about how Power BI integrates with other Power Platform products.

Emergency Response & Monitoring Solution

Emergency Response & Monitoring Solution

Microsoft has created a regional government emergency response and monitoring solution that is built on Power Apps and Power BI.

Top Solution Authors
Top Kudoed Authors
Users online (5,474)