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 / Trying to add a column...
Power Apps
Answered

Trying to add a column to a collection

(0) ShareShare
ReportReport
Posted on by 380

I have the following code which creates a collection from a Sharepoint list called TripDetails - it filters on the date being Today and 5 days into the future - this working fine:

ClearCollect(
 colTripData,
 With(
 {
 StartDate: Today(),
 EndDate: Today() + 5
 },
 Filter(
 TripDetails,
 tripdate >= StartDate,
 tripdate < EndDate
 )
 )
);

I need to get the region field into that collection but it is in a different Sharepoint list called Trips so I need to do an AddColumns with a LookUp on tripid which is in both lists and then return the region field - I think the code is similar to this :

AddColumns(
 Trips,
 "Region",
 LookUp(
 colTripData,
 tripid exactin Trips.tripid
 ).region
)

- can someone tell me how I wrap that code around my existing ClearCollect please - I have tried many combinations but none have worked for me yet...thanks

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    153,117 Most Valuable Professional on at

    Hi @bobgodin ,\

    You can put the AddColumns at the bottom too if you want - neither place is Delegable. I also assumed the field name in your other list.

    With(
     {
     StartDate: Today(),
     EndDate: Today() + 5,
     Data:
     AddColumns(
     TripDetails,
     "Region",
     LookUp(
     Trips As aTrip,
     aTrip.tripid = tripid
     ).Region
     ) 
     },
     Filter(
     Data,
     tripdate >= StartDate,
     tripdate < EndDate
     )
    );

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • bobgodin Profile Picture
    380 on at

    hi @WarrenBelz thank you that did the trick!

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
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard