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

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
mdevaney
Super User III
Super User III

@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."

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

@MartinHagara 

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

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

@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."

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.

 

@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))

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

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
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

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