Retrieved SharePoint list items count

%3CLINGO-SUB%20id%3D%22lingo-sub-67440%22%20slang%3D%22en-US%22%3ERetrieved%20SharePoint%20list%20items%20count%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67440%22%20slang%3D%22en-US%22%3E%3CP%3EI%20have%20a%20flow%20which%20retrieves%20list%20items%20from%20a%20SharePoint%20list%20by%20passing%20a%20odata%20filter%20query%20(for%20eg%20Status%20eq%20'Draft').%26nbsp%3BIs%20there%20a%20way%20to%20identify%20the%20count%20of%20the%20retrieved%20items%20and%20then%20use%20it%20in%20the%20next%20step%20%3F%20I%20see%20that%20the%20correct%20values%20are%20being%20retrieved%20when%20I%20see%20the%20flow%20execution%20log.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThere%20seems%20no%20way%20to%20get%20the%20count%20of%20items%20though%20!!%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-67440%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EMicrosoft%20Flow%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESharePoint%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-68216%22%20slang%3D%22en-US%22%3ERe%3A%20RE%3A%20Retrieved%20SharePoint%20list%20items%20count%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-68216%22%20slang%3D%22en-US%22%3E%3CP%3EYes%20I%20was%20using%20the%20Get%20items%20action.%20Thanks%20it%20worked%20%3A)%3C%2Fimg%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThis%20has%20just%20given%20me%20a%20pointer%20to%20explore%20Logic%20app-WDL%20code%20more%20and%20how%20to%20use%20it%20in%20Flow%20!!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-67890%22%20slang%3D%22en-US%22%3ERE%3A%20Retrieved%20SharePoint%20list%20items%20count%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-67890%22%20slang%3D%22en-US%22%3E%3CP%3Eyes.%20if%20the%20SharePoint%20action%20you%20are%20using%20is%20Get%20Items%2C%20let's%20say%20you%20name%20it%20%22GetMyItems%22%2C%20you%20can%20store%20the%20following%20Logic%20App%20(WDL)%20code%20%40length(body('GetMyItems')%3F%5B'value'%5D).%20You%20can%20read%20my%20blog%20post%20%3CA%20href%3D%22https%3A%2F%2Fsergeluca.wordpress.com%2F2017%2F04%2F26%2Fusing-the-azure-logic-apps-workflow-definition-language-in-microsoft-flow-part-1%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsergeluca.wordpress.com%2F2017%2F04%2F26%2Fusing-the-azure-logic-apps-workflow-definition-language-in-microsoft-flow-part-1%2F%3C%2FA%3E%20(see%20the%20last%20part).%3C%2FP%3E%3CP%3EStore%20%22%3CSPAN%3E%40length(body('GetMyItems')%3F%5B'value'%5D)%22%20in%20a%20Compose%20action%20and%20reuse%20the%20compose%20action%20output%20where%20you%20want%20(don't%20forget%20the%20double%20quotes%20around%20the%20whle%20expression)%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3EHope%20this%20helps.%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ECheers%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%3CSPAN%3ESerge%20Luca%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E
Contributor

I have a flow which retrieves list items from a SharePoint list by passing a odata filter query (for eg Status eq 'Draft'). Is there a way to identify the count of the retrieved items and then use it in the next step ? I see that the correct values are being retrieved when I see the flow execution log.

 

There seems no way to get the count of items though !!

2 Replies

yes. if the SharePoint action you are using is Get Items, let's say you name it "GetMyItems", you can store the following Logic App (WDL) code @length(body('GetMyItems')?['value']). You can read my blog post https://sergeluca.wordpress.com/2017/04/26/using-the-azure-logic-apps-workflow-definition-language-i... (see the last part).

Store "@length(body('GetMyItems')?['value'])" in a Compose action and reuse the compose action output where you want (don't forget the double quotes around the whle expression)

 

Hope this helps.

Cheers

Serge Luca

Yes I was using the Get items action. Thanks it worked :)

 

This has just given me a pointer to explore Logic app-WDL code more and how to use it in Flow !!

 

Cheers