cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
BKGOUD
Helper III
Helper III

Using forall to collect the data

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.

 

4 REPLIES 4
rsaikrishna
Dual Super User
Dual Super User

@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.

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.

@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.

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));

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Are Your Ready?

Test your skills now with the Cloud Skill Challenge.

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Top Solution Authors
Top Kudoed Authors
Users online (44,441)