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

How to update an existing patch record when you are not using a form for inputs? Is this possible?

I have created an app for Leave Request.
There are two screens:
(1) Leave Requests - which I use a gallery to collect records in my SharePoint List.(Please see attached photo below.) Within the this screen there are New & Edit Button . On click New button it will navigate to "New Request Screen". 

photo1.JPG


(2) New Leave Request - this is where to input details for a new leave request but I don't use a Form for this. Instead I'm using a different controls such as Labels, text inputs, date picker etc. (Please see attached Photo below.) And then I used a Patch function to save the input details to my SharePoint list. I don't have any problem with saving. 

photo2.JPG

 

Questions: 

1. Do I have to create a separate screen for EDIT?  what am I going to do to achieve it? Please if you could give me a step by step instruction how to do it I would really appreciate it. I am a newbie here. 
2. On this kind of setup, how could I clear & reset the the previous record details upon create another New Leave Request? 

I really hope that someone would patiently look in to this and bare with a newbie like me. God Bless you all. 

6 REPLIES 6
CNT
Super User
Super User

@Manilyn0509 I'm not quiet sure why you have chosen not to use an EditForm that comes with a lot of built in goodies, which you are trying to do manually. Any particular reason?

daruom
Helper II
Helper II

Hello,

I agree with the question of @CNT 

 

What I would have done is:
- On the "Edit" button of your 1st page, in the "OnSelect" property: 

 

Navigate(
    NewRequestScreen; 
    {dataType: "edit"}
)

 

- In the "OnVisible" of your 2nd screen: 

 

UpdateContext(
    {
        currentData: lookup(
            YOURDATASOURCE;
            YOURCONDITION
         )
     }
)

 

- In the "Default" properties of your controls, you put: 

 

currentData.YOURFIELD

 

 

On your "Submit" button :

 

If(
    dataType = "edit";
    Patch(
        YOURDATASOURSE;
        YOURCONDITION;
        {
            YOURDATA
        }
    );
    Patch(
        YOURDATASOURCE;
        Default(YOURDATASOURCE);
        {
            YOURDATA
        }
    )
)

 

 

I haven't done a test, I hope that can help you.

timl
Super User
Super User

Hi @Manilyn0509 

It's not necessary to create a separate screen for Edit. For background reading, this post by Giacomo Baizini provides a good description of how to create shared New/Edit forms.

https://baizini-it.com/blog/index.php/2017/09/28/powerapps-101-create-your-own-forms/

 

The technique that @daruom describes is very good, and compared to the post above, it addresses the issue that your gallery control and custom form are on different screens. You'll need to customise it a bit further to account for new records (eg, {dataType: "new"}).

As @CNT , it would be easier to do this with an EditForm. If you've used the Patch technique because it's easier to layout the controls on a screen, I would recommend watching the videos by @RandyHayes. Randy has some great content on how to use and layout form controls.

 

RandyHayes
Super User
Super User

Thanks @timl for the mention of the video!

 

@Manilyn0509 

Yes, I totally agree that you would be better off with a form for all of this.  Forms provide a lot of functionality, error checking and so much more.  People shy away from them a lot because they look ugly!  But, there is no need to use the interface of a form and yet still use a form for it all.

The Video on Forms - Everything you wanted to know is a great training session on forms and how and what they do.  It's a long video because it is so intense, but there is a table of contents on the video that can be used to skip around.  In particular, separating the form interface from the form is something that you will find in the Super Forms section of the video.

There you will see how to completely replace the form interface and still use the form.

 

I hope it is helpful for you.

_____________________________________________________________________________________
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!

It's simple because I can't play with interface design when using forms. And also I just copy this template from Youtube. I don't really know about powerapps that' is why I'm learning and asking ideas on this community.

@Manilyn0509 You can customise (interact with) EditForms. It just depends on what you are up to. Form you screen shots, your form should be quiet straight forward.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Power Apps Community Call Jan. 2022 768x460.png

Power Apps Community Call

Please join us on Wednesday, January 19th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Top Solution Authors
Top Kudoed Authors
Users online (1,368)