Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Hi Community,
Can you please let us know how to initialize default values for Edge property with Base Type : Infotable and set values later in LUA script?
I have initialized EDGE property in LUA by following the syntax below. I could see the property "MeteringApplication" on ThingWorx platform and could successfully do remote binding. However, post binding, I was not able to see the default value being populated on the Sub-property "StatusMessage" as per syntax below:
dataShapes.MeterReading(
{ name = "Temp", baseType = "INTEGER" },
{ name = "Amps", baseType = "NUMBER" },
{ name = "StatusMessage", baseType = "STRING", aspects = {defaultValue="The meter is currently offline"} },
)
properties.MeteringApplication = { baseType="INFOTABLE", pushType="ALWAYS", dataShape="MeterReading" }
So, I would like to hear from you how to set Default values for Infotable as baseType on Lua and how Get/Set Sub-property values under "MeteringApplication" property during later point of time to perform some tasks in LUA.
Thank you for you help in advance.
Hi @SC_10151701.
Apologies for the delayed response.
Have you checked this page from the Help Center? Notice that you can set a default value in your code:
properties.IParametersnMemory_Imagelink = { baseType="IMAGELINK", pushType="NEVER",
value="http://www.thingworx.com" }
properties.InMemory_InfoTable = { baseType="INFOTABLE", pushType="NEVER",
dataShape="AllPropertyBaseTypes" }
properties.InMemory_Integer = { baseType="INTEGER", pushType="NEVER", value=1 }
properties.InMemory_Json = { baseType="JSON", pushType="NEVER", value="{}" }
properties.InMemory_Large_String = { baseType="STRING", pushType="NEVER",
value=string.rep("Lorem ipsum dolorsi ", 15000) .. "the end" }
properties.InMemory_Location = { baseType="LOCATION", pushType="NEVER",
value = { latitude=40.03, longitude=-75.62, elevation=103 }, pushType="NEVER" }
The example.lua included in the EMS has more examples of properties with default values defined.
Let us know if you still have questions.
Regards.
--Sharon