cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

errors when using filter query

xiaoqw
15-Moonstone

errors when using filter query

var query = 
{
    "filters": {
        "type": "EQ",
        "fieldName": "Kategory",
        "value": "Quality"
    }
}; 

data shape.pngdata table.pngnot found.png

here is a question for using query filter. when I custom the service, there is an error appearing in the result. Could Someone can help me to fix this problem and what is the output should I choose. Now I chose "STRING"
"

1 ACCEPTED SOLUTION

Accepted Solutions

I see that you are trying to query a DataShape type entity. I would try creating an infotable from the Datashape.

var params = {
    infoTableName : "InfoTable",
    dataShapeName : "InputYourDatashapeNameHere"
};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(TestDS)
var inputforFilter = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

Populate the created Infotable with the values you would like to filter/query upon. Use the EQFilter to query the infotable as below.

var filterparams = {
	fieldName: "Kategory" /* STRING */,
	isCaseSensitive: false /* BOOLEAN */,
	t: inputforFilter /* INFOTABLE */,
	value: "Quality" /* STRING */
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].EQFilter(filterparams);

The output of the service should be an infotable with the same datashape that you are querying on. Please let me know if you run into any issues. 

View solution in original post

1 REPLY 1

I see that you are trying to query a DataShape type entity. I would try creating an infotable from the Datashape.

var params = {
    infoTableName : "InfoTable",
    dataShapeName : "InputYourDatashapeNameHere"
};

// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(TestDS)
var inputforFilter = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);

Populate the created Infotable with the values you would like to filter/query upon. Use the EQFilter to query the infotable as below.

var filterparams = {
	fieldName: "Kategory" /* STRING */,
	isCaseSensitive: false /* BOOLEAN */,
	t: inputforFilter /* INFOTABLE */,
	value: "Quality" /* STRING */
};

// result: INFOTABLE
var result = Resources["InfoTableFunctions"].EQFilter(filterparams);

The output of the service should be an infotable with the same datashape that you are querying on. Please let me know if you run into any issues. 

Top Tags