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

Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X

ThingWorx custom extension service parameter of type InfoTable

kbuss
6-Contributor

ThingWorx custom extension service parameter of type InfoTable

Hello,

 

Currently I´m facing some issues writing a custom Java Extension that has a service with a parameter of type InfoTable.

The Service parameter is annotated like this:

@ThingworxServiceParameter(name = "param", description = "", baseType = "INFOTABLE", aspects = {"isEntityDataShape:true", "dataShape:TestDataShape" }) InfoTable param

 

Here the baseType is set to "InfoTable" and in the aspects array a DataShape is pointed that exists on the ThingWorx platform.

 

When I try to execute the Service interactively and want to enter the parameter values I get the following message: 

NoDatashape.png

I am using ThingWorx 8.4.5-b102 and I am pretty sure this has been working with ThingWorx 7.4.

 

Has anybody any adivce or can reproduce this issue?

 

Thanks,

Keijo

1 ACCEPTED SOLUTION

Accepted Solutions
slangley
23-Emerald II
(To:sburton-3)

Hi @sburton-3.

 

It appears we have a fix coming for this issue in the 9.0 release.  The target date for 9.0 is June (but is subject to change).

 

However, a workaround is to use the AddStreamEntries service in a custom service.  This way you can define your infotable with the data shape needed to pass to the service.

 

Regards.

 

--Sharon

View solution in original post

7 REPLIES 7

Hi Keijo,

 

Can you try to remove the "isEntityDataShape:true" aspect ?

 

sburton-3
3-Visitor
(To:kbuss)

I have the same issue using an INFOTABLE as a configuration item on a custom ThingTemplate from an extension I have created. 

 

Since I have also seen this error come up with some of the out of the box services on other Thingworx objects, I believe that this a bug in the Thingworx Composer on Thingworx 8.4.x (I do not see this on version 8.2 in the old Composer) where any popup requiring a DataShape definition does not seem to correctly retrieve that definition, even though a DataShape is defined.

slangley
23-Emerald II
(To:sburton-3)

Hi @kbuss and @sburton-3.

 

Can you each provide your extensions so we can test it here? We may need your source as well.  You can send this under private email.

 

Also, for the out-of-the-box services you're seeing this with under 8.4, please provide a list.

 

Regards.

 

--Sharon

I was able to work around the issue by exposing the INFOTABLE as a Property on the Thing rather than as a Configuration item. 

 

In other words this doesn't work as expected ...

@ThingworxFieldDefinition(name = "MessageHeaderProperties", description = "", baseType = "INFOTABLE", ordinal = 0, aspects = { "isEntityDataShape:true", "dataShape:CAT.ServiceBus.CustomHeaders.DS" })

 

Yet this does ...

@ThingworxPropertyDefinition(name = "MessageHeaderProperties", description = "", category = "Configuration", baseType = "INFOTABLE", isLocalOnly = false, aspects = {
"isPersistent:true", "dataChangeType:OFF", "isEntityDataShape:true",
"dataShape:CAT.ServiceBus.CustomHeaders.DS" }),

 

In terms of the out of the box services - we were seeing the same issue with AddStreamEntries() on a Stream that was using InfluxDB as a persistence provider. However, when we downgraded Influx to a slightly older version at the request of PTC tech support, this issue appears to have resolved itself.

I actually found where the error was occurring in the out-of-the-box services too. It wasn't quite where I remembered it to be ...

 

If you have a Stream object (it seems that this is true for PostgreSQL streams as well as InfluxDB streams), and try to execute the AddStreamEntries() service you are required to provide an INFOTABLE of values to add. If you click the parameter to add entries you get the dialog shown in AddStreamEntries1.jpg. If I click the + to add the data, I get the dialog shown in AddStreamEntries2.jpg where it is indicating that the actual value data does not have a DataShape which is incorrect. This seems to be related to the INFOTABLE of values being inside another data shape.

 

For configurations on a Thing - the same is true - the whole configuration page is driven by a DataShape, and the individual configuration items are just entries in that DataShape. Thingworx Composer seems unable to process those nested DataShapes correctly.

 

If you look at the Java code below for a dummy configuration item in a Thingtemplate extension you will see the DataShape that defines the configuration table ... I think that the fact you have an INFOTABLE with a DataShape inside another table with a DataShape is not being parsed properly by the Composer.

 

@ThingworxConfigurationTableDefinitions(tables = {
@ThingworxConfigurationTableDefinition(name = "Test", description = "", isMultiRow = false, ordinal = 0, dataShape = @ThingworxDataShapeDefinition(fields = {
@ThingworxFieldDefinition(name = "ConfigItem", description = "", baseType = "INFOTABLE", ordinal = 0, aspects = {
"isEntityDataShape:true", "dataShape:CAT.ServiceBus.MessageHeaders.DS" }) })) })

 

We are running Thingworx 8.4.8 on our servers.

slangley
23-Emerald II
(To:sburton-3)

Hi @sburton-3.

 

It appears we have a fix coming for this issue in the 9.0 release.  The target date for 9.0 is June (but is subject to change).

 

However, a workaround is to use the AddStreamEntries service in a custom service.  This way you can define your infotable with the data shape needed to pass to the service.

 

Regards.

 

--Sharon

slangley
23-Emerald II
(To:slangley)

Hi @sburton-3.

 

ThingWorx 9.0 has just released.

 

If you feel this post has now been answered, please mark this response as the Accepted Solution for the benefit of others with the same question.

 

Regards.

 

--Sharon

Top Tags