Count of collection variables is not correct. Extra semicolons?


Badge +8

Backstory: I have a list that has a yes/no field for "SLA met".  This is calculated based on the difference in days between another two fields.  If the difference is more than 14 days, the SLA is not met.

Once a week, I have a site workflow that looks at the last 7 days, runs a Query on the list for items where the SLA met field is "Yes" and dumps those into a collection variable "collVarSLAmet".  Also runs a Query on the list where the SLA met field is "No" and dumps those into a collection variable "collVarSLAunmet".

Problem: These collection variables are being counted using a collection operation and saved into "countSLAmet" and "countSLAunmet", respectively.

These collection variables are also being regexp'd into a plain text variable by replacing the semicolons with <br> and saving it to "metSLAitems" and "unmetSLAitems", respectively.

It all seems to be working, except the count is off from the amount of items in the text variable.  Here's the XML log:

As you can see, the count is 11, but the amount of items in the text variable is 9.  However, there are two semicolons at the beginning of the collection variable(7th line from the bottom), I think these are counting as items! 

In the "countSLAmet", the count is 27, but the amount of items in the text variable is 26.  There is one semicolon at the beginning of the collection variable, that I also think is counting as an extra item.

Any ideas?  Why are these extra semicolons happening, and is that the source of the counting error?


9 replies

Badge +16

can you log to history list or email yourself the collection variables in their entirety as soon as you have queried the list to see what they look like and if the semi colon is there then?  What field are you using in your query to add to the collection?

Badge +8

I just added logging directly after querying the list and the semicolons are there. 

For the query to add items to the collection, I run a calculate date action to determine what "7 days ago" is, and storing the result in vDate.  Then I filter the query to select items only when the "SLA Met?" column is equal to "No" (as well as a couple other filters to disregard some other list items).

I've tried it with XML encoding on and off, the semicolons remain.  "Include HTML formatting" and "Specify item limit" are both unchecked.

Badge +16

can you screenshot your query list configuration please?

Badge +8

Here you go, and thanks for your help!

Badge +16

can you try the above and pull the item ID into your collection and see if you still get empty entries?

Badge +8

Cassy, I am no longer getting empty entries using the item ID: the count is 11 and the number of IDs returned was 11 :

The ItemURL field is populated by a simple workflow with one action, that populates a column called ItemURL with the Value (common reference) Item URL.

Badge +16

so you have a couple of entries with that value missing then?

Badge +8

I think that's it, I feel like a bloody idiot.  Thanks for all your help!

Badge +16

any time happy.png

Reply