nintextrainee
Canvas Initiate

Count number of items in collection


Hello,

I know this is an ultimately easy task but I can't figure out why
I can't initialize my collection to be able to count the number of items
it contains. I will explain more:
I have a checklist of items. The user can check as many as they want.
I created a collection variable colTasks to store the data checked in
the form. Next, I want to count the number of items in colTasks using
the "Collection Operation" action.

My problem is, I can't read the checked data to store inside a collection
variable although it is what is done on the tutorial I'm following.

 

I tried using a "Set Variable" Action to store my colTasks using List Lookup > Current Item > Tasks but colTasks is not visible in the "Set" field...


Am I doing something wrong? Should I use a different approach?

Thanks a lot,
Davis

0 Kudos
Reply
5 Replies
Tarf
Design Canvas Artiste

Re: Count number of items in collection

Hi @nintextrainee,

what does it say when you log your collection variable? Is it empty or does it contain data?
How do you populate the colleciton variable in your workflow? 

0 Kudos
Reply
nintextrainee
Canvas Initiate

Re: Count number of items in collection

I easily created the colTasks variable but I cannot populate it nor can I access it using a "Set Variable" action. It doesn't show on the list of available variables.

0 Kudos
Reply
Tarf
Design Canvas Artiste

Re: Count number of items in collection

Hi @nintextrainee,

usually you populate the collection variable using either query list (where multiple items are returned) or the collection operation.

You wrote "I have a checklist of items. The user can check as many as they want."
How are these items stored? Is your checklist of items a repeating section or multiple form controls? If they are, are they all connected to a list column?

0 Kudos
Reply
nintextrainee
Canvas Initiate

Re: Count number of items in collection

Oh I'm sorry, I'm new to Nintex so I didn't directly understand what you meant.

I used a simple Choice control list column called Tasks with an output view as Checklist.

0 Kudos
Reply
Tarf
Design Canvas Artiste

Re: Count number of items in collection

Hi @nintextrainee,

to store your choices in the collection variable, you can use a regular expression using the "split" operation:

Tarf_0-1592284597637.png

As the choices are stored separated by a comma (and a space) you can split by that and populate your collection in "Store result in"

0 Kudos
Reply