Action Data structure

The following section will explain the data you can add to actions..

Defining action data

In Touch Portal you can augment your actions with additional data that the user has to fill in. It uses the same structures as the native actions from Touch Portal itself.

You can use this for both static actions as dynamic actions. The user will have to specify values for the given data field within Touch Portal. This can be inline like in version 2.1 or it can be done through a popup window. This also depends on the amount of data fields. The following objects can be used in the action array of a category:

The following is an example of a data object you can add to an action. Touch Portal will automatically show a popup when you add an action with data fields. The user can fill it in so he can customize the action. So here the user could fill in a number.

  "label":"First number",

Here is another example of a data object. In this case we specify a few choices so that we limit the user what they can customize.

  "label":"Second number",
  "valueChoices": [

The next example shows a text data field. This is an open data type where the user can fill in a custom text value. This can be handy for example for names or text.

  "default":"any text",

Our last example is of a switch action. This is an action you can turn on or off.

  "label":"Is this true?",

Each data object has its own combination of mandatory fields, use the example provided to create data fields. Below are the types and the explanation.

Attribute Type Mandatory From version Description
id Text yes 1.0 This is the id of the data field. Touch Portal will use this for communicating the values or to place the values in the result.
type Text yes 1.0 The type of data:

textA data type that accepts a string
numberA data type that accepts a number
switchA data type that accepts a true or false value
choiceA data type that accepts a string where a collection of strings can be chosen from

2.0 The type of data:

fileA data type that represents a file which the user can pick with a file chooser
folderA data type that represents a folder which the user can pick with a folder chooser
colorA data type that represents a color which the user can pick with a color chooser. This value must be in a the format #RRGGBBAA.

label Text yes 1.0 This is the text used in the popup windows
default Text
Yes 1.0 This is the default value the data object has. Use the correct types of data for the correct type of data object. Eg: The switch data object expects a true or false here.
valueChoices Collection Yes 1.0 This is a collection of strings that the user can choose from.
extensions Collection Optional 2.0 This is a collection of extensions allowed to open. This only has effect when used with the file type.

eg: "extensions": ["*.jpg","*.png",]
allowDecimals Switch Optional 2.0 This field can only be used with the "number" type and tells the system whether this data field should allow decimals in the number. The default is "true".