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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using forall to collec...
Power Apps
Unanswered

Using forall to collect the data

(0) ShareShare
ReportReport
Posted on by 95

Hi All,

 

 I have a collectionA which is having Name and ID columns. I'm populating a combobox with Names by using(collectionA)  and it was enabled for selecting multiple items.

 

Here i have to collect the data forall the Names with corresponding ID.

 

ClearCollect(MyCalendarNames,combobox.SelectedItems.DisplayName);

ForAll(collectionA.Name,

ClearCollect(collectionX ,Filter(Office365Outlook.GetEventsCalendarViewV2(
LookUp(collectionY,DisplayName in MyCalendarNames.Name).ID,
Text(DateAdd(dpkFrom.SelectedDate,-1,Hours),UTC),
Text(DateAdd(dpkTo.SelectedDate,1,Days),UTC)).value));

 

Can someone help me on this.

 

Categories:
  • rsaikrishna Profile Picture
    3,703 on at

    @BKGOUD 

     

    I did a POC on your requirement.

     

    On App start, I created a collection as below:

    ClearCollect(colIDNames,Table({ID:1,DisplayName:"A"},{ID:2,DisplayName:"B"},{ID:3,DisplayName:"C"},{ID:4,DisplayName:"D"},{ID:5,DisplayName:"E"}))

     

    Placed a combo box on the screen and its Items property set to colIDNames.DisplayName.

     

    On change property of the combo box, I placed following formula to get all the names and IDs:

    ClearCollect(colNames, Filter(colIDNames,DisplayName in cbNames.SelectedItems))

     

    With above formula, you will get only the selected items.

     

    Please check and let me know if you can use it to resolve your issue.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
  • BKGOUD Profile Picture
    95 on at

    Hi @rsaikrishna ,

    Thanks for helping me.

    The solution which you have shared works fine. I need help  on the below code.

     

    ForAll(collectionA.Name,

    ClearCollect(collectionX ,Filter(Office365Outlook.GetEventsCalendarViewV2(
    LookUp(collectionY,DisplayName in MyCalendarNames.Name).ID,
    Text(DateAdd(dpkFrom.SelectedDate,-1,Hours),UTC),
    Text(DateAdd(dpkTo.SelectedDate,1,Days),UTC)).value));

     

    which was returning single record eventhough if we morethan 1 Name in collectionA.Name.

  • rsaikrishna Profile Picture
    3,703 on at

    @BKGOUD 

     

    In your ForAll, you are using ClearCollect which is clearing the collection for every item in collectionA.Name loop.

     

    You may need to use Collect in the place of ClearCollect.

     

    Give a try and let me know if this helps.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted SolutionMarking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
  • BKGOUD Profile Picture
    95 on at

    Hi @rsaikrishna ,

     

    I have tried by removing Clear but no luck.

    We have multiple names with corresponding ID.

    collectionA: 

    NameID
    ABC001
    XYZ002

     

    collectionB: 

    NameID
    ABC001
    XYZ002

     

    ForAll(collectionA.Name,

    Collect(collectionX ,Filter(Office365Outlook.GetEventsCalendarViewV2(
    LookUp(collectionY,Name in collectionB.Name).ID// Here im using LookUp and returns same ID eachtime. 
    Text(DateAdd(dpkFrom.SelectedDate,-1,Hours),UTC),
    Text(DateAdd(dpkTo.SelectedDate,1,Days),UTC)).value));

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 405 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 368

#3
WarrenBelz Profile Picture

WarrenBelz 244 Most Valuable Professional

Last 30 days Overall leaderboard