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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Retrieve data from a S...
Power Apps
Unanswered

Retrieve data from a SharePoint list into a canvas app

(0) ShareShare
ReportReport
Posted on by 11

Hello everyone!

I have created a canvas PowerApp which behaves like a little game. In short, there are a number of questions an user needs to answer. Each time they answer a question, they get a point (and if it's wrong, they get nothing). After they have answered some of the questions and for example, they want to exit the app, they have the option to submit the questions so that they are saved into a SharePoint list. The SharePoint list shows the initials of the user that was answering the questions and every question they have answered at the time they submitted the questions. 

My problem is that I have been currently struggling to retrieve the data back into the app. What I want to do is that for everytime an user re-enters the app, they should be able to see which questions they have already answered and which not (I did not mention, but all of the questions are shown into a screen with some icons that changes color if the user answered right or wrong). I hope that maybe there is someone who encountered this before and has some input I could try! 

Categories:
I have the same question (0)
  • SpongYe Profile Picture
    5,832 Super User 2026 Season 1 on at

    Hin @biancapavel16 

     

    Use a collection to store the user’s answers and then save and load the collection to and from the SharePoint list. A collection is a group of items that you can use in your app, such as the questions and the user’s choices. You can create a collection using the Collect function, and then use the Patch function to update the SharePoint list with the collection data. You can also use the ClearCollect function to load the collection data from the SharePoint list when the user re-enters the app.

     

    If you have any questions or feedback, please let me know. Have a great day! 😊

    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

  • raks Profile Picture
    on at

    Why do you let the choice to the user to save his answers to the SP list or not?

    Where do you save if the user exit without saving?

  • biancapavel16 Profile Picture
    11 on at

    It was in the requirements of the app. There is a possibility they might not know all the answers to the questions, therefore they will need to get back to them to respond again. If the user is not saving the questions, they will not be stored anywhere. 

  • biancapavel16 Profile Picture
    11 on at

    Hi! Thanks for the solution. I have tried to create a collection, but maybe I did not make it right, as it was not loading at all into the app. Do you have maybe an example of how you would do it or just reference me an article so I can study it more?

  • SpongYe Profile Picture
    5,832 Super User 2026 Season 1 on at

    You need to decide when and how you want to create the collection. You can use the Collect function to add records to a collection on demand, such as when a button is selected. Or, you can use the ClearCollect function to create a collection when the app starts, such as in the OnStart property of the app.

    You need to specify a name for your collection and the records that you want to add.

    ClearCollect(colQuestions, SharePointlistQuestions);

    This will create a collection named colQuestions with the records of the SharePointlistQuestions.

    The collection colQuestions again can be used within the app as a datasource.

    https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/create-update-collection

    https://www.spguides.com/powerapps-collection/

     

    If you have any questions or feedback, please let me know. Have a great day! 😊


    -----------------------
    PowerYsa Power Platform Enthusiast [LinkedIn] | [Youtube]

    I love to share my knowledge and learn from others. If you find my posts helpful, please give them a thumbs up 👍 or mark them as a solution ✔️. You can also check out my [@PowerYSA] for some cool solutions and insights. Feel free to connect with me on any of the platforms above. Cheers! 🍻

     

  • timl Profile Picture
    37,192 Super User 2026 Season 1 on at

    @biancapavel16 

    How are you currently storing the answers in-app prior to you submitting them to SharePoint with the user initial?

    If you can tell us how you do this, we may be able to suggest formula that you add to the OnStart property of your app that restores the state of the app to what it was prior to the user exiting it.

  • biancapavel16 Profile Picture
    11 on at

    Hi! For the moment they are stored in some global variables I’ve created, such as UserInitials, Score1…Score15 (which records the value 1 or 0 depending on the answer sleected in the question). Then they click “submit” and I have used the Patch function to save whatever was filled out. 

  • timl Profile Picture
    37,192 Super User 2026 Season 1 on at

    @biancapavel16 

    Can you post how these global variables look like? For example, do you have one variable per question?

    Ultimately, the potential solution to this is to recreate the variable(s) in the OnStart of your app.

  • biancapavel16 Profile Picture
    11 on at

    Yes, so the UserInitials is collected on the OnStart property of the app: 

     

    Set(
     UserEmail,
     User().Email
    );
    Set(
     UserInitials,
     Office365Users.UserProfileV2(UserEmail).displayName
    );

    They are retrieved from each user's email address, since we all have unique initials. I did this so that they don't have to login or do anything when they enter the app. 

     

    And for each of the questions, the following code is applied: 

    If(Radio1.Selected.Value = "CorrectAnswer",Set(Score1,1), Set(Score1,0));

    This example is for Question 1 and it is on the OnSelect property of a button. Every question is a multiple chioce type, that's why I have used the Radio input.  I have around 15 questions that all have the same button, but of course, with a different global variable for each (that's why I mentioned Score1... Score 15). 

  • timl Profile Picture
    37,192 Super User 2026 Season 1 on at

    @biancapavel16 

    I'm not sure how you've setup your SharePoint list, but the formaula to recreate the answer variables would look something along the lines of this.

     

    Set(
     Score1,
     LookUp(SharePointAnswerList,
     QuestionNumColumn=1 && UserIntialColumn = UserInitials
     ).ScoreColumn
    );
    Set(
     Score2,
     LookUp(SharePointAnswerList,
     QuestionNumColumn=2 && UserIntialColumn = UserInitials
     ).ScoreColumn
    );
    Set(
     Score3,
     LookUp(SharePointAnswerList,
     QuestionNumColumn=3 && UserIntialColumn = UserInitials
     ).ScoreColumn
    );

     

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

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 432

#2
Valantis Profile Picture

Valantis 362

#3
timl Profile Picture

timl 337 Super User 2026 Season 1

Last 30 days Overall leaderboard