Skip to main content
Jan 3, 2020 1:18 PM UTC
Solved

Syntax of updating the property VTQ

Hello,

To update the property VTQ on Thingworx platform using lua EMS is the following possible.

 

properties.propertyName={baseType="NUMBER", pushType="ALWAYS", value=0}

--To update on thingworx

local variableName = propertyName

properties.variableName.value = <someValue>

 

I tried it in different ways but it's giving me an error.

 

Thank You,

Naeem

mnaeemAnswer
Feb 17, 2020 9:21 AM UTC

Hi @slangley ,

Unfortunately I'm unable to find the solution and I've changed the way reading reading csv file on Thingworx platform instead of through agent.

Copying the file from agent to the server and then reading it on server.

It was the fastest way.

 

Thank You,

naeem

14 replies

Jan 6, 2020 5:03 PM UTC

You can use this service: 

UpdatePropertyValues

mnaeemAuthor
Jan 7, 2020 8:30 AM UTC

Thank You @PaiChung 

properties.Signal_Q30={baseType="NUMBER", pushType="ALWAYS", value=0}

serviceDefinitions.GetSystemProperties(
     output { baseType="BOOLEAN", description="" },
     description { "updates properties" }
)

services.GetSystemProperties = function(me, headers, query, data)
     log.trace("[TemplateRilevatore]","########### in GetSystemProperties#############")
     queryHardware()
     -- if properties are successfully updated, return HTTP 200 code with a true service return value
     return 200, true
end
function queryHardware()
     nome = "Signal_Q30"
     valore = 2
     serviceName(nome, valore)

end

I'd like to call a service in place of serviceName, which has been written on thingworx platform.

Thank you!

Jan 7, 2020 5:23 PM UTC

You are looking to do this from an agent?

Usually you would use 'UpdateSubscribedProperties' for that.

mnaeemAuthor
Jan 30, 2020 9:36 AM UTC

Thank You @Chandler1 ,

I'm talking about calling services of Thingworx in agent (LUA EMS).

 

For example:

properties.Signal_Q30={baseType="NUMBER", pushType="ALWAYS", value=0}

serviceDefinitions.GetSystemProperties(
     output { baseType="BOOLEAN", description="" },
     description { "updates properties" }
)

services.GetSystemProperties = function(me, headers, query, data)
     log.trace("[TemplateRilevatore]","########### in GetSystemProperties#############")
     queryHardware()
     -- if properties are successfully updated, return HTTP 200 code with a true service return value
     return 200, true
end
function queryHardware()
     name = "Signal_Q30"
     value = 2
     UpdatePropertyValue(name, value) --Service on Thingworx platform

end

Feb 13, 2020 8:38 PM UTC

Hi @mnaeem.

 

I realize that you've already marked a solution to this post, but since a couple of replies have since been received, I want to be sure you don't have any remaining questions.  Please let us know.

 

Regards.

 

--Sharon

mnaeemAuthorAnswer
Feb 17, 2020 9:21 AM UTC

Hi @slangley ,

Unfortunately I'm unable to find the solution and I've changed the way reading reading csv file on Thingworx platform instead of through agent.

Copying the file from agent to the server and then reading it on server.

It was the fastest way.

 

Thank You,

naeem