cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

patch and submit form in one button

Hello, 

 

I'm new at powerApps and i'm having a couple of issues with my app. If anyone could help I would really appreciate it.

First thing is, how would I go by submitting a form and a patch by clicking only one button. 

 

so far I've done this :

 

SubmitForm(Form5);
Patch(
VisitorEntryList,
Defaults(VisitorEntryList),
{
ReasonForVisit: TextReasonForVisit.Text,
Question1: Rquestion1.SelectedText,
Question2: Rquestion2.SelectedText,
Question3: Rquestion3.SelectedText,
Question4: Rquestion4.SelectedText,
Question5: Rquestion5.SelectedText
}
);
Navigate(
ScSuccess,
ScreenTransition.Fade
);
ResetForm(Form5);
Reset(TextReasonForVisit);
Reset(Rquestion1);
Reset(Rquestion2);
Reset(Rquestion3);
Reset(Rquestion4);
Reset(Rquestion5);

 

But it creates 2 entries on my SharePoint list. I want all of them in one.

 

Second is , i want to have a page for people checking out of the building. What i want is, i want a gallery that will take my sharePoint list search the TimeOut column and only display the names that the time out is empty.  Create a button next to it and when click on it , it will check them out and return and write on that column the time.

 

and third and last how can i create a drop down box that connects to that same SP list take the 4 choices that i have in a column and display those choices in the app? 

 

So that's all 😋😋 

 

If anyone can help me i would really appreciate it. 

 

Again thank you very much 😊

Have a beautiful weekend everybody.  

8 REPLIES 8
Highlighted
Helper III
Helper III

Re: patch and submit form in one button

Please follow this.

https://powerusers.microsoft.com/t5/Building-Power-Apps/Submit-amp-Patch/m-p/418571#M123823

 

 

Thanks,

Kranthi

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

Highlighted
Community Champion
Community Champion

Re: patch and submit form in one button

Are Rquestion1 Rquestion dropdowns

Or

Radio buttons?

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Highlighted
Super User
Super User

Re: patch and submit form in one button

Hi @Dimitra_s 

SubmitForm() does the same thing as a patch.  Are the fields different in the form and in your patch?  If your Form has the same five questions as your patch, then the patch is redundant and will create a duplicate record. 

Secondly,  you should never have anything other than the SubmitForm()  in your Save button.  Any other commands should be moved to the OnSuccess property of the form so they aren't executed unless the Form submits successfully.

The Items property syntax of a dropdown that will show unique values should be 

Sort(Distinct(DataSource, FieldName),Result,Ascending)

 

Highlighted
New Member

Re: patch and submit form in one button

Hello First i want to thank you all for replying to me.

I apologize in advance, I don't want to sound like stupid but be patient with me. This is my first try with powerApps and I have been studying a lot though.

 

 

@KranthiTupakula 

I tried this and it doesn't work for me Capture.JPG

@eka24 

No Rquestions are just radio buttons and I just patch the results to my SP list

 

@Drrickryp 

 

Hello 🙂 

 

Again I don't want to sound like stupid but on my button i can't find a onsuccess property it only has the Onselect.

Yes they are from the same list. But on the form i have deleted the things i put in the patch so basically half of them are in a form and the other ones i put in the patch so it shouldn't create a duplicate record. 

 

How can i change that formula and basically say only show me the names of the people that the Time OUT is null?

Sort(Distinct(DataSource, FieldName),Result,Ascending)

 

Again thank you so much for your help. You are a lifesaver.

 

 

Highlighted
Community Champion
Community Champion

Re: patch and submit form in one button

Change the all Question1: Rquestion1.SelectedText

To

Question1: Rquestion1.Selected.Value

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

 

Highlighted
Super User
Super User

Re: patch and submit form in one button

@Dimitra_s 

OnSuccess is a property of the form itself not the button

Highlighted
Helper III
Helper III

Re: patch and submit form in one button

Try to write the patch code on form success.

KranthiTupakula_0-1596232466577.png

 

Highlighted
Community Support
Community Support

Re: patch and submit form in one button

HI @Dimitra_s ,

For your first question, I think there is something wrong with your formula you provided. The SubmitForm function and the Patch function both add new records into your SP List.

 

Regarding the needs that you mentioned, I think the Patch function is enough to achieve your needs. Please consider modify your formula as below:

Patch(
       VisitorEntryList,
       If(
          Form5.Mode = FormMode.New,
          Defaults(VisitorEntryList),
          BrowseGallery1.Selected // The BrowseGallery1 represents the Gallery in your app, which list all available records from your SP List
       ),
       Form5.Updates,
       {
         ReasonForVisit: TextReasonForVisit.Text,
         Question1: Rquestion1.SelectedText,
         Question2: Rquestion2.SelectedText,
         Question3: Rquestion3.SelectedText,
         Question4: Rquestion4.SelectedText,
         Question5: Rquestion5.SelectedText
      }
);
Navigate(
         ScSuccess,
         ScreenTransition.Fade
);
ResetForm(Form5);
Reset(TextReasonForVisit);
Reset(Rquestion1);
Reset(Rquestion2);
Reset(Rquestion3);
Reset(Rquestion4);
Reset(Rquestion5);

 

For your second question, you could consider add a Gallery in your app, set the Items property to following:

Filter(
       VisitorEntryList,
       IsBlank(TimeOut)
)

then add a button (called "Checked Out") inside this Gallery, set the OnSelect property of the button to following:

Patch(
      VisitorEntryList,
      ThisItem,
      {
        TimeOut: Now()
      }
)

 

 

For your third question, do you want to connect a Dropdown box to a Choice type column or a Text type column in your SP List?

Please consider add a ComboBox in your app, set the Items property to following:

a) If you want to connect a Dropdown box to a Choice type column

Choices(VisitorEntryList.ChoiceColumn)

b) If you want to connect a Dropdown box to a Text type column:

Distinct(
         VisitorEntryList,
         TextFieldColumn
)

Note: Set the SelectMultiple property of the ComboBox to false.

 

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.

Helpful resources

Announcements
August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

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

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Community User Group Member Badges

FIll out a quick form to claim your community user group member badge today!

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (7,962)