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

Community Tip - Want the oppurtunity to discuss enhancements to PTC products? Join a working group! X

Why we can't pass the infotable as input in Expression and validator thingworx.

Hrishab108
8-Gravel

Why we can't pass the infotable as input in Expression and validator thingworx.

Why can't we pass the infotable as input in expression and validator.

 

1 ACCEPTED SOLUTION

Accepted Solutions
TonyZhang
13-Aquamarine
(To:Hrishab108)

Hi @Hrishab108 

 

I don't have an official answer to why this is the case, probably because for expression and validator, the JS code are executed at client side instead of ThingWorx server side, infotable is a type introduced by ThingWorx rather than in native JS, which means it's not supported by browser or web workers.

Is there a reason why you want to pass infotable to expression or validator instead of using a JS service in ThingWorx?

As a workaround, you can convert infotable to JSON using ToJSON() snippet and pass JSON as input to expression and validator.

TonyZhang_0-1686020463825.png

Hope that helps.

 

View solution in original post

4 REPLIES 4
TonyZhang
13-Aquamarine
(To:Hrishab108)

Hi @Hrishab108 

 

I don't have an official answer to why this is the case, probably because for expression and validator, the JS code are executed at client side instead of ThingWorx server side, infotable is a type introduced by ThingWorx rather than in native JS, which means it's not supported by browser or web workers.

Is there a reason why you want to pass infotable to expression or validator instead of using a JS service in ThingWorx?

As a workaround, you can convert infotable to JSON using ToJSON() snippet and pass JSON as input to expression and validator.

TonyZhang_0-1686020463825.png

Hope that helps.

 

The request is really good though, because it would alleviate the need to use Server-side services in many situations when you just need to find a row in an infotable that has been already sent client side, or sort an existing infotable. As an example, the reason we have the old infotableselector widget is because it provides all these capabilities client-side, without the need to overload the server with really small operations like these

 

@VladimirRosu agreed. I found this has been requested earlier via Jira PSPT-6897 back in 2019.  It says making the infotable selector extension a part of the platform is in a future roadmap but it appears it's still not realized. Not sure what's the current situation now. Maybe customer can raise this idea in https://community.ptc.com/t5/ThingWorx-Ideas/idb-p/thingworxideas 

nmutter
14-Alexandrite
(To:TonyZhang)

There was an idea regarding counting of infotable rows in the mashup: https://community.ptc.com/t5/ThingWorx-Ideas/New-widget-to-count-infotable-rows-on-the-client-side/idi-p/625395 which is on "No Plans to Implement".

We also created our own widget for counting and made it available here: https://github.com/doubleSlashde/InfotableInspectorWidgetTWX

 

But maybe creating a new thingworx-idea for this topic to allow expression/validators to also support InfoTables would be more likely to be implemented officialy. Still, there will be duplicate expressions like "count rows" (needed in multiple places) but at least it would be possible with inbuild functionality and would (hopefully) not be too much effort on PTC side to allow. Worth a try I guess..

Top Tags