cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
simms7400
Level 8

Concurrent Function not working

Hi Folks -
 
I have multiple collections rendering during the "OnStart" of my PowerApps applications. I'd like to employ the Concurrent function to speed up the startup however having a bear of a time getting it to validation. Here is what I have, perhaps I need to rewrite my ClearCollection functions??
 
Concurrent(
ClearCollect(
ListActParentList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Name"
)
),

Collect(
ListActParentList,
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Name"
)
),

Collect(
ListActParentList,
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value.Value <> "Terminated"
),
"Name"
)
),

ClearCollect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Alias"
)
),

Collect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Alias"
)
),

Collect(
ListActParentAliasList,
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value <> "Terminated"
),
"Alias"
)
),

ClearCollect(
DevicePlatformList,
ShowColumns(
Filter(
rdDevice,
RequestStatus.Value = "Published" && !(PortfolioStatus.Value="Terminated")
),
"Alias"
)
),

ClearCollect(
PartnershipList,
ShowColumns(
Filter(
rdPartnership,
!(PortfolioStatus.Value="Terminated")
),
"Parent_Node", "Parent_Alias","Name","Alias"
)
)
)
Thank you!
1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Concurrent Function not working

Hi @simms7400 ,

Please consider modify your formula as below:

Clear(ListActParentList);               /* <-- Add formula here */
Clear(ListActParentAliasList);            /* <-- Add formula here */
Clear(DevicePlatformList); /* <-- Add formula here */
Clear(PartnershipList); /* <-- Add formula here */
Concurrent(
Collect(
ListActParentList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Name"
),
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Name"
),
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value.Value <> "Terminated"
),
"Name"
)
),
Collect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Alias"
),
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Alias"
),
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value &lt;&gt; "Terminated"
),
"Alias"
)
),
Collect(
DevicePlatformList,
ShowColumns(
Filter(
rdDevice,
RequestStatus.Value = "Published" && Not(PortfolioStatus.Value="Terminated")
),
"Alias"
)
),
Collect(
PartnershipList,
ShowColumns(
Filter(
rdPartnership,
Not(PortfolioStatus.Value="Terminated")
),
"Parent_Node", "Parent_Alias","Name","Alias"
)
)
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
8 REPLIES 8
lucia
Level 8

Re: Concurrent Function not working

Hey,

 

The Concurrent function evaluates multiple formulas at the same time. 

 

The ClearCollect function deletes all the records from a collection and then adds a different set of records to the same collection. With a single function, ClearCollect offers the combination of Clear and then Collect.

 

So as I have noticed you ClearCollect to the same collection - ListActParentList. 

 

Hope this helps.

simms7400
Level 8

Re: Concurrent Function not working

Thank you! Those are from the same data sources. I ClearCollect then collect the others from same source.
lucia
Level 8

Re: Concurrent Function not working

Hey,

 

You can't predict the order in which formulas within the Concurrent function start and end evaluation.

Community Support Team
Community Support Team

Re: Concurrent Function not working

Hi @simms7400 ,

Based on the formula that you mentioned, I think there is something wrong with it.

 

Within the Concurrent formula you provided, you could not determine the execution order of ClearCollect function and Collect function. All formulas within Concurrent function would be executed at the same time.

 

I have made a test on my side, please consider modify your formula as below:

 

Clear(ListActParentList);               /* <-- Add formula here */
Clear(ListActParentAliasList);            /* <-- Add formula here */
Clear(DevicePlatformList); /* <-- Add formula here */
Clear(PartnershipList); /* <-- Add formula here */
Concurrent(
Collect(
ListActParentList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Name"
)
),
Collect(
ListActParentList,
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Name"
)
),
Collect(
ListActParentList,
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value.Value <> "Terminated"
),
"Name"
)
),
Collect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Alias"
)
),
Collect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Alias"
)
),
Collect(
ListActParentAliasList,
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value &lt;&gt; "Terminated"
),
"Alias"
)
),
Collect(
DevicePlatformList,
ShowColumns(
Filter(
rdDevice,
RequestStatus.Value = "Published" && Not(PortfolioStatus.Value="Terminated")
),
"Alias"
)
),
Collect(
PartnershipList,
ShowColumns(
Filter(
rdPartnership,
Not(PortfolioStatus.Value="Terminated")
),
"Parent_Node", "Parent_Alias","Name","Alias"
)
)
)

 

Please consider take a try with above solution, check if the issue is solved.

 

Best regards,

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
simms7400
Level 8

Re: Concurrent Function not working

@v-xida-msft  Hi -

 

Thank you for your help! Getting closer, but still an issue.  For some reason it doesn't like more than 1 collection named the same... Any ideas?

 

hmmmm.jpg

lucia
Level 8

Re: Concurrent Function not working

Formulas within the Concurrent function shouldn't contain dependencies on other formulas within the same Concurrent function, and PowerApps shows an error if you try. From within, you can safely take dependencies on formulas outside the Concurrent function because they will complete before the Concurrent function starts. Formulas after the Concurrent function can safely take dependencies on formulas within: they'll all complete before the Concurrent function finishes and moves on to the next formula in a chain (if you use the ;operator). Watch out for subtle order dependencies if you're calling functions or service methods that have side effects.

You can chain formulas together with the ; operator within an argument to Concurrent. For example, Concurrent( Set( a, 1 ); Set( b, a+1 ), Set( x, 2 ); Set( y, x+2 ) ) evaluates Set( a, 1 ); Set( b, a+1 ) concurrently with Set( x, 2 ); Set( y, x+2 ). In this case, the dependencies within the formulas are fine: a will be set before b, and x will be set before y

 

Basically you are having dependecies and you cannot access the collection by 2 foemulas at once.

Community Support Team
Community Support Team

Re: Concurrent Function not working

Hi @simms7400 ,

Please consider modify your formula as below:

Clear(ListActParentList);               /* <-- Add formula here */
Clear(ListActParentAliasList);            /* <-- Add formula here */
Clear(DevicePlatformList); /* <-- Add formula here */
Clear(PartnershipList); /* <-- Add formula here */
Concurrent(
Collect(
ListActParentList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Name"
),
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Name"
),
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value.Value <> "Terminated"
),
"Name"
)
),
Collect(
ListActParentAliasList,
ShowColumns(
Filter(
RD_Investment_List,
Portfolio_Status <> "Terminated"
),
"Alias"
),
ShowColumns(
Filter(
RD_Target_List,
Portfolio_Status <> "Terminated"
),
"Alias"
),
ShowColumns(
Filter(
rdPlatIntInfa,
Portfolio_Status.Value &lt;&gt; "Terminated"
),
"Alias"
)
),
Collect(
DevicePlatformList,
ShowColumns(
Filter(
rdDevice,
RequestStatus.Value = "Published" && Not(PortfolioStatus.Value="Terminated")
),
"Alias"
)
),
Collect(
PartnershipList,
ShowColumns(
Filter(
rdPartnership,
Not(PortfolioStatus.Value="Terminated")
),
"Parent_Node", "Parent_Alias","Name","Alias"
)
)
)

 

Please take a try with above solution, check if the issue is solved.

 

Best regards,

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
simms7400
Level 8

Re: Concurrent Function not working

That worked perfectly!! Thank you!!

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 40 members 4,886 guests
Please welcome our newest community members: