Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X
First formalities:
I'm using Thingworx 7.1 with the KEPServerEX extension to connect to a KEPServer instance. Sorry this is a long post, but giving as much info as possible!
I've created a mashup to browse the groups and tags available on a KEPServerEX instance using the given 'BrowseItems' and 'BrowseGroups' services available with the 'RemoteKEPServerEXThing' Thing Template. I've bound 'All Data' from their returns to 2 grid widgets, 1 for BrowseGroups and 1 for BrowseItems. I created a helper Thing to assist with navigation on the mashup and whatever other services I need to write. I know that this functionality is working.
I want to add functionality that allows you to multiselect tags from the BrowseItems grid and use the AddItems service to attach them to my KEPServer Thing in Thingworx.
Figure: Left grid displays the results of 'BrowseGroups', Right grid displays the results of 'BrowseItems'.
For some reason, I'm not able to directly use Connections in mashup builder to connect data from 'SelectedRow(s)' from BrowseItems to the 'Parameters' for AddItems.
So I've tried writing a service on the helper Thing to accomplish this. My problem is that although running the service seems to execute as it's supposed to, the Application log is flooded with Errors that say:
An Invalid Property Value Was Sent To [KEPServerEXthing Property: [null]
where KEPServerEXthing is the Thing that the AddItems service is executed on. If I go into "Manage Bindings" in Properties on the KEP Thing and add the tags as Properties, it won't let me save the KEP Thing and gives this error:
Then if I go into Manage Bindings again (without cancelling the Thing edit) multiple "undefined" rows show up.
It seems like maybe there's some sort of ghost entities messing with things. This is the second time I've tried getting this to work; I just took a different approach, but it's the same problem I had at first.
Here's the code:
INPUTS:
KEPThingName - Type: THINGNAME (This is the server to add tags to)
TagRows - Type: INFOTABLE (This should be the Selected Row(s) from BrowseItems), Datashape: KEPItems (I believe this is the datashape for the results of BrowseItems)
//Create Info Table for new tags
var params = {
infoTableName : "InfoTable",
dataShapeName : "KEPAddItems"
};
// CreateInfoTableFromDataShape(infoTableName:STRING("InfoTable"), dataShapeName:STRING):INFOTABLE(KEPAddItems)
var addTable = Resources["InfoTableFunctions"].CreateInfoTableFromDataShape(params);
//Iterate input rows of tags to create entry for each. Entries will be put into Info Table for AddItems().
for(x in TagRows.rows){
// KEPAddItems entry object
var newEntry = new Object();
newEntry.ReadOnly = TagRows.ReadOnly; // BOOLEAN
newEntry.ScanRateMS = undefined; // INTEGER
newEntry.Description = TagRows.Description; // STRING
newEntry.BaseType = TagRows.BaseType; // STRING
newEntry.SourceType = TagRows.SourceType; // STRING
newEntry.Persistent = false; // BOOLEAN
newEntry.Logged = false; // BOOLEAN
newEntry.Source = TagRows.Source; // STRING
newEntry.Name = TagRows.Name; // STRING
//Add entry to new tags Info Table
addTable.AddRow(newEntry);
}
var addParams = {
items: addTable /* INFOTABLE */
};
// result: INFOTABLE dataShape: KEPAddItemResult
var result = Things[KEPThingName].AddItems(addParams);
I'm not sure if it has something to do with the fact that I'm creating an info table? Is there a way to destroy it or is garbage collection supposed to take care of it?
This is an odd issue that I want to solve. Any ideas?
Thanks
Solved! Go to Solution.
Thingworx 7.1 and KEPServerEX 6.2.
It turns out it had something to do with using $ symbols in the Name or Source field. Although Thingworx and KEPServer both allow using $ in Property names or Channel, Device, Tag names, the $ seems to be a delimiter in KEPServer's interfacing with Thingworx.
Once we changed all the $'s in our tags, they rebound correctly upon a restart.
It was odd that error checking didn't seem to be performed in AddItems to let you know that restricted characters were given as input.
Hi Ascherer
Have you enabled Legacy mode on your KEPServer? Please read page 62.
https://www.kepware.com/en-us/products/kepserverex/documents/kepserverex-manual/
Yes. We get data through KEPServer properly.
I think I figured out what was going on. In order to give the tag a more in-depth name on Thingworx, I was using the 'Source' field as the 'Name'. The Source entries contained periods (.) which Thingworx doesn't seem to allow in Property names. So I may have changed line 21 above and forgot before I posted. It was probably:
newEntry.Name = TagRows
Unfortunately, my issue isn't resolved. When the Thingworx instance or KEPServer instance is restarted, the bindings to my RemoteKEPServerEXThing get messed up. I get errors as shown below. They come in pairs and they show up the exact number of properties that I have attached to my KEPServer Thing. It looks like it's attempting to add a null item. I'm not sure where the null reference is being kept, so I don't know how to get rid of it. Any ideas?
I am able to run AddItems service on the KEPServer Thing again with the same tags, but I don't want to have to do this every time the server gets restarted.
Thank you for the post.
Just to confirm you have ThingWorx 7.1, and you are running KEPServerEX, 6.4, using the legacy mode for the ThingWorx native interface found in the project properties in the KEPServerEX. Also, you are able to get data through the system, but when you restart you see errors such as {attempt to add item" "] in both the ThingWorx and KEPServerEX logs?
Would you be able to upload your KEPServerEX event log as a text file?
Thanks
Rob Sharp
Kepware Support
Thingworx 7.1 and KEPServerEX 6.2.
It turns out it had something to do with using $ symbols in the Name or Source field. Although Thingworx and KEPServer both allow using $ in Property names or Channel, Device, Tag names, the $ seems to be a delimiter in KEPServer's interfacing with Thingworx.
Once we changed all the $'s in our tags, they rebound correctly upon a restart.
It was odd that error checking didn't seem to be performed in AddItems to let you know that restricted characters were given as input.
Greetings @Ascherer17,
I am able to recreate the problem you are seeing with the Legacy connection method, which relies on the "RemoteKEPServerEXThing" Thing Template. After testing with the newer releases of both products (ThingWorx 7.4 or higher / KEPServerEX 6.1 or higher), I find there is no issue with the $ character in the Channel, Device, or Tag names-- the property name persists with the $ character, and the value updates through this item.
For more information on connecting KEPServerEX with NextGen composer, please see the steps contained in this document:
Industrial Connections Example
Please let us know if you would like additional information about any of this.
Best regards,
Steven M
Greetings @Ascherer17,
Following up with you on the original question posted here, if any of the responses answered this, please mark the appropriate post with "Accept as Solution" for the benefit of others who may have the same question.
Or, if you are still unresolved on this issue, let us know and we can continue troubleshooting this with you.
Best regards,
Steven M
Greetings ascherer,
Thank you for sharing this update with us. Please also note the version of ThingWorx and KEPServerEX you are using is older, and many improvements have been implemented since those versions.
For more information, see these Community posts:
Re: Get tags from Kepware -> add them to a thing in Thingworx
ThingWorx / KEPServerEX version compatibility chart
Best regards,
Steven M