cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Gorilla_8
Impactful Individual
Impactful Individual

show a gallery item in a combobox

I want the user when selecting an item from the gallery to show the item in that combobox

 

My gallery and the properties on "OnSelect":

My code on "OnSelect":

Set(varMode;"Edit");;Set(varIDMCONS;ThisItem);;Navigate(Screen3....)

Gorilla_8_0-1639015539250.png

 

 

And the combobox I wanna to show the items:

 

My code on the combobox:

Items:

NameOfMyCollection.TheColumnName

 

DefaultSelectedItems:

If(varMode="Edit";LookUp(MySharePointList; CUSTOMER = COMBOBOX1.SELECTED.CUSTOMER);"")

 

The varMode is simple: If is  "Edit", he edit the item, if is "New" he create the item and if "View", he just view the item

 

Gorilla_8_1-1639015557357.png

 

1 ACCEPTED SOLUTION

Accepted Solutions
StalinPonnusamy
Super User
Super User

Hi @Gorilla_8 

 

DefaultSelectedItems based on the items property

 

Your Items property is

NameOfMyCollection.TheColumnName

 

Then DefaultSelectedItems property will be 

If(
    varMode = "Edit";
    LookUp(
        CollectionName;
        ColumnName = GaleriaMercadoConsumo.Selected.ClienteSemLookUp
    );
    Blank()
)

 

To illustrate, here is an example. I have a collection like

ClearCollect(ColCustomers, {Name: "Stalin", ID:10}, {Name: "Sam", ID:2})

 

Items property of Combo box is

ColCustomers.Name

 

DefaultSelectedItems is

LookUp(ColCustomers, Name="Sam")

 

StalinPonnusamy_0-1639057210329.png

I hope this helps you.


Thanks,
Stalin - Learn To Illuminate

 

View solution in original post

9 REPLIES 9
StalinPonnusamy
Super User
Super User

Hi @Gorilla_8 

 

I assume you are filtering based on the previous screen selection.

 

Set the DefaultSelectedItems property to

If(varMode="Edit";LookUp(MySharePointList; CUSTOMER = varIDMCONS.CUSTOMER);Blank())

 


Thanks,
Stalin - Learn To Illuminate

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

Thank you very much!

Now I got the data, but he doesn't show on my combobox, see:

The type is: text

My code:

If(
    varMode = "Edit";
    LookUp(
        T_mercado_consumo;
        ClienteSemLookUp = GaleriaMercadoConsumo.Selected.ClienteSemLookUp
    );
    Blank()
)

Gorilla_8_0-1639051373920.png

 

StalinPonnusamy
Super User
Super User

Hi @Gorilla_8 

 

DefaultSelectedItems based on the items property

 

Your Items property is

NameOfMyCollection.TheColumnName

 

Then DefaultSelectedItems property will be 

If(
    varMode = "Edit";
    LookUp(
        CollectionName;
        ColumnName = GaleriaMercadoConsumo.Selected.ClienteSemLookUp
    );
    Blank()
)

 

To illustrate, here is an example. I have a collection like

ClearCollect(ColCustomers, {Name: "Stalin", ID:10}, {Name: "Sam", ID:2})

 

Items property of Combo box is

ColCustomers.Name

 

DefaultSelectedItems is

LookUp(ColCustomers, Name="Sam")

 

StalinPonnusamy_0-1639057210329.png

I hope this helps you.


Thanks,
Stalin - Learn To Illuminate

 

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 


Thank you very much!

You saved my day!

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

One more quick question about this...


if my Items is 

Distinct(NameOfMyCollection;TheColumnName)


Or 


Choices (NameOfMyCollection;TheColumnName)

 

 

How I show the value on combobox?

Hi @Gorilla_8 

 

Sort(Distinct(NameOfMyCollection;TheColumnName);Result)

Or 

Choices (NameOfMyCollection.TheColumnName)

 

StalinPonnusamy_0-1639060501393.png

 

StalinPonnusamy_1-1639060524826.png

 


Thanks,
Stalin - Learn To Illuminate

Gorilla_8
Impactful Individual
Impactful Individual

Hi @StalinPonnusamy 

 

Didn't work here:

On my Items:

Gorilla_8_0-1639066162317.png

 

And on My DefaultSelectedItems:

Gorilla_8_1-1639066184042.png

 



Hi @Gorilla_8 

 

In Dataverse for Teams, by default, we will use fluent UI controls, the Combo box of which would act a bit differently. What you have discovered is that it does not support displaying "Results" from the Distinct function.

 

To solve this issue, we could use the classic Combo box by enabling classic controls in settings:

StalinPonnusamy_0-1639066497148.png

 

StalinPonnusamy_1-1639066497134.png

 


Thanks,
Stalin - Learn To Illuminate

Gorilla_8
Impactful Individual
Impactful Individual

@StalinPonnusamy 

 

There no other way to fix this?

I think this option doesn't exists on my side...

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,939)