Kenny_I
Kenny_I

Reputation: 2523

Why Setting variable in Azure Data Factory fails? - string character '\"' is not expected

I have simple Lookup and Variable, but it fails.

I get strange error "string character '"' at position '16' is not expected". However I have not included '"' charactor to variable. I wonder what is wrong.

Lookup: Query:

SELECT COUNT(1) As 'RowCount' from [SalesLT].[Customer]

Set Variable1: Add Dynamic content:

@string(activity('Lookup1').output.firstrow.RowCount)

Error

 {"error":{"code":"BadRequest","message":"ErrorCode=InvalidTemplate, ErrorMessage=The 
 expression 'string(activity(\"Lookup1\").output.firstrow.rowcount)' is not valid: the string 
 character '\"' at position '16' is not 
 expected.\"","target":"pipeline/pipeline1/runid/89b3ca4f-83dc-4a55-9fe9    - 
c4e867f9cdba","details":null}} 

enter image description here

Upvotes: 1

Views: 656

Answers (1)

KarthikBhyresh-MT
KarthikBhyresh-MT

Reputation: 5044

You just have to use the array method, try below to set to variable.

@string(activity('Lookup1').output.value[0].RowCount)

enter image description here

With configurations as:

enter image description here

And lookup output:

enter image description here

Upvotes: 1

Related Questions