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

Submit from Multiple Galleries into a SharePoint List

Hi All,
Having difficulty thinking through. I am working on visitors form containing few questions. 
I have 2 Share point lists with Data related to questions in it; which I am using to pull the data from into two different Galleries into a screen.

I have added few custom Text Fields in 1 Gallery to allow user input and in second Gallery I have added a radio button to choose answer from. 
I am having hard time patching the data from Gallery 1 (visitor detail) and Gallery 2(questions) into a shar epoint list. 
Question is How can I map the source column with Gallery Items, i.e. Gallery Item 1 needs to patch in a certain column in my share point list and same for remaining answers.

 

I tried to patch but how would I get the to map the gallery options to a column. ThisItem. is not working, I do not want to add everything first in a collection then patch it... so thinking if I can patch it directly into the list.

Picture attached for understanding. Thank you in advance

 

Regards 

 

Capture.PNG

 

9 REPLIES 9
Super User III
Super User III

Hi @u4jaanus ,

Are you trying to pull the answers from the second gallery item choices in fields in the list belonging to the first gallery selected item?

Running with that assumption - you might approach it as below. So using the 5 questions - on the OnChange of each in Gallery2.

UpdateIf(
   YourSPList1Name,
   ID=Gallery1Name.Selected.ID,
   {AnswerField1Name:Gallery2Control1Name.Value}
)

and so on the the other four questions.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren, thank you looking into this.

My structure is list this.

Have 3 SP lists.
1. Visitor (Only contain label data)
2. Questions (Only contain label data)

3. Visitor Log (List to store result with visitor info along with questions and their answers)

 

I created two galleries visitorgallery and questions gallery in App which is pulling data from SP list 1 & 2. Added Text input field in Visitor Gallery & added Radio button in Question gallery. 
This completes my layout.

Now once a user fills in the details I am trying to submit Input TextFields and Radio buttons value to a SP list 3.

 

All values of radio btn needs to go in a different column. Here is a image of the sharepoint list you will understand.

If I use ForAll I can iterate through fine but to map each column I am getting hard time. See below the result of forall patch. What you replied in your message does make sense that it should be some mapping mechanism i should use to map each result to each column 

 

Thanks @u4jaanus ,

This is probably a bit easier. You want to create a new record in 'Visitor Log' containing the details from all of the inputs?

Patch(
   'Visitor Log',
   Defaults('Visitor Log'),
   {
      YourNameField:YourNameControl.Text,
      YourCompanyField:YourCompanyControl.Text,
      YourMobileField:YourMobileControl.Text,
      YourAnswer1Field:YourToggle1.Selected.Value,
      YourAnswer2Field:YourToggle2.Selected.Value,
      YourAnswer3Field:YourToggle3.Selected.Value,
      YourAnswer4Field:YourToggle4.Selected.Value
   }
)

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi @u4jaanus ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren,

Sorry for late reply. 

No this is not what I needed. 
This approach is Good if we have individual Radio Buttons. Radio Buttons are part of the list means I can not use Selected option as it will only choose 1st value of the Gallery List. To iterate through the Gallery we have to use ForAll but then this means it will submit repeated values into SharePoint list mean not the right approach.

I wanted to avoid use of collections but I had to use collection to get it done due to time constraint.

However I am still interested in know the right solution as it will be good from performance perspective.

 

Thank you

Hi @u4jaanus ,

Yes - I have now noticed you have said that the bottom panel is a gallery - it was not obvious to me as it is a very unusual way to design this type of structure. Looping through a gallery and trying to put the same control value in different fields is problematic at best. If possible at all, you would need a counter of some description and loop inside the Patch, which is in itself a problem.

Can you please consider designing your data structure to your needs and simply making these free-form controls - it will all work perfectly with the code I gave. Is there any reason it needs to be a gallery?

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Hi Warren,

 

Thanks for your reply. This form is a part of an app which have dynamic data in it. Purpose of getting this done via Gallery was less work to set up Nice UI and Dynamic Data. if I need to add/remove anything from these options I can simply do this at Gallery Source else in Form I will have to play around with Datacards everytime I want to add new questions in it. hence decided to use Gallery.

 

Thank you 

OK @u4jaanus ,

If possible, this will not be easy (or short). You cannot loop inside a Patch statement, so somehow you would need to pick up the four values individually from the gallery. I am sorry, but it is not something I have ever attempted (or needed to) as I design my data to fit my needs, not try to solve data design issues with code after the fact. I will tag one of my code guru colleagues @Eelman  - this will need some sort of collection and First statement then delete them as they are written.

I have done this using Collections. Unfortunately couldn't find any other way to do it.. Thank you.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (14,976)