Skip to content

TDE Variables

Preston edited this page Oct 30, 2019 · 1 revision

TDE variables can be very useful to insert into a Feature Layer.

For instance:

  • you can insert the feature layer owner into a column of data so the readers of the data know who to contact
  • you could also inject a copyright notice per feature result
  • return a permalink to the specific document representing the result (my favorite)

To create a variable in TDE, you make use of the vars capability.

{
  "template": {
    "context": "/",
    "collections": ["documentType:propertySet"],
    "vars": [
      {
        "name": "searchUrlPrefix",
        "val": "'http://www.some-great-data-service.local:8016/search#/document/'"
      },
      { "name": "objectUUID", "val": "./objectId" }
    ],
    "rows" [
      {
        "schemaName": "ShadowFax",
        "viewName": "Objects",
        "columns": [
          {
            "name": "OBJECTID",
            "scalarType": "int",
            "val": "koopObjectId",
            "nullable":true
          },
          {
            "name": "LINK",
            "scalarType": "string",
            "val": "fn:concat($searchUrlPrefix, $objectUUID)",
            "nullable":true
            "nullable": true
          },
    ]
  }
}

Notice:

  • JSON TDEs must have quoted or double quoted values
  • If you make use of a string in a TDE variable, you must wrap the value in single quotes (in my example since I wrapped my JSON property values in double quotes)
  • Each variable that makes use of data will be evaluated for each row
  • You can perform a very limited number of XQuery functions inside the setting of a row's val

Reference:

Clone this wiki locally