2

I'm having an issue with conditions checking if an array contains a certain value.

I added a debug object to see the values when running. The following is my logic app designer view:

Logic app designer

When running, the condition always evaluates to false.

This is what the run details show:

enter image description here

As seen in the above snippet, the Title 'General' is contained in the 'Array', yet the condition evaluates to false.

Why is this happening?

EDIT: see my answer, was a visual bug with the logic app designer view

Haukland
  • 677
  • 8
  • 25

2 Answers2

1

It was probably a visual bug with the logic app designer view. In code view I saw the following:

enter image description here

I added the rest of the expression and it worked:

enter image description here

Haukland
  • 677
  • 8
  • 25
1

Per my understanding, it is not a bug. In your first screenshot, according to the icon enter image description here the "Title" is not shown as a variable as your mentioned in your answer("@variables('Title')"), so it always return "false" in the "If" condition.

If you want to get "true" result in your first screenshot, you can change the Array to the expression below:

string(variables('Array'))

enter image description here

Hury Shen
  • 14,948
  • 1
  • 9
  • 18
  • I am sorry for adding confusion with my answer. I simply included a variable ´Title´ that has the ´Title´ shown in my screenshot as value. This solved the issue without converting the array to string. I later removed the variable title and used the title in the code view and it still worked. So it must have been a visual bug with the code view. – Haukland Nov 19 '19 at 08:13
  • As you can see from my answer, the right side of the condition was not included at all – Haukland Nov 19 '19 at 08:14
  • @owninggreendragsdude Ok, I see, I just explain a solution for the scene you mentioned in your question at the beginning. As you provided the right solution, could you please mark your answer as "accepted" ? This can be beneficial to other community members, thanks~ – Hury Shen Nov 19 '19 at 08:18