Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X
Hello, i'm trying to query an InfoTable column using multi-input, to illustrate:
My InfoTable data shape is like this : Code(number) , Product(string) & Line (string), the line field contains a lot of numbers seperated by -
I want my JS query to return ligns ending with 922 or 921. the query i wrote is this :
var query = {
"filters": {
"fieldName": "Line",
"type": "LIKE",
"value": criteria
}
};
var params = {
t: me.myProdInfoTable /* INFOTABLE */,
query: query /* QUERY */
};
// result: INFOTABLE
var result = Resources["InfoTableFunctions"].Query(params);
With criteria as my string input. the query works when i put %22 but does not work when i put "%22", "%21". Can anyone help me, thank you
Solved! Go to Solution.
You need and OR condition, or if the infotable it's not big, just iterate on a for loop and check for the desired lines.
To do the or condition it will be something like:
var query = { "filters": { "type": "OR", "filters": [ { "fieldName": "Line", "type": "LIKE", "value": : criteria1 }, { "fieldName": "Line", "type": "LIKE", "value": : criteria2 } ] } };
Hello @i_abidi
Try this query,
var criteria = "*" + YOURINPUT var query = { "filters": { "fieldName": "Line", "type": "LIKE", "value": criteria } };
Thanks,
VR
Still not working, it returns an empty table when it's suppose to return a couple of rows
You need and OR condition, or if the infotable it's not big, just iterate on a for loop and check for the desired lines.
To do the or condition it will be something like:
var query = { "filters": { "type": "OR", "filters": [ { "fieldName": "Line", "type": "LIKE", "value": : criteria1 }, { "fieldName": "Line", "type": "LIKE", "value": : criteria2 } ] } };
Hi @i_abidi.
If one of the previous responses provided an answer to your question, please mark it as the Accepted Solution for the benefit of others who may have the same question.
Regards.
--Sharon