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

Community Tip - Your Friends List is a way to easily have access to the community members that you interact with the most! X

SetPropertyVTQ not working with JAVA SDK

NM_10812832
3-Visitor

SetPropertyVTQ not working with JAVA SDK

I am trying to set a value of a property using SETPROPERTYVTQ by writing code in the service of my thing. I will an API and after the response of the API i will set the value of a particular property. Here is the code I am using:
VTQ vtq = new VTQ();
vtq.setValue(String(events[4].machineCode));
vtq.setTime(new DateTime());
vtq.setQuality(QualityStatus.GOOD);
base.setPropertyVTQ(me.ReasonCode, vtq,true);
While executing the code I am getting the error as: Message :: ReferenceError: "VTQ" is not defined. - See Script Error Log for more details.

ACCEPTED SOLUTION

Accepted Solutions

  1. You cannot use a ThingWorx Java API direcly from Script Service.
  2. To set the VTQ of a property from a Script Service, you can use the SetPropertyValues service on the Thing.
    Snippet:  https://community.ptc.com/t5/ThingWorx-Developers/How-to-update-all-Thing-s-properties-from-script/m-p/512242#M9133%3Fsource=search

View solution in original post

3 REPLIES 3

@NM_10812832 ,

 

Are you using the Java Edge SDK or the Java Extension SDK?

 

-Nick

Basically I am writing this code in one of the service in a thing which is responsible for getting data from an API. SO I am writing the code in Javascript inside service. In this JS I am trying to get a logic for setPropertyVTQ. I think it is Java Edge SDK.

  1. You cannot use a ThingWorx Java API direcly from Script Service.
  2. To set the VTQ of a property from a Script Service, you can use the SetPropertyValues service on the Thing.
    Snippet:  https://community.ptc.com/t5/ThingWorx-Developers/How-to-update-all-Thing-s-properties-from-script/m-p/512242#M9133%3Fsource=search
Announcements


Top Tags