cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MartinHagara Helper II
Helper II

combobox default value

Hi,

for combobox I need to set the default value stored in the collection but it expects the record value. How would you solve it?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support
Community Support

Re: combobox default value

Hi @MartinHagara ,

 

Is your data source a SharePoint list? And is Lokalita a multiple value enabled choice column?

 

If so, first you need to make sure that this value from colVzorListLocal exists in Lokalita column. Then set below formula in the Default property of this data card:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:"xxx"}

Remember to replace "xxx" with the value you  want to use.

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

9 REPLIES 9
Super User
Super User

Re: combobox default value

@MartinHagara 

Assuming you want to set the Default to the value of the current item within the collection you should use this code.

 

ThisItem.Lokalita

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If your thought this post was helpful consider giving it a "Thumbs Up."

MartinHagara Helper II
Helper II

Re: combobox default value

No, I am loading a value from "colLokality" for selection, but I want to set dafault from "colVzorListLocal" where I have the "Lokalita" column

Super User
Super User

Re: combobox default value

@MartinHagara 

What value from colVzorListLocal do you want to set as the Default?  How is this determined?

MartinHagara Helper II
Helper II

Re: combobox default value

I want to set one specific value as the default value that I saved in the collection "colVzorZaznamuLocal" - is there such an option?

Super User
Super User

Re: combobox default value

@MartinHagara 

Assuming your collection colVzorZaznamuLocal looks like this

 

ClearCollect(colVzorZaznamuLocal,{value:"OptionA"},{value:"OptionB"},{value:"OptionC"});

 

You can use the following code in the DefaultSelectedItems property of your ComboBox

 

Filter(colVzorZaznamuLocal,value="OptionA")

 

Let me know if my proposed solution works.

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

MartinHagara Helper II
Helper II

Re: combobox default value

Unfortunately, it doesn't work for me, I guess I'm doing something wrong.

This is how I create a collection: ClearCollect(colVzorZaznamuLocal; { id: Max(colVzorZaznamuLocal ; id) + 1; VedeckeMeno: ComboBox3_8.Selected.ID; Pocet: Počet_DataCard3_2.Update; Kategoria: ComboBox3_9.Selected.ID; Lokalita: ComboBox3_10.Selected.ID; Vek: ComboBox3_11.Selected.ID; Pohlavie: ComboBox3_12.Selected.ID; Pozorovatel1: ComboBox3_13.Selected.ID; Pozorovatel2: ComboBox3_14.Selected.ID; Projekt: ComboBox3_15.Selected.ID; Poznamka: TextInput3_2.Text });; SaveData(colVzorZaznamuLocal;"colVzorZaznamuLocal");;
The result is in the picture.

 

Super User
Super User

Re: combobox default value

@MartinHagara 

Does your collection have only 1 record at all times?  If the answer is "Yes" just do this.

 

First(colVzorZaznamuLoca)

 

If the answer is no, try to build my previous post as a mini-tutorial.  It must translate this example to your own siutation: it cannot be used as-is.  The general technique I am trying to teach is you must FILTER on colVzorZaznamuLocal using some criteria.

 

In my example I have used value="OptionA".  In your case you must choose some unique column and decide how to FILTER colVzorZaznamuLocal.  For example, try something like this... (assuming your collection is exactly the same as the screenshot).

 

Filter(colVzorZaznamuLocal,ID=3)
Filter(colVzorZaznamuLocal,ID=Value(DataCardValue_ID.Text))
Community Support
Community Support

Re: combobox default value

Hi @MartinHagara ,

 

Is your data source a SharePoint list? And is Lokalita a multiple value enabled choice column?

 

If so, first you need to make sure that this value from colVzorListLocal exists in Lokalita column. Then set below formula in the Default property of this data card:

 

{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Value:"xxx"}

Remember to replace "xxx" with the value you  want to use.

 

Regards,

Mona

 

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

MartinHagara Helper II
Helper II

Re: combobox default value

Thank you, it doesn't work yet, I'll try again.

But I have a kind of question: I have created a SharePoint list and I need to display two columns in the form in the combobox, the other column from another SharePoint list. Is there any way to do this?

Helpful resources

Announcements
MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

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!

Top Solution Authors
Top Kudoed Authors
Users online (6,251)