Reputation: 13
I am working on Logic App that pulls CDC Data from SQL Server Db. I am using Get Rows operation but the problem comes in when I try to use the Filter Query parameter.
code eq '793'
(works)__$operation eq '2'
(Not working)@{string('__$operation')} eq '2'
(Not working)I think the problem might be with the "$" character.
Error message
{
"status": 400,
"message": "Syntax error at position 12 in '__$operation eq '2'' "
}
Can someone please help me!
Upvotes: 1
Views: 1071
Reputation: 1579
$
is a reserved character according to OData Normative, you should percent-encoding it before the URI is formed. Unfortunately, I tried percent encoding and still get syntax error, seems it's not allowed in Filter Query.
Here is the solution, in Logic App you cannot use %
in Filter Query, so you can't use %24
for $
, instead you should use _x0024_
.I can successfully get the result now:
Note there are three _
at the beginning. You can use this pattern if you have other special characters in field/column name. For example, if the field name is Display Name
which has a space character in between, then in Filter Query, you need to convert it to Display_0x0020_Name
For more details about this encoding, please refer to Encode and Decode XML Element and Attribute Names and ID Values
Upvotes: 0
Reputation: 27815
I am using Get Rows operation but the problem comes in when I try to use the Filter Query parameter.
I think the problem might be with the "$" character.
Based on my test, if the field/column contains $
(or __
) and use that field in Filter Query, which works fine.
But if I define the field as __$operation
that starts with __$
, which will cause the same issue when I use it in Filter Query. So if possible, you can try to modify the column name in your SQL database.
Upvotes: 0