Count items within a collection


Badge +10

Hi community,

I have a problem with counting items within a collection (there are three items in that collection), and I am already getting mad about this. I tried three different approaches:

First try (Regular Expression):

206021_pastedImage_1.png

RESULT
colFachabteilungen: ["{""__metadata"":{""type"":""Collection(Edm.String)""}","""results"":[""Fachabteilung 1""


7 replies

Badge +16

can you not use collection operation - count?

Badge +16

just seen you said o365 does this help?http://help.nintex.com/en-US/o365/o365/O365WorkFlow/WorkflowActions-STD/CountItemsinCollection.htm

Badge +10

I used the "Count Items in Collection" object in my first and third try:

206027_pastedImage_2.png

I don't know why it does not work. sad.png

Userlevel 6
Badge +13

If you query the list and be sure to Store Output in separate collection then the COUNT collection will work.

Badge +10

Hi Ryan,

Isn't that what I have done in my "second try"? Ok, I didn't use an extra/separate Count Object here, because the Query List object has a result count for itself. Nevertheless I added the Count Object and received the same number as with the included result count within the Query List object: 1 (see also initial posting "second try").

Cheers

mai-kel

Userlevel 6
Badge +13

Sorry, didn't see that you had used that setting.

Your output doesn't look correct.

[["Fachabteilung 1","Fachabteilung 2","Fachabteilung 3"]]

This is an array inside your collection.

Your collection should look like

["Fachabteilung 1","Fachabteilung 2","Fachabteilung 3"]

I think I've figured out the issue whilst typing this in fact. I'm guessing that Fachabteilungen is a multi select choice column or similar.

This would explain why your query list doesn't work as you're only looking to return a single result that contains 3 values. Not 3 results.

There might be a more elegant way of doing but you could add a regex in to remove the leading [ and trailing ]. This will leave your collection in the correct format to perform operations on.

Badge +10

Hi Ryan,

You are right - it is a multi select choice column.

And with the help of my colleague Jan von Reith‌ I found a solution (I guess the same solution you were refering to):

1. Query list object:

         column into COLL variable

2. Regular expression object:

         String: COLL variable

         String operation: Split

         Pattern: ,

         Output: COLL variable

3. Count Items in COLL object

Cheers

mai-kel

Reply