cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JanikDriehaus
New Member

Retrieving Combo box DefaultSelectedItems from a SharePoint multiline text field

I have a SharePoint list named Projects, which in turn has a Listing (ID) and a Benefits column, the latter of which stores multiple lines of text. The DATA collection contains all data pertaining to the selected gallery item on a previous screen. In PowerApps itself, I have a label (lbl_Combo) and a Combo box (combo_Benefits). A button (btn_Save) stores the SelectedItems in the Benefits field:

 

 

 

Patch(
    Projects,
    First(
        Filter(
            Projects,
            Listing = DATA.Listing
        )
    ),
    {
        Benefits: Concat(combo_Benefits.SelectedItems, Value&Char(13))
    }
)

 

 

 

 

The Items that combo_Benefits has are:

 

 

 

[
    "A",
    "B",
    "C"
]

 

 

 

 

The SharePoint list stores the selected items just as I want it to. What's more, lbl_Display, whose Text field is set to

 

 

 

DATA.Benefits

 

 

 

also has no issues.

 

The issue arises when I want to retrieve the multiline text, split it back into separate entries, and connect those to DefaultSelectedItems. I attempted the following, to no avail:

 

 

 

Split(DATA.Benefits, Char(13))

 

 

 

Appending .Result to the above also provided no help.

 

How can I have the DefaultSelectedItems display the selected items I have stored in the Benefits column?

For example, Items "A" and "C" are selected and saved to SharePoint. Once combo_Benefits is Reset(), it should have "A" and "C" already selected.

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
v-xida-msft
Community Support
Community Support

Hi @JanikDriehaus ,

Could you please share a bit more about the DATA collection that you mentioned? Do you use it to store selected item from your Previous Gallery?

Further, do you want to display the saved options within combo_Benefits ComboBox?

 

Based on the formula that you mentioned, I think  there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the combo_Benefits ComboBox to following:

[
    "A",
    "B",
    "C"
]

Set the DefaultSelectedItems property of the combo_Benefits ComboBox to following:

ForAll(
       Split(DATA.Benefits, Char(13)),
       {
         Value: Result
       }
)

 

Please consider 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.

View solution in original post

2 REPLIES 2
PowerAddict
Super User
Super User

Here's an approach that works for me:

 

I would set the Items property of combo_Benefits (a combobox) to 

TableColl

TableColl is a collection that is defined as below: 

ClearCollect(TableColl, "A", "B", "C")

The text property of a label lbl_Display is set to:

Concat(combo_Benefits.SelectedItems,Value & Char(13))

I then have another combobox for which I am setting the DefaultSelectedItems as: 

Filter(TableColl, Text(Value) in Split(lbl_Display.Text, Char(13)))

And this works fine. 

The reason Split(DATA.Benefits, Char(13)) this doesn't work is because the last item in this table is a blank value AND the records in this table are not records of your original table (they have the same text but they are not the same records). 

 

Let me know if this works for you. 

 

---
If you like this reply, please give kudos. And if this solves your problem, please accept this reply as the solution.

Thanks!
Hardit Bhatia
https://thepoweraddict.com

 

 

v-xida-msft
Community Support
Community Support

Hi @JanikDriehaus ,

Could you please share a bit more about the DATA collection that you mentioned? Do you use it to store selected item from your Previous Gallery?

Further, do you want to display the saved options within combo_Benefits ComboBox?

 

Based on the formula that you mentioned, I think  there is something wrong with it. I have made a test on my side, please consider take a try with the following workaround:

Set the Items property of the combo_Benefits ComboBox to following:

[
    "A",
    "B",
    "C"
]

Set the DefaultSelectedItems property of the combo_Benefits ComboBox to following:

ForAll(
       Split(DATA.Benefits, Char(13)),
       {
         Value: Result
       }
)

 

Please consider 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.

View solution in original post

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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 (1,979)