I need to check if an item is in the queue item array. How do I do this without using a loop?
Can you specify what exactly you want to check, whether it is a field value inside queue item or if a field name ?
It is a field value inside the queue item
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
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.
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.
It worked… but I am getting a zero result 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”
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
@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
(from item in arrMatch where item.SpecificContent.ContainsKey(“CustName”) andalso item.SpecificContent(“CustName”).ToString.Contains(“strCurrentCustNumber”) select item).Count
I guess this is a variable you are passing? if it is then you need to avoid the quote.
Hmmm - posting the image I think I know where the error is…
Yup that’s a variable being passed
It’s working now - I am getting a value. Thanks for the help.
I hope you got the error fixed, variables should be passed without double quotes.
Yup it’s working. Thanks for that.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.