web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Saving listbox to shar...
Power Apps
Unanswered

Saving listbox to sharepoint in seperate columns

(0) ShareShare
ReportReport
Posted on by 210

I have a listbox that a user can select mutiple values. I need to be able to save those values separately in my sharepoint list. I have about 10 different items in the listbox and want to save each item into a different field/column. This basically will allow me to see how many people pick each certain item when analying the data.

Categories:
I have the same question (0)
  • Verified answer
    v-siky-msft Profile Picture
    on at

    Hi @alex5p ,

     

    What is the type of  columns that save each items? What is the items property of listbox?

    The final formulas is up to the column type of SP list. However i have made a test, you can refer to my example(just 4 items).

    1. create 4 single-text columns for SP list, named T1, T2, T3, T4.

    2. set the items property of list box as below, the 4 list items are "A","B","C","D", and append to ID for each items for convenience of lookup.

    Table({Value:"A",ID:1},{Value:"B",ID:2},{Value:"C",ID:3},{Value:"D",ID:4})

    3. set the following formula to button OnSelect, each column corresponds to each item. e.g. T1 column corresponds to the value that ID=1.

    ClearCollect(col,ListBox1.SelectedItems);Patch('SP list',Defaults('SP list'),{Title:"Test-1",T1:LookUp(col,ID=1,Value),T2:LookUp(col,ID=2,Value),T3:LookUp(col,ID=3,Value),T4:LookUp(col,ID=4,Value)})

     

    Annotation 2019-10-25 141343.png

    Annotation 2019-10-25 141041.pngHope this can help.

    Best regards,

    Sik

    If this post helps, then please click on “Accept as Solution” to help the other members find it more quickly.

     

  • alex5p Profile Picture
    210 on at

    @v-siky-msft This works perfect thank you! I just thought of this. I have a edit screen built into my  app and i want to allow the user to make an edit to the column. For instance I have 1 column named Newspaper. I changed the code a little bit from what you have and have a yes import into the column instead of grabbing the value. So when someone picks Newspaper it's column should say yes. I wanted to make the column as a choice column so when the user goes back to edit they only have an option to either select yes or no. I get an error saying expected record and found type text which is expected.

     

    I know I can get this to work with just using dropdowns but I would have like 10 dropdowns which would be too overwhelming/ugly so that kinda why I am trying to go the route of using a listbox.

  • v-siky-msft Profile Picture
    on at

    Hi @alex5p ,

     

    Do you mean that you hardcode the "Yes" in you patch formula, and when users select the newspaper in the list box, then patch yes to column, right?

    If my understanding is right, I have modify my formulas to fit your requirment, please take for reference:

    I modify one of items to "NewsPaper", when it is selected, the "YesOrNo" Column(Choices type) will be filled with Yes. If you want to patch a choices to column, you have to patch a record, so use LookUp function to match the record of chocies.

    The items property of ListBox: 

    Table({Value:"A",ID:1},{Value:"Newspaper",ID:2},{Value:"C",ID:3},{Value:"D",ID:4})

    The OnSelect of Button:

    ClearCollect(col,ListBox1.SelectedItems);
    Patch(Approvals,Defaults(Approvals),{Title:"Test-1",T1:LookUp(col,ID=1,Value),YesOrNo:If(2 in col.ID,LookUp(Choices(Approvals.YesOrNo),Value="Yes")),T3:LookUp(col,ID=3,Value),T4:LookUp(col,ID=4,Value)})

    Annotation 2019-10-28 100419.pngAnnotation 2019-10-28 100510.png

    Hope this can help.

    Best regards,

    Sik

  • alex5p Profile Picture
    210 on at

    @v-siky-msft 

    Hi sik thanks for responding. I actually ended up  making a dropdown menu with yes/no that is invisible on the screen. The default dropdown choice was set to yes to be able to pull that yes into my choice column for my sharepoint list and then I did this code.

    Newspaper:LookUp(col,ID=2,forPromoMenu.SelectedText),

    This allowed me to have a dropdown menu if a user ever has to change their choice within a form. Thanks again for you help! I have been struggling with this and you definitely helped me out!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard