cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
neill_long
Responsive Resident
Responsive Resident

Update SP List

Hi,

 

Hoping this is an easy fix, I have a gallery which can be filtered on a number of conditions.  I have a button outwith the gallery that will collect the items and patch to a SP List.  I also want to update another SP List.  It currently updates all the records in the SP.

 

I want it to only update the records that are filtered in the gallery, or collected in the collection.  This is the formula I currently have:

 

ForAll(
    Gallery1_1.AllItems,
    Collect(
        TestColl,
        {
            Year: Text(
                Today(),
                "yyyy"
            ),
            Month: Text(
                Today(),
                "mmmm"
            ),
            Test: If(
                Text(
                    Today(),
                    "mmmm"
                ) = "January",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "Feburary",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "March",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "April",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "May",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "June",
                "1hr Duration",
                Text(
                    Today(),
                    "mmmm"
                ) = "July",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "August",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "September",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "October",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "November",
                "Functional",
                Text(
                    Today(),
                    "mmmm"
                ) = "December",
                ThisRecord.Dropdown1.SelectedText.Value
            ),
            MasterID: ID,
            Signed: Left(
                User().FullName,
                1
            ) & Mid(
                User().FullName,
                Find(
                    " ",
                    User().FullName
                ) + 1,
                1
            ),
            Dated: Text(
                Today(),
                "dd/mm/yyyy"
            )
        }
    )
);
Patch(
    LDR_Light,
    ForAll(
        LDR_Light,
        {
            ID: ID,
            UKDate2: DateAdd(
                Today(),
                1,
                Months
            )
        }
    )
);
ForAll(
    TestColl,
    Patch(
        LDR_Light_Test,
        Defaults(LDR_Light_Test),
        {
            Year: Year,
            Month: Month,
            Test: Test,
            Title: Signed,
            Dated: Dated,
            MasterID: MasterID
        }
    )
);
Clear(TestColl)

 

The first part of the formula does what i want it to do and collects the filtered data and puts into a Collection.  The issue is with the formula:

 

Patch(
    LDR_Light,
    ForAll(
        LDR_Light,
        {
            ID: ID,
            UKDate2: DateAdd(
                Today(),
                1,
                Months
            )
        }
    )
);

 

This updates all records in the SP List - LDR_Light.  But what i want to achieve is that it only updates the records that are filtered in the Gallery.

 

Hope this makes sense, any help would be appreciated.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
neill_long
Responsive Resident
Responsive Resident

as soon as I posted this I found the answer.  used the solution in this post:

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-from-a-filtered-Gallery/td-p/766165

 

View solution in original post

1 REPLY 1
neill_long
Responsive Resident
Responsive Resident

as soon as I posted this I found the answer.  used the solution in this post:

 

https://powerusers.microsoft.com/t5/Building-Power-Apps/Patch-from-a-filtered-Gallery/td-p/766165

 

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 (3,303)