cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Paul13
Level: Powered On

Export radio control results to excel table

Hi,

I currently have a 5 question quiz that I am using a radio control to allow the user to select a answer. I have then added the below code to give a different score depending on the answer selected.

First question is below:

Switch( Radio3.Selected.Value, "Terrible", Set(Score, 1),
"Bad", Set(Score, 2),
"OK", Set(Score, 3),
"Good", Set(Score, 4),
"Great!", Set(Score, 5) );

 

Then the other questions add to that:

Switch( Radio3_1.Selected.Value, "Exhaused", Set(Score, Score + 1),
"Tired", Set(Score, Score + 2),
"OK", Set(Score, Score + 3),
"Good", Set(Score, Score + 4),
"Strong!", Set(Score, Score + 5) )

 

I would like to export the answer given on each individual question to an excel spreadsheet. 

I have a table in excel with 5 columns, one for each answer, so I would like to add the score from question 1 to column 1, then the score for question 2 to column 2, and so on. Then add the overall score for all 5 questions combined to the final 'total' column. 

 

Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Export radio control results to excel table

Hi @Paul13 ,

Do you want to save the 5 question answers into your Excel table (Column1~Column5)?

Do you also want to save overall score for all 5 questions into the "Total" column in your Excel table?

 

I assume that the data structure of your Excel table looks like below:2.JPG

Based on the needs that you mentioned, I think the Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Within the last question screen of your app, add a "Submit" button, set the OnSelect property to following:

Patch(
          'YourExcelTable',
           Defaults('YourExcelTable'),
           {
             Column1: Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Column2: Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column3: Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column4: Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column5: Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Total: Score /* <-- Score represents the global variable you set up in your app */ } )

 

In addition, if you also want to modify previous question answer, I afraid that the global variable Score could not represent the total score you get. Please modify above formula as below:

Patch(
          'YourExcelTable',
           Defaults('YourExcelTable'),
           {
             Column1: Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Column2: Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column3: Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column4: Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column5: Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Total: Sum(
Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),

Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5)
)
} )

Please take a try with above solution, then check if the issue is solved.

 

More details about the Patch function, please check the following article;

Patch function

 

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
Community Support Team
Community Support Team

Re: Export radio control results to excel table

Hi @Paul13 ,

Do you want to save the 5 question answers into your Excel table (Column1~Column5)?

Do you also want to save overall score for all 5 questions into the "Total" column in your Excel table?

 

I assume that the data structure of your Excel table looks like below:2.JPG

Based on the needs that you mentioned, I think the Patch function could achieve your needs. I have made a test on my side, please take a try with the following workaround:

Within the last question screen of your app, add a "Submit" button, set the OnSelect property to following:

Patch(
          'YourExcelTable',
           Defaults('YourExcelTable'),
           {
             Column1: Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Column2: Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column3: Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column4: Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column5: Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Total: Score /* <-- Score represents the global variable you set up in your app */ } )

 

In addition, if you also want to modify previous question answer, I afraid that the global variable Score could not represent the total score you get. Please modify above formula as below:

Patch(
          'YourExcelTable',
           Defaults('YourExcelTable'),
           {
             Column1: Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Column2: Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column3: Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column4: Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Column5: Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Total: Sum(
Switch(Radio3.Selected.Value, "Terrible", 1, "Bad", 2, "OK", 3, "Good", 4, "Great!", 5),
Switch(Radio3_1.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Switch(Radio3_2.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),

Switch(Radio3_3.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5),
Switch(Radio3_4.Selected.Value, "Exhaused", 1, "Tired", 2, "OK", 3, "Good", 4, "Strong!", 5)
)
} )

Please take a try with above solution, then check if the issue is solved.

 

More details about the Patch function, please check the following article;

Patch function

 

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

Paul13
Level: Powered On

Re: Export radio control results to excel table

Thanks @v-xida-msft! That worked perfectly!

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Demo Extravaganza Championship Voting Open

Voting Ends: October 30, 2019!

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 186 members 4,469 guests
Recent signins:
Please welcome our newest community members: