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 / Creating survey app
Power Apps
Answered

Creating survey app

(0) ShareShare
ReportReport
Posted on by

I have 3 SharePoint lists.

  • List of Questions
  • List of Answers
  • Users List

 

I would like to create a survey app without creating several screens for each question. Also, the answers should be separated. I added a column (number data type) that will somehow connect the list of questions and answers to one another. There's a column in List of Answers where the information of user can be found (based on Users List). I'm thinking of using a gallery but how can I use the same gallery for add/edit/view of the data? Is this possible? Please help.

Categories:
  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Hi @biancadevera,

     

    You can use a gallery to view the data, and also edit the data if you use input controls like Text input.

     

    Adding new records in the gallery may be possible but another option would be to have a separate "form" (either as individual controls or the Edit form control). This could be placed alongside the gallery if you want to keep it in the same screen as the gallery.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • biancadevera Profile Picture
    on at

    Hi @KeithAtherton 

     

    Thanks! I'm considering the gallery but having issues on how I can use the same gallery to call two different sources (Questions and answers).

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Both SP lists could be combined into a single collection which can be used to populate the gallery.

     

    Then if you change Text input values in the gallery and click a "Save" button (or similar), the Patch function could be used to insert/update both SP lists separately.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • biancadevera Profile Picture
    on at

    @KeithAtherton 

     

    Thank you for this. Never thought it can be done. Can you show me a sample syntax on how I can combine SP lists into a single collection?

  • Verified answer
    KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Sure, here is an example of how that can be done, based on this post:

    // Create two collections: My version.
    ClearCollect(
     colQuestions,
     {
     QuestionID: 1,
     Question: "What is the capital of France?"
     },
     {
     QuestionID: 2,
     Question: "What colour is the sky?"
     }
    );
    ClearCollect(
     colAnswers,
     {
     QuestionID: 1,
     Answer: "Paris"
     },
     {
     QuestionID: 2,
     Answer: "Blue"
     }
    );
    // Add all columns from another table code.
    ClearCollect(
     colQuestionsAndAnswers,
     Ungroup(
     DropColumns(
     AddColumns(
     colAnswers,
     "groupColumn",
     Filter(
     colQuestions,
     QuestionID = colAnswers[@QuestionID]
     )
     ),
     "QuestionID"
     ),
     "groupColumn"
     )
    );

     

    Feel free to change the code to handle your SP lists.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • biancadevera Profile Picture
    on at

    Hi @KeithAtherton ,

     

     

    Collect(
     colQuestions,
     {
     PID: varSelected.P_UID, 
     Questions: lblQuestions.Text,
     Item_No: Value(lblItemNo.Text)
     }
    );
    
    Collect(
     colAnswers, 
     {
     Title: colQuestions.PID,
     Item_No: Value(lblItemNo.Text), //Identifier for Questions
     Answers: cmbYN.Selected,
     Comment: txtComment.Text
     }
    );

     

     

    This is my current code. However, I'm unable to combine the two collections. I tried to drill it down to the Filter part of the code you sent. That's where I'm having error right now: Incompatible Types for Comparison: Number, Table.

     

    Filter(
     colQuestions, 
     Item_No = colAnswers[@Item_No] //error here: Incompatible Types for Comparison: Number, Table
     )

     

    Appreciate your help

     

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    Try using the full block of code, similar to this:

    ClearCollect(
     colQuestionsAndAnswers,
     Ungroup(
     DropColumns(
     AddColumns(
     colAnswers,
     "groupColumn",
     Filter(
     colQuestions,
     Item_No = colAnswers[@Item_No]
     )
     ),
     "Item_No"
     ),
     "groupColumn"
     )
    );

    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

  • biancadevera Profile Picture
    on at

    @KeithAtherton 

     

    still having errors

     

    biancadevera_0-1671538486132.png

     

  • KeithAtherton Profile Picture
    3,709 Most Valuable Professional on at

    I'm not sure why that code is giving errors as it was copied-and-pasted from working code.

     

    I would suggest hovering over different parts of the code to see if more specific errors are displayed, then tackle them one by one.


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard