简体   繁体   中英

Azure Logic App Sql Connector

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!

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.

$ 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. 在此处输入图片说明

Solution


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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM