cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

Ability to Copy/Apply Down Information inside of an Editable Grid in PowerApps

Hello,

 

I am currently developing a PowerApp that allows me to edit and save information on the app to a SharePoint List. As it is currently set up, the first screen is a screen in which you can search up a given person, and a variable is passed through to the second screen that holds the person's ID/Username, this then filters down a hidden gallery to the rows only related to that given person. The second screen is currently a editable gallery that will save changes made, but I currently have to go item by item to edit it. Is there a way for me to be able to apply a specifics row's worth of information downwards? For instance, if I'm on row 8/24 and I change the person's information across all the columns in that row, is there was a way for me to create a button that changes all the rows under that one to the information I just changed it to. Or alternatively only for one column, copying the information down? 

1 ACCEPTED SOLUTION

Accepted Solutions

@CatLampMan42069 ,

 You are also missing closing brackets off this - with the button in the gallery, you may be able to do this. It is at times problematic running code from inside a gallery referring to the gallery.

With(
   {wRow: ThisItem.RowNo},
   Patch(
      'TEST - FY23',
      ForAll(
         Filter(
            HiddenForeGall.AllItems, 
            RowNo >= wRow,
         ) As aPatch, 
         {
             ID: aPatch.ID,
             'C Percentage': aPatch.CBox.Text,
             'S Status': aPatch.SStatusBox.Selected,
             'T Status': aPatch.TBox.Selected.Value,
             Department: aPatch.DepartBox.Selected.Value
         }
      )
   )
)    

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

 

View solution in original post

20 REPLIES 20
WarrenBelz
Super User
Super User

Hi @CatLampMan42069 ,

If you have your gallery rows sequentially numbered (you can do it with this code from my blog on gallery alternate shading), then you would do this

Patch(
   YourListName,
   ForAll(
      Filter(
         GalleryName.AllItems,
         RowNo >= ThsiItem.RowNo
      ) 
   ) As aPatch,
   {
      ID: aPatch.ID,
      Field1: aPatch.GalleryField1Control,
      Field2: aPatch.GalleryField2Control
      . . . . . . 
   }
)

Note that I have assumed the button is in the gallery on the item and the gallery Items are based on the source list here.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Thank you for replying! I have tried to implement the code found on your site as the following 

With(
{
wList:
Filter(
SPList,
Title = selectedID
)
},
ForAll(
Sequence(CountRows(wList)),
Patch(
Last(
FirstN(
wList,
Value
)
),
{RowNo: Value}
)
)
)

 

However, when I added this onto the items of the gallery the patch functions within it show up as an error.

I currently set the items of the gallery to have code similiar to this for OnChange.

 

Patch(SPList, ThisItem, {ColumnName:Value(TextInputBox.Text)}) 

 

Do you know what might be the cause for this issue?

 

 

Hi @CatLampMan42069 ,

That is because the added column does not exist in the List and ThisItem will not match the record. You should be able to do this

Patch(
   SPList, 
   {ID: ThisItem.ID}, 
   {ColumnName:Value(TextInputBox.Text)}
) 

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

WarrenBelz
Super User
Super User

Hi @CatLampMan42069 ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

Visit my blog Practical Power Apps

Hi @WarrenBelz, thank you for the onchange solution it worked! In terms of your initial solution, I was wondering why there are a few errors that show up when I tried to put it onSelect for the button on the gallery; for the "ForAll()Filter()" portion of the solution, the PowerApps says there is "Inavlid number of arguments: received 1, expected 2" and it says the "As" function is not permitted in the context since it is a non-record value. I also had a question for the Field1 portion. Is it supposed to be the name of our column? and for the aPatch.GalleryField1Control, is it supposed to be written like that or am I supposed to substitue my column and gallery name in? Thank you so much for the help you've given!

@CatLampMan42069 ,

I would need to see the code and where you were using it to comment - the syntax structure I provided is valid.

Hi @WarrenBelz, thank you for replying again, I greatly appreciate it. I currently have this, and I am given invalid argument errors.

Patch(
    SP List,
    ForAll(
        Filter(
            GalleryName.AllItems,
            RowNo >= ThisItem.RowNo)
    ) As aPatch,
    {
        ID:aPatch.ID,
        Column1Name: aPatch.GalleryField1Control,
        Column2Name: aPatch.GalleryField2Control,
        Column3Name : aPatch.GalleryField3Control,
        Column4Name: aPatch.GalleryField4Control
    }
)

 

@CatLampMan42069 ,

I assume you have replaced the Gallery, SharePoint List, Column and Control names with your values. Can you please post the actual code you are getting the error on.

 

@WarrenBelz

Patch(
    'TEST - FY23',
    ForAll(
        Filter(
            HiddenForeGall.AllItems,
            RowNo >= ThisItem.RowNo)
    ) As aPatch,
    {
        ID:aPatch.ID,
        'Percentage': aPatch.GalleryField1Control,
        'Status': aPatch.GalleryField2Control,
        'T Status': aPatch.GalleryField3Control,
        Department: aPatch.GalleryField4Control
    }
)

 

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.

Community Call Conversations

Introducing the Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

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 (1,693)