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

Fuction Patch records

Good Evening,

I want change register in sharepoint list base data, with fuction Patch. My list sharepoint have more that of 20 columns and i need change or edit some data.

 

Thanks.

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @CarlosN :

Do you need such two buttons:

  • Button1:Create a new record
  • Button2:Modify the specified record and submit

If so,I suggest you to adopt such a scheme:

1\Create two icons to switch modes:

  • mode1(New):Reset the default values of all controls to empty
  • mode2(edit):Reset the default values of all controls to the values of the target record

2\Use a button to submit records or modify records

I made a similar case for your reference:

1\Set the app's OnStar proeprty to 

Set(Mod,"New") /*Mod is my custom variable*/

Then run OnStart

1.JPG

2\Add a gallery(Gallery4)

Items

OfficeSupplyList

3\Add three icons(Edit/Check/Add) into this gallery

Edit-OnSelect

Set(Mod,"Edit")

Check-OnSelect

Set(Mod,"View")

Add-OnSelect

Set(Mod,"New")

4\Set up 4 textInput box controls(ItemNumber/PageNumber/Description/Quantity)

ItemNumber

Default

If(Mod="New",Blank(),Gallery4.Selected.ItemNumber)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

PageNumber

Default

If(Mod="New",Blank(),Gallery4.Selected.PageNumber)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

Description

Default

If(Mod="New",Blank(),Gallery4.Selected.Description)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

Quantity

Default

If(Mod="New",Blank(),Gallery4.Selected.Quantity)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

 5\Add a button

OnSelect:

If(
    Mod = "New",
    Collect(
        OfficeSupplyList,
        {
            ItemNumber: ItemNumber.Text,
            PageNumber: PageNumber.Text,
            Description: Description.Text,
            Quantity: Quantity.Text
        }
    ),
    Patch(
        OfficeSupplyList,
        Gallery4.Selected,
        {
            ItemNumber: ItemNumber.Text,
            PageNumber: PageNumber.Text,
            Description: Description.Text,
            Quantity: Quantity.Text
        }
    )
);
Reset(ItemNumber);
Reset(PageNumber);
Reset(Description);
Reset(Quantity)

400.gif

Best Regards,

Bof

View solution in original post

6 REPLIES 6
mdevaney
Super User
Super User

@CarlosN 

Hello there.  Welcome to the help forums.


You need to provide more detailed information.  I don't understand what you want to accomplish.

  • Give specific information about your app including code you tried
  • Show what your app looks like now, and also what you want to it look like after changes are made
  • Screenshots are great.

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

This is my form, it has a save button and I need a button to edit.

This is my main screen, with the gallery. But i don´t know how is sintaxis for fuction Patch edit.

@CarlosN 

If you want to change the Form into Edit Mode use this code in the Editar button's OnSelect property

EditForm(Form1);

 

---
Please click "Accept as Solution" if my post answered your question so that others may find it more quickly. If you found this post helpful consider giving it a "Thumbs Up."

Thank you,
but it is not the answer, the screen is not a form of the power apps.

Hi @CarlosN :

Do you need such two buttons:

  • Button1:Create a new record
  • Button2:Modify the specified record and submit

If so,I suggest you to adopt such a scheme:

1\Create two icons to switch modes:

  • mode1(New):Reset the default values of all controls to empty
  • mode2(edit):Reset the default values of all controls to the values of the target record

2\Use a button to submit records or modify records

I made a similar case for your reference:

1\Set the app's OnStar proeprty to 

Set(Mod,"New") /*Mod is my custom variable*/

Then run OnStart

1.JPG

2\Add a gallery(Gallery4)

Items

OfficeSupplyList

3\Add three icons(Edit/Check/Add) into this gallery

Edit-OnSelect

Set(Mod,"Edit")

Check-OnSelect

Set(Mod,"View")

Add-OnSelect

Set(Mod,"New")

4\Set up 4 textInput box controls(ItemNumber/PageNumber/Description/Quantity)

ItemNumber

Default

If(Mod="New",Blank(),Gallery4.Selected.ItemNumber)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

PageNumber

Default

If(Mod="New",Blank(),Gallery4.Selected.PageNumber)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

Description

Default

If(Mod="New",Blank(),Gallery4.Selected.Description)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

Quantity

Default

If(Mod="New",Blank(),Gallery4.Selected.Quantity)

DisplayMode

If(Mod="View",DisplayMode.View,DisplayMode.Edit)

 5\Add a button

OnSelect:

If(
    Mod = "New",
    Collect(
        OfficeSupplyList,
        {
            ItemNumber: ItemNumber.Text,
            PageNumber: PageNumber.Text,
            Description: Description.Text,
            Quantity: Quantity.Text
        }
    ),
    Patch(
        OfficeSupplyList,
        Gallery4.Selected,
        {
            ItemNumber: ItemNumber.Text,
            PageNumber: PageNumber.Text,
            Description: Description.Text,
            Quantity: Quantity.Text
        }
    )
);
Reset(ItemNumber);
Reset(PageNumber);
Reset(Description);
Reset(Quantity)

400.gif

Best Regards,

Bof

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

Keep up to date with current events and community announcements in the Power Apps community.

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,463)