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 / Disable button based o...
Power Apps
Unanswered

Disable button based on yes/no. Conditional display on the yes/no cards causing problems

(0) ShareShare
ReportReport
Posted on by 2

Hello All,

 

We created a survey using power apps.  The survey contains about 100 fields from a sharepoint list (45 Questions and 45 comments for each question).

Since the list was very long, we divided the questions into each screen and displayed only those questions based on a conditional logic.  A user selects checkoxes of which sections he would like to answer and the navigation has been set that way.

I am not using Edit form but created scrollable screens.

 

This worked fine.

 

The issue is displaying the details of the survey a user submitted. I am using a browse gallery and a details form to display the questions and comments.

The problem is if I am trying to put all the 100 fields in the details form, it won't work obviously or it would take along time to retrieve the records.

How can I display only those questions which have been answered by the user? Is there any better way to handle thi s situation without crashing the app. Is there a better way of filtering the records?

I am not sure if Visible property would help since I have to keep all the fields on the details form anyway.

 

Please let me know if you need any additional details from my end. 

Categories:
I have the same question (0)
  • tly Profile Picture
    400 on at

    If you have SharePoint, there is a native survey app that can do all of this for you:

    image.png

     

    If there is a specific reason why you created a list and want to then put it in an app to enhance the user experience, then I can think of at least 2 ways to do this (and I'm sure others can think of more):

     

    Use PowerApps Forms

    1. Create one or a combination of columns as a hash (e.g. a column for User and a column for SubmissionTime)
    2. On screen1's OnVisible or OnStart event, create these values in advance:
      1. Set(varCurrentUser, User().FullName);
      2. Set(varSubmissionTime, Now())
    3. On screen1, create a form
      1. Set the form's DefaultMode to 'New'
      2. Select the appropriate questions per survey logic
      3. Include the User and SubmissionTime column/datacards
      4. Set the User datacard's Update field to local variable varCurrentUser
      5. Set the Submission datacard's Update field to local variable varSubmissionTime
      6. Set User and SubmissionTime datacard visibility false so that the user cannot see them
    4. Have a button or object to submit the form (to the user, this might intuitively be a "Next" button). To submit, use the syntax Submitform(myForm)
    5. On the form's OnSuccess event (on a successful submission), have it navigate to the next screen per survey logic.
    6. On the following screens, similarly create a form:
      1. Set its defaultmode to Edit
      2. Set Item property to Filter(mySurveyList, User=varCurrentUser, SubmissionTime=varSubmissionTime)
        1. This will ensure that you will be editing the same record
      3. Select the appropriate survey questions per survey logic
    7. Repeat step 6 for all subsequent question sets (per survey logic)

     

    I didn't get into the nitty-gritty, but I hope that gives you a direction.

     

  • v-xida-msft Profile Picture
    on at

    Hi @chsandeep,

    Do you add a column within your SP list to store the user who submitted the survey?

    Which data type is the Questions column in your SP list?

    Further, do you want to display only those questions which have been answered by the user within the Detail form?

     

    I agree with your thought almost, I think the Visible property of the Data card control within the Detail form could achieve your needs.

    I assume that you add a column in your SP list to store the user (e.g. FullName, email, DisplayName, etc.) who submitted the survey, you could look up your SP list data source based on the current user, check if the corresponding question has been answered, if yes, make the corresponding Data card visible, if not, make the corresponding Data card invisible.

    I have made a test on my side, please take a try with the following workaround:
    Set the Visible property of the Question1 Data card within the Detail form to following:

    If(
    !IsBlank(
    LookUp('YourSPList',UserName=User().Mail,Question1)
    ),
    true,
    false
    )

    Note: The UserName represents the column which is used to store the who submitted the survey within your SP list. The Question1 represents the first question field in your SP list.

    Set the Visible property of the Question2 Data card within the Detail form to following:

    If(
     !IsBlank(
     LookUp('YourSPList',UserName=User().Mail,Question2)
     ),
     true,
     false
    )

    Set the Visible property of the Question3 Data card within the Detail form to following:

    If(
     !IsBlank(
     LookUp('YourSPList',UserName=User().Mail,Question3)
     ),
     true,
     false
    )

    ...

    Set the Visible property of the Question45 Data card within the Detail form to following:

    If(
     !IsBlank(
     LookUp('YourSPList',UserName=User().Mail,Question45)
     ),
     true,
     false
    )

    More details about the LookUp function in PowerApps, please check the following article:

    LookUp function

     

    Best regards,

    Kris

  • chsandeep Profile Picture
    2 on at

    Thank you all for the suggestion. The reason for building a survey app was to enable the users to submit the answers online.

    I was having an issue in the detail form to only display the questions that the users chose to answer.

     

    I have achieved the solution by using the Visible property and diplaying only those fields which the user answered.

    I have the details of the user name and email address.

     

    For this, sine the dataset was large, I am using a collection to first collect the data from the SharePoint and then using the fields off of the collection. This way, I am not having an issue with the form being displayed without any lag or performance errors.

     

     

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard