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
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,843)