Finding an item in the queue item array

I need to check if an item is in the queue item array. How do I do this without using a loop?

@redanime94 ,

Can you specify what exactly you want to check, whether it is a field value inside queue item or if a field name ?

Regards,

It is a field value inside the queue item

Hi

Get the queue items with GET QUEUE ITEM activity where u can use some filter strategy u need to check whether a queue item is there or not without looping

If the output has some value then it is there in that queue

Cheers @redanime94

@redanime94 ,
Try the following:

Replace the FieldName and ValueToCheck

(from item in QueueItems where item.SpecificContent.ContainsKey("FieldName") andalso item.SpecificContent("FieldName").ToString.Contains("ValueToCheck") select item).Count

Here, if the count is greater than 0, you can confirm that the value is present in the queue items.

Regards,

I am getting this error: ā€œAssign: Expression Activity type ā€˜VisualBasicValue`1ā€™ requires compilation in order to run. Please ensure that the workflow has been compiled.ā€

Check the double quotes, it should be straight instead of the curved ones.

This-> "

Regards,

It workedā€¦ but I am getting a zero result :frowning: is that .ContainsKey(ā€œFieldNameā€) the same value as the .SpecificContent(ā€œFieldNameā€), i.e. say I am looking for a ā€œCustomerNumberā€ then the FieldName in both should be CustomerNumber?

Yeah field name both you should provide the name like ā€œCustomerNumberā€

Regards,

I am getting zero result

This is what I have done:

The arrMatch is looking for the latest run of the itemā€¦

Can you display where you have used the expression ? @redanime94

Regards,

@redanime94 , for example the below shown image the Custom1 is the filed name and the d is the value hence, the expression will be:

(from item in QueueItems where item.SpecificContent.ContainsKey(ā€œCustom1ā€) andalso item.SpecificContent(ā€œCustom1ā€).ToString.Contains(ā€œdā€) select item).Count

image

Regards,

(from item in arrMatch where item.SpecificContent.ContainsKey(ā€œCustNameā€) andalso item.SpecificContent(ā€œCustNameā€).ToString.Contains(ā€œstrCurrentCustNumberā€) select item).Count

image

I guess this is a variable you are passing? if it is then you need to avoid the quote.

Regards,

Hmmm - posting the image I think I know where the error isā€¦ :slight_smile:

1 Like

Yup thatā€™s a variable being passed

1 Like

Itā€™s working now - I am getting a value. Thanks for the help.

1 Like

@redanime94 ,

I hope you got the error fixed, variables should be passed without double quotes.

Regards,

Yup itā€™s working. Thanks for that.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.