ActionArgument

ActionArgument is automatically passed argument to the action of a ThingModel or AppModel (instance) by A-Stack at the action trigger step.


  • ActionArgument contains both internal and user-defined attributes of the ThingModel / AppModel instance that triggered the action.
  • ActionArgument is local and transient - any changes made to the ActionArgument does not get reflected in the original copy of ThingModel / AppModel.


Example: Here is the ThingModel and ThingFacet (Partial Action) Definition for a Phidget Servo Motor

TempFacetSerial attributes
#
ThingFacet(Name: "PhidgetServoFacet"):
  String(Name: "ServoProtocolURL", Default: "phid://")
  String(Name: "DeviceInterfaceIndex")
  String(Name: "PhidgetDeviceType")
  Integer(Name: "ServoAngle", KnownBy: "PhidgetServoAction")
  Action(Name: "PhidgetServoAction", Documentation: "Control Servo Motor"):
    Workflow Limit: "1", Live: "1", Timeout: "-1"):
      Task(Name: "Main", while: "true"):
        Event(Name: "Argument", as: "ActionArgument")
          #...
ThingModel(Name: "PhidgetServoModel", Combines: "PhidgetServoFacet"):
  Sid(Name: "PhidServoId")

Here is the Phidget Servo Motor Instance creation TQL Query that triggers an Action

PhidgetServo Motor Instance Creation
#
Query:
  DeleteAll:
    PhidgetServoModel:
      PhidServoId(ne: "")
  Create:
    PhidgetServoModel:
      ServoProtocolURL: phid://
      PhidgetDeviceType: PhidgetAdvancedServo
      DeviceInterfaceIndex: 0
      ServoAngle: 110

Here is the ActionArgument Structure that is passed by A-Stack

ActionArgument Value of Phidget Servo Motor
#
Event:
  Argument:
    PhidServoId: KNI5JYVPAAAAUAABA4ONNHF2
    QName: 
      Atomiton.PhidgetServos.PhidgetServoModel
    $Guid:
      "#f3guorsmvr4qhomryacl5m3dha3ctaoe"
    $sid:
      KNI5JYVPAAAAUAABA4ONNHF2
    PhidgetDeviceType(Value: "PhidgetAdvancedServo", Known: "PhidgetAdvancedServo", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505"
      QName: "Atomiton.PhidgetServos.PhidgetServoModel.PhidgetDeviceType", FName: "PhidgetDeviceType")
    ServoAngle(Value: "110", Known: "110", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505", QName: "Atomiton.PhidgetServos.PhidgetServoModel.ServoAngle"
      FName: "ServoAngle")
    DeviceInterfaceIndex(Value: "0", Known: "0", Order: "", Version: "1", Timestamp: "1457366819505", DateTime: "2016-03-07 08:06:59.505"
      QName: "Atomiton.PhidgetServos.PhidgetServoModel.DeviceInterfaceIndex", FName: "DeviceInterfaceIndex")
    ServoProtocolURL(Value: "phid://", Known: "phid://", Order: "", Version: "1", Timestamp: "1457366819503", DateTime: "2016-03-07 08:06:59.503"
      QName: "Atomiton.PhidgetServos.PhidgetServoModel.ServoProtocolURL", FName: "ServoProtocolURL")

The following system generated tags are for each attribute:


A-Stack automatically generates tags as part of every attribute that makes up the model definition. System tags can be read (using FIND) with 

Format="all" modifier with the <Find> Query.

System Tag NameDescriptionPersisted?Query Constraint?
ValueThe value of the attribute is stored in "Value". This is often specified by the user at the time of create query (instantiation)YesYes
Known

Applicable to ThingModel/AppModel - this is the value that is only set by the output of Actions. Known CANNOT be

set using CRUD operations (Create / Update) via TQL Queries. The system also maintains a "Known" for DataModel attributes, for consistency purposes, but it will always be the same as Value.

YesNo
VersionThe version number of the attribute. This number is automatically incremented each time the value changes.Yes

No. You can request the value

using Format on <Find>

TimestampUnix epoch time at the time (in millisecond) of the attribute creation. For example: Timestamp value
1457663102004 is same as Fri, 11 Mar 2016 02:25:02 GMT
YesNo
DatetimeFormatted data time value of the attribute creation. For example:
2016-03-10 18:25:02.004
YesNo
QName

Fully qualified name of the attribute. <NamSpace>.<Domain>.<ModelName>.<AttributeName>. For example

SimpleModel.MyModels.VendorInfo.vendorName given that VendorInfo is defined within

Namespace - SimpleModel, with Domain as MyModels and DataModel Name as VendorInfo

YesNo
FNameGiven name of the attribute name.YesNo

Go to page

$Guid here is a global unique identifier of this model definition

$Sid is a unique Identifier of this Model Instance. Note that this value will be same as PhidServoId that is defined by PhidgetServoModel Thing Model using type Sid.


Accessing ActionArgument:

ActionArgument values can be accessed using standard Template Processor (TP) Notation. For example:

Access to PhidgetDeviceType Value
[%:Event.Argument.PhidgetDeviceType.Value:%]