Skip to main content
18-Opal
December 21, 2023
Solved

Search in GRID is Missing in 9.3.6 Version

  • December 21, 2023
  • 2 replies
  • 1560 views

Hi,

 

I have been using the Advance Grid in the previous Dashboards. As of now, I have replaced it with the GRID of the PTC Thingworx Version 9.3.6.

 

However, the End user is using the search functionality in Advance Grid, which is not present in the present GRID widget. Do we have any workaround?

 

Thanks,

Best answer by pshashipreetham

Hi,

 

After lot of workarounds and debugging there was no way have a search functionality in the Grid of latest version which 9.3.8. As @Rocko suggested, I ended do the same. Below is code if Some want to reuse it.

//Infotable --> Input Parameyter

let result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
 infoTableName: "InfoTable",
 dataShapeName: "DataShapeName"
});

try
{
 let query = {
 	"filters": {
 		"type": "OR",
 		"filters": [{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen1",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen2",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen3",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen4",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen5",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen6",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen7",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen8",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen9",
 				"value": "*" + SearchKey + "*"
 			}
 
 		]
 	}
 };

 let params = {
 t: Infotable /* INFOTABLE */,
 query: query /* QUERY */
 };
 result = Resources["InfoTableFunctions"].Query(params);
}
catch(e)
{
 result = Infotable;
 logger.error("ThingName >>> ServiceName >>> Error: "+e+" LineNumber:"+e.lineNumber);
}


 

Thanks @Rocko for your responses and help.

 

Thanks,

2 replies

Rocko
19-Tanzanite
December 21, 2023

If you need a search over all columns and not just filtering, you could use a text widget where you enter the search term and pass that to the service that delivers you the infotable shown in the grid. In that service you could then use Resources["InfoTableFunctions"].Query to query all columns for the search term and return only the matching ones.

18-Opal
December 21, 2023

Hi @@Rocko ,

 

We can do that, but why Search functionality is removed? I have 22 mashups, where Users are using these functionalities, if this is removed suddenly, we are in trouble.

 

Thanks,

Rocko
19-Tanzanite
December 22, 2023

It was not removed - Grid is a different widget than Advanced Grid. You can use Advanced Grid, it is still supported.

If you want/need Search in Grid, post it as an Idea in the relevant group and/or ask PTC support about its status. Maybe it's on the roadmap already, but if not, make sure it gets there.

pshashipreetham18-OpalAuthorAnswer
18-Opal
December 22, 2023

Hi,

 

After lot of workarounds and debugging there was no way have a search functionality in the Grid of latest version which 9.3.8. As @Rocko suggested, I ended do the same. Below is code if Some want to reuse it.

//Infotable --> Input Parameyter

let result = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape({
 infoTableName: "InfoTable",
 dataShapeName: "DataShapeName"
});

try
{
 let query = {
 	"filters": {
 		"type": "OR",
 		"filters": [{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen1",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen2",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen3",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen4",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen5",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen6",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen7",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen8",
 				"value": "*" + SearchKey + "*"
 			},
 			{
 				"type": "LIKE",
 				"fieldName": "DataShapeColumen9",
 				"value": "*" + SearchKey + "*"
 			}
 
 		]
 	}
 };

 let params = {
 t: Infotable /* INFOTABLE */,
 query: query /* QUERY */
 };
 result = Resources["InfoTableFunctions"].Query(params);
}
catch(e)
{
 result = Infotable;
 logger.error("ThingName >>> ServiceName >>> Error: "+e+" LineNumber:"+e.lineNumber);
}


 

Thanks @Rocko for your responses and help.

 

Thanks,