Community Tip - Have a PTC product question you need answered fast? Chances are someone has asked it before. Learn about the community search. X
There is a DataTable as below. How to get rows containing "%" ?
ID | Value |
---|---|
1
|
%1
|
2
|
2?
|
3
|
*
|
4
|
+1
|
In above case, should be the 1st row.
Because % is a wildcard in Thing Query, how should I escape it?
Same question for ? and *.
Solved! Go to Solution.
Try the following code to just return the "%1" line
var query = { "filters": { "fieldName": "value", "type": "LIKE", "value": "\\u0025" + "1" } }; var params = { query: query /* QUERY */ }; // result: INFOTABLE dataShape: "undefined" var result = me.QueryDataTableEntries(params);
The % is unescaped into \\u0025 to reflect the hex number of the character
https://www.ascii.cl/htmlcodes.htm
For me it returned only this one row out of
%1
2?
*
+1
11
12
21
22
Try the following code to just return the "%1" line
var query = { "filters": { "fieldName": "value", "type": "LIKE", "value": "\\u0025" + "1" } }; var params = { query: query /* QUERY */ }; // result: INFOTABLE dataShape: "undefined" var result = me.QueryDataTableEntries(params);
The % is unescaped into \\u0025 to reflect the hex number of the character
https://www.ascii.cl/htmlcodes.htm
For me it returned only this one row out of
%1
2?
*
+1
11
12
21
22
check Unicode List (0000-0FFF) from here
https://ja.wikipedia.org/wiki/Unicode%E4%B8%80%E8%A6%A7_0000-0FFF
The Unicode marking method also works for below characters. It should be a common way for all characters.
# $ ^