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

Patch data from radio button answers to sharepoint list

Hi guys,

 

Having trouble patching data to my sharepoint list.

 

I have a gallery with about 30 audit questions in. The gallery's data source is a differnet Sharepoint list containing the list of audit questions.
Each question on the app has a radio button control for the user to score the question a 1, 2, 3 or 4, as shown below.

 

PAP1.png

Because the questions are in a gallery, there is only 1 Radio Button control (Radio2), when it comes to patching to my sharepoint list, it will only patch the 1 record rather than all 30. 
PAP2.png

My patch statement looks like this: 

Patch('Active Monitoring Answers', Defaults('Active Monitoring Answers'),
{Title: Dropdown3_2.Selected.Value, Score: Radio2.Selected.Value})


Is there a way to patch each score to my list? Or a way of making each question have its own radio button control showing in the screen section on the left?

 

Thanks.

7 REPLIES 7
Highlighted
Super User
Super User

Re: Patch data from radio button answers to sharepoint list

Hi @JD2301,

You can accomplish your goal with the ForAll() and either Patch() or Collect() functions, see General-Discussion/patch-forall-gallery-control/td-p/43320#M17984 for the details.

Highlighted
Community Support
Community Support

Re: Patch data from radio button answers to sharepoint list

Hi @JD2301,

Do you want to save Radio button answer for each item within the Gallery to your SP list?

Based on the formula that you mentioned, I think there is something wrong with it. I have made a test on my side, I think the ForAll function could achieve your needs, please take a try with the following workaround:7.JPG

Set the OnSelect property of the "Patch" button to following formula:

ForAll(
Gallery1.AllItems,
Patch(
'20190123_case2',
Defaults('20190123_case2'),
{
Title: "Questuion Save",
'Rating Value': Value(Radio1.Selected.Value)
}
)
)

On your side, you should type:

ForAll(
      Gallery1.AllItems, /* <-- Gallery1 represents the Gallery control within your app */
      Patch(
'Active Monitoring Answers',
Defaults('Active Monitoring Answers'), 
{
Title: Dropdown3_2.Selected.Value, 
Score: Radio2.Selected.Value
}
) )

More details about the ForAll function, please check the following article:

ForAll 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.
Highlighted
Post Prodigy
Post Prodigy

Re: Patch data from radio button answers to sharepoint list

Hi @v-xida-msft 

 

I try to use the formula you gave to meet my needs, and this is the formula i used:
ForAll(GalleryChecklist.AllItems, Patch('_Report Line 1', Defaults('_Report Line 1'), {Temperaturehumiditylogbook: Radio1_1.Selected.Value, Equipmentlogbook: Radio1_1.Selected.Value, Chillercoolantcheck: Radio1_1.Selected.Value});

 

However, its not working as i expected.

The one that i need is that the patch fucntion is created only one single record.

In other words, i want to patch the whole gallery which contain many multiple radio control into one single record in a sharepoint list.

 

This is my gallery example:

gal patch 1.png

 

And this is my SP list, which i dont want to (i want to patch it all in a single record/create a new record😞
gal patch 2.png

 

Please help, i dunno if this achieveable with powerapps.

 

BR,

pytbyt

 

Highlighted
Frequent Visitor

Re: Patch data from radio button answers to sharepoint list

Hi @PytByt ,

 

Weere you able to accomplish this task? I am doing something similar and stuck at the same step.

If you did, please post it here as it would be very helpful for me.

Highlighted
Post Prodigy
Post Prodigy

Re: Patch data from radio button answers to sharepoint list

Hello @sh020ho 

Have you find your solution yet?

I'm using this formula to directly patch my whole gallery items:

ForAll(GalleryInspectionChecklist.AllItems, Patch('SMU_Service Line', Defaults('SMU_Service Line'),
{cr1e4_so_numberinspection: TextInputSONumber.Text,
cr1e4_key: Concatenate(GalleryFilterSO.Selected.cr1e4_serviceorderid, "-", LabelQuestionNumber.Text),
cr1e4_questionsnumber: LabelQuestionNumber.Text,
cr1e4_questionsname: LabelQuestion.Text,
cr1e4_responds: Radio_RespondsInspection.Selected.Value,
cr1e4_respondtext: TextInputAnswerText.Text,
cr1e4_remarks: TextInputRemarks.Text}));

The green ones is my CDS Entities Column fields

The blue ones is my Gallery object (inside the gallery)

I'm still struggling with update the CDS with patch function.

In other words, i still have problem when i try to patching/update the gallery items into the CDS.
If you have an insight for me, please let me know.

 

Hope this help,

 

Cheers,

pytbyt

Highlighted
Resolver II
Resolver II

Re: Patch data from radio button answers to sharepoint list

Hi

I guess there is misunderstanding when others propose ForAll. The formula for ForAll is correct if you wish to save multiple records.

What u r looking is Single Record with multiple questions. This is a checklist for your audit questions which we used to use.

So you should NOT use Gallery to prepare. Questions.
You should put in into very single labels or preferably using Scrollable Screens and add cards for each question and and radio buttons.
Then you
Patch(DS, Defaults (DS), {Q1 : Radio1.Selected.Value, Q2: Radio2.Selected.Value,.... }).
That's all.

Hope this helps.
Highlighted
Post Prodigy
Post Prodigy

Re: Patch data from radio button answers to sharepoint list

Hi @PK_Hong & @sh020ho 

I'm using this formula for patching new line into my CDS:

ForAll(HeaderColl, Patch('SMU_Service Report Headers', Defaults('SMU_Service Report Headers'),
{cr807_so_numberheader: SO_NumberHeader,
cr807_visittype: Visit,
cr807_description: Description,
cr807_sitename: SiteName,
cr807_planneddate: PlannedDate,
cr807_actualdate: ActualDate,
cr807_assignedengineersname: AssignedEngineer,
cr807_actualengineersname: Engineer1Name,
cr807_engineer2name: Engineer2Name,
cr807_equipmenttype: Machine,
cr807_status: "Submit"}))

Some how it works just fine with my scenario.

I hope this help.

 

Regards.

pytbyt

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Users online (4,217)