cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
eber_saj
Helper I
Helper I

Using a Gallery as a Formulary

Hello everyone!

 

I wanted to have a little more customization power than EditForm offers, so I decided to build a form using Gallery, as suggested in this topic. However, I'm not sure how to deal with the Submit button now.

 

Basically what I want to happen is: when the Submit button is pressed, each answer must be saved as a new line in the ANSWERS table (shown below), storing the number of the question answered in the column QuestionID and the actual answer (selected with a Drop Down) in the column AnswerText.

 

Does anybody know a way to do this?

 

I'm new to PowerApps and am not sure which functions I could use to deal with creating a new entry in the database, so if anybody could point me out to some, I will be very grateful.

 

ANSWERS

AnswerID  QuestionID  AnswerText
196       1	      "Answer to Question 1"
197       2           "Answer to Question 2"
198       3           "Answer to Question 3"
...

 

eber_saj_0-1650476253503.png

 

Thanks in advance,

Éber

1 ACCEPTED SOLUTION

Accepted Solutions
FMontesRNX1
Resolver II
Resolver II

The response of @Verweij is correct, but considering you're using only 1 button to submit all the responses, you'll need also ForAll.
Something like:

ForAll(Gallery1.AllItems,
 Patch(Source,Defaults(Source),{QuestionID: Referencetoquestion, AnswerText: Dropdown1.Selected.Value))

 

This assuming you're using the same Dropdown for each Gallery Item.

 

View solution in original post

2 REPLIES 2
Verweij
Super User
Super User

I am not sure why you would want to save the answers as separate entries to your data source, but patch is the function you are looking for. If you think of collecting it into one record, one patch will do. If you want to have is as separate entries, you will need some if/switch statements.

FMontesRNX1
Resolver II
Resolver II

The response of @Verweij is correct, but considering you're using only 1 button to submit all the responses, you'll need also ForAll.
Something like:

ForAll(Gallery1.AllItems,
 Patch(Source,Defaults(Source),{QuestionID: Referencetoquestion, AnswerText: Dropdown1.Selected.Value))

 

This assuming you're using the same Dropdown for each Gallery Item.

 

Helpful resources

Announcements
Ignite 2022

WHAT’S NEXT AT MICROSOFT IGNITE 2022

Explore the latest innovations, learn from product experts and partners, level up your skillset, and create connections from around the world.

Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Users online (1,682)