cancel
Showing results for 
Search instead for 
Did you mean: 
andreapasutti
Nintex Newbie

Determine if Collection Variable is Blank

Jump to solution

Hello! I've been using Nintex for about 6 months and I'm looking for a way to determine if a collection variable is blank. My workflow has a state machine with different review paths based on department (Finance, Legal, Biz Unit). For each state, I have a query that pulls all reviewers from a contact list (people picker field) based on their department and adds them to a collection. I use the collection in the "To" field of the notification so all reviewers are sent the same task. If there are no reviewers for a particular review state, I want it to skip the notification and go to the next state. I have a condition that evaluates the collection variable (if the variable is blank, go to the next state; if the variable is not blank, send them the notification). It seemed like the simplest approach, but because the collection separates the contents with a semicolon, the collection is never blank. I'm thinking this isn't the best approach after all.

What is the best way to change state based on whether there are reviewers? Is there a way to evaluate a collection and ignore the semicolons? Even when I use the collection operation to count a collection that has no contacts in it, it counts the semicolons.

0 Kudos
Reply
5 Replies
Highlighted
soni_tumu
Nintex Newbie

Re: Determine if Collection Variable is Blank

Jump to solution

Hello Andrea,

While you are querying, can you use filter and pull only if To address is not empty??

View solution in original post

Reply
Automation Master
Automation Master

Re: Determine if Collection Variable is Blank

Jump to solution

Hi Andrea Pasutti,

After the Query action, use Collection Operation. Select the output collection from your query and select count. Store the result in a number variable. Then check if the count > 0. Hope that helps.

Reply
andreapasutti
Nintex Newbie

Re: Determine if Collection Variable is Blank

Jump to solution

I tried that, but it looked like it counted the semicolons. Perhaps I didn't configure my Collection Operation correctly. I will take another look at that.

Reply
andreapasutti
Nintex Newbie

Re: Determine if Collection Variable is Blank

Jump to solution

Ah! Yes, I see what you are saying.

To clarify my issue:

My query is pulling from a contact list and each contact is a line item in the list. Each line item includes the Contact (people picker), department, biz unit, etc., so I can customize my query and get exactly the right person in the workflow. My problem is that if someone deletes a name from the contact field, maybe because the person left the company and they haven't identified a replacement yet, the query pulls a blank value, which gets separated by a semicolon. Easy solution is to delete the line item, but my user does not want to recreate the line items each time. So to get around querying a blank field, I could try adding an extra filter in my query to only include line items when the contact field is not null (since "empty" isn't an option). I'll let you know how that works out.

Reply
andreapasutti
Nintex Newbie

Re: Determine if Collection Variable is Blank

Jump to solution

I added another criteria to my query.

Role = Legal

AND

Contact = Is Not Null

That skipped the blank line item. Nice and super simple.

0 Kudos
Reply