Skip to main content
Nintex Community Menu Bar

Count items within a collection

  • Jul 28, 2017 9:40 AM UTC
  • 7 replies
  • 25 views
  • Translate All

Forum|alt.badge.img+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

Forum|alt.badge.img+16

can you not use collection operation - count?

Translate

Forum|alt.badge.img+16

Forum|alt.badge.img+10
  • Author
  • Nintex Partner
  • Jul 28, 2017 9:54 AM UTC

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

Translate

Forum|alt.badge.img+13
  • Novice
  • Jul 28, 2017 11:10 AM UTC

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

Translate

Forum|alt.badge.img+10
  • Author
  • Nintex Partner
  • Jul 28, 2017 12:15 PM UTC

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

Translate

Forum|alt.badge.img+13
  • Novice
  • Jul 28, 2017 12:51 PM UTC

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.

Translate

Forum|alt.badge.img+10
  • Author
  • Nintex Partner
  • Jul 28, 2017 1:10 PM UTC

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

Translate