cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StuCundy
Post Patron
Post Patron

Patch For All from a collection to a document library

Hi there

I have a collection reading a document library and which to patch one column to the library items.

 

The Collection is of Images with a number column "ReportID".  I filter the reports by the ID which is set by a variable "varReportItem.ID"   I which to update the Number column called "PicNumber" in the Document library which AARowNumber which a column I added.  I do not get an error but they do not  update.

ForAll(
    colreportImages,
    Patch(
        ReportImageLibrary,
        LookUp(
            ReportImageLibrary,
            ReportID = varReportItem.ID
        ),
        {PicNumber: AARowNumber}
    )
)

 

Look forward to some help, thanks.

1 ACCEPTED SOLUTION

Accepted Solutions
krishnags
Super User
Super User

probably you may need to change the Patch condition

 and provide how the colreportImages looks like to have a better idea

ForAll(
    colreportImages,
    Patch(
        ReportImageLibrary,
        LookUp(
            ReportImageLibrary,
            ReportID = <<It should go ID from colreportImages>>
        ),
        {PicNumber: AARowNumber}
    )
)

View solution in original post

3 REPLIES 3
krishnags
Super User
Super User

probably you may need to change the Patch condition

 and provide how the colreportImages looks like to have a better idea

ForAll(
    colreportImages,
    Patch(
        ReportImageLibrary,
        LookUp(
            ReportImageLibrary,
            ReportID = <<It should go ID from colreportImages>>
        ),
        {PicNumber: AARowNumber}
    )
)

View solution in original post

Hey @krishnags 

 

Your were right.  was an easy fix...you can me some clarity.

ForAll(
    RenameColumns(colreportImages,"ID","ID1"),
    Patch(
        ReportImageLibrary,
        LookUp(
            ReportImageLibrary,ID=ID1),
        {PicNumber: AARowNumber}
    )
)

 

UdayAdhikari
Continued Contributor
Continued Contributor

Hi @StuCundy, or may be AARowNumber is not set up properly in the collection. I just tried below code and it worked for me. (replace collection, list name and column names to yours)

 

ClearCollect(
    colreportImages,
    {
        ReportID: 1,
        AARowNumber: 2
    }
);
Set(
    varReportItemID,
    1
);
ForAll(
    colreportImages,
    Patch(
        List1,
        LookUp(
            List1,
            ID = varReportItemID
        ),
        {NumField: AARowNumber}
    )
)

 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.

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,634)