web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Collection vs Patch
Power Apps
Answered

Collection vs Patch

(0) ShareShare
ReportReport
Posted on by 725

Hi everyone

This works

Patch(BSInspections,Defaults(BSInspections),{StationNum:{Id:NumT.ID, Value:NumT.StationNumber}},{BaitLeft:BLeft},{BaitAdded:BAdded},{Faeces:FaecesYN},{InspectionDate:Today()})

But this does not

Collect(ColStation,{StationNum:{Id:NumT.ID, Value:NumT.StationNumber}},{BaitLeft:BLeft},{BaitAdded:BAdded},{Faeces:FaecesYN},{InspectionDate:Today()})

 BLeft, BAdded, Faeces are  true false Set() variables, Do Collections not like Set() variables? I'm not getting errors but the collection just shows the date and BLeft, BAdded, Faeces all as false.

Thank you for your time.

Categories:
I have the same question (0)
  • R Bakker Profile Picture
    725 on at

    Thank you timl, this works well

  • Verified answer
    timl Profile Picture
    36,558 Super User 2025 Season 2 on at

    @Corissandageri 

    Syntactically, this formula adds a new record to BSInspections. It merges all the fields that you specify after Defaults(BSInspections) into a single new record.

    Patch(BSInspections,Defaults(BSInspections),{StationNum:{Id:NumT.ID, Value:NumT.StationNumber}},{BaitLeft:BLeft},{BaitAdded:BAdded},{Faeces:FaecesYN},{InspectionDate:Today()})

    In contrast, this function would add 5 records to the ColStation collection. Therefore, these two calls are not equivalent.

    Collect(ColStation,{StationNum:{Id:NumT.ID, Value:NumT.StationNumber}},{BaitLeft:BLeft},{BaitAdded:BAdded},{Faeces:FaecesYN},{InspectionDate:Today()})

    The formula beneath would behave the same as your Patch example.

    Collect(ColStation,
     {StationNum:{Id:NumT.ID,Value:NumT.StationNumber},
     BaitLeft:BLeft,
     BaitAdded:BAdded,
     Faeces:FaecesYN,
     InspectionDate:Today()
     }
    )

     

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
Kalathiya Profile Picture

Kalathiya 427

#2
WarrenBelz Profile Picture

WarrenBelz 360 Most Valuable Professional

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 336 Super User 2025 Season 2

Last 30 days Overall leaderboard