How to get queue items reason contains sth

Hi All! I have a item which reference is “LoadData”. I used Get queue items activity. Output is queueItems. I want to check if “LoadData” fail in the last 3 hours 3 times and is it also because the error message contains “Tmld”? I don’t want to use for each activity. How can i do it?

Chatgpt gives me this code, but it doesnt work.

Dim count As Integer = queueItems.Where(Function(x) x.Status = "Failed" AndAlso
                                                   x.ProcessingException IsNot Nothing AndAlso
                                                   x.ProcessingException.Reason IsNot Nothing AndAlso
                                                   x.ProcessingException.Reason.Contains("Tmld")).Count()

Console.WriteLine("Count: " & count)

Its helpful if you are more descriptive with the error.

ChatGPT is a great tool but you need to fill in some gaps. It doesn’t know the properties or data types of a QueueItem so is doing its best to guess.

Here, at least one issue I spot is that you are treating the Status property as a string and searching for “Failed” when it is of the datatype QueueItemStatus (which is an Enum).

You must modify your LINQ query to use the correct data types.