Value of convert System.Collections.Generic.IEnumerable Cannot be converted to boolean

I want to use the loop. but it said Cannot convert System.Collections.Generic.IEnumerable to boolean. coz the default value is IEnumerable.
how can i fix it?

are you trying to convert it to boolean inside loop?

@mhrez Can you Show us a Screenshot of the Workflow ? And can you tell me what is the Type Argument of For Each and the Type of the Collection?

if you are trying to print the collections then your for each loop argument should be Object/String type
@mhrez
cheers

1 Like

Hi , yes correct. do you know about it?

@Pradeep_Shiv yes i want to convert it to boolean inside loop

try changing it to object Type

image

i want profitCenter to be a boolean. how can i convert it from ienumerable to boolean?

kindly please help @Pradeep_Shiv. thank you

okay

  • so ProfitCenters is collection of type use for each loop and pass this variable and make for each argument type as object
  • now inside for each loop use IF condition like this item.ToString.Contains(“yourKeyWord”)
    this is will return you boolean

Cheers
@mhrez

1 Like

@mhrez - if your profiltCenter - variable is declared as Boolean.
while assigning value to profiltCenter use Convert.ToBoolean(“YOUR STRING”) to convert your value to Boolean.

2 Likes