cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Erimar
Frequent Visitor

Help needed with form

Hello!
I'm trying to create a form page which inserts multiple rows into a Sharepoint list. Based on which Business Unit the user chooses, the number of regions in the form changes. One region equals 4 fields. For example, one BU may have 3 regions x 4 fields, another may have 10 regions x 4 fields.
I want to loop these based on the information about the BU available in a Sharepoint list, although it seems impossible to do so in a simple form.

I've tried to use a gallery to loop the regions, then insert 4 text inputs per region. The save button uses a ForAll() and a Patch() to insert the inputs into the Sharepoint list. This solution doesn't work.

 

ForAll(Gallery1.AllItems;
  Patch('Weekly Report';
    Defaults('Weekly Report');{
      'Value1':TextInput1;
      'Value2':TextInput2; 
      'Value3':TextInput3; 
      'Value4':TextInput4;
      'WeekNum':Dropdown1;
      'Business Unit':Label1
    }
  )
);;

Skärmklipp.PNGCan you help me find a solution to this? 

 

Many thanks!

5 REPLIES 5
sopatte
Microsoft
Microsoft

I'm not clear on exactly what you're doing but could it be as simple as that you need to use "TextInput1.Text" and "DropDown1.Selected.Value" etc.?

Erimar
Frequent Visitor

I have already tried this without success, unfortunately. But thanks for the help.

@Erimar 

You need to specify the properties for those controls as @sopatte mentioned.

Your formula would be this:

ForAll(Gallery1.AllItems;
  Patch('Weekly Report';
    Defaults('Weekly Report');{
      'Value1':TextInput1.Text;
      'Value2':TextInput2.Text; 
      'Value3':TextInput3.Text; 
      'Value4':TextInput4.Text;
      'WeekNum': Dropdown1.Selected.Value;
      'Business Unit':Label1.Text
    }
  )
);;

If you are having some sort of error appear or other issue, please post back.

 

I hope this is helpful.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!
sopatte
Microsoft
Microsoft

Oh, I just figured out that TextInput1, TextInput2, etc. are all controls in the gallery and you're trying to iterate through the gallery items and get the value from the controls which are repeated.

 

I've never seen that before, but it might work if you use the field names instead of the control names. So if TextInput1 is connected to Field1, you might try substituting Field1 for TextInput1 in your code.

@sopatte 

Yes, that does work and is intended.  If you have a control in the gallery, it becomes part of the record of the AllItems.

So in the case of @Erimar the syntax is correct if the intention is to gather the values of the controls in the gallery associated with the item.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,693)