Is an 'item query' possible?


Badge +7

Hi!

I know the action 'list query' which creates a collection of items.

I want to query my current item on some aspects (for example: all empty properties). Is that possible? Maybe through a workaround..

I want a collection of all fields from my item that are empty. Any ideas?

Thank you!

(Nintex 2013)


11 replies

Userlevel 6
Badge +13

There might be a smarter way of doing it (especially for a list with loads of columns) but you could create a collection containing the names of each of your columns, run a for each on this collection and query the current item to see if that field is empty (or whatever you want to query for) and if it is add the name (stored in a variable from your for each) to another collection. If it isn't empty then just move onto the next one.

You should end up with a collection of all the field names that have no value in your current item.

Badge +7

Hi!
Thanks for your answer!
But for creating a collection in the first place I would have to add every single property to the collection? WIth 15 columns I would have to add 15 workflow actions right? :/ I don't like that it isn't possible to add more than one variable to a collection at one time..

Userlevel 6
Badge +13

I did say it wasn't pretty happy.png

The GetListsandView method in the lists.asmx web service can return the schema for the list. This would allow you to get all the columns into the collection in an automated way. It would also cater for any new columns added to the list in the future without you changing the workflow.

https://msdn.microsoft.com/en-us/library/lists.lists.getlistandview(office.12).aspx

Userlevel 6
Badge +13

Was any of this useful to you or do you need another solution?

If it has solved your solution, please mark it as correct.


Thanks

Badge +7

In your first answer you said I should create a collection with all the column names and then query the current item to see if that field is empty? How would I achieve the second part?

Userlevel 6
Badge +13

I think you'd need to use the Query Builder to put your variable as the name of the column you'd like to assess and then assess if that field is empty for the current item. Afraid I have no Nintex access at the moment to be able to illustrate this. Does this help? If not, maybe someone could pick up the baton to demonstrate a way of doing this.

Userlevel 5
Badge +14

I believe Ryan has meant something like this

https://community.nintex.com/message/50338-re-get-originating-field?commentID=50338#comment-50338 

Userlevel 5
Badge +14

the other idea might be that you create calculated field on a list out of fields you need to check. separate single fields by a separator.

that way you will query just one field from the list.

then regular expression action will become your friend.

- either setup a pattern that identifies two or more subsequent separators

- or split read in value into collection by the separator. loop through collection and check single elements for emptiness. if you find at least one, you know you have to take care of the item. if you know what's sequence of original list fields, you can as well identify which one is empty

Userlevel 6
Badge +13

Yes, that!

Thanks

Badge +11

‌, please mark one of the answers correct if they helped you. We really need to close this out so other users can use this if they come across the same problem.

Thanks so much,

Lisa

Badge +7

Here is how I did it:

(I think it may be similar to your ideas, I wasn't able to understand a 100% what you meant sorry!)
1. Regular Expression: Input: all names of the columns, split -> I have a collection of all names of the columns

2. Regular Expression: Input: all contents of the columns (in the same order!), split -> I have a collection of all column contents

3. For each: loop through content collection (the 2.) and store the Index as well

   4. Regular expression: check if column is empty with ^$

   5. if column empty: Collection operation: Get the name of the column (1. collection) with the same index

   6. build string: write column name in a list -> in the end I have a list of all column names that are empty

Thanks for the helping answers!

Reply