Theb
Theb

Reputation: 162

How to evaluate true if string contains text?

In an Azure Data Factory pipelin, I need this expression to evaluate true:

@bool(split(item().Name,'provider').Length>1)

For context, item().Name is "provider_file.xlsx". (Thus I expected true)

Here's the error I'm getting:

Failed

{"code":"BadRequest","message":null,"target":"pipeline//runid/f16e4701-950f-4005-88c7-c4afc68b493f","details":null,"error":null}

Upvotes: 0

Views: 8484

Answers (1)

Steve Johnson
Steve Johnson

Reputation: 8660

Array.Length caused this error. You should use length() function to get array's length. This is an expression equivalent to your expression: @greater(length(split(item().name,'provider')),1).

The shortest expression to do this is:@contains(item().name,'provider'). Contains function can be used to check whether can find a substring in a String.

Upvotes: 4

Related Questions