Welcome Guest! Log in
Due to some maintenance operations, stambia.org will be switched to read-only mode during the 13th November. It will be possible to read and download, but impossible to post on the forums or create new accounts. For any question please contact the support team.


The JSON Metadata and technology in Stambia offers the possibility to use 'Property Fields'.

A Property field is an internal field that can be added to the JSON Metadata and that allows to retrieve information such as the file name, path or size at read.

This functionality also permits to define dynamically the JSON nodes' name when writing a JSON file.

This is particularly useful when the name of the node is containing dynamic data information.

Prerequisites:
  • Stambia DI Designer S18.3.0 or higher
  • Stambia DI Runtime S17.4.0 or higher

 

Metadata Configuration

The Property Fields are added directly in the JSON Metadata.

 Metadata

 

The following Property Fields are available:

Property Name Read Write Supported from Runtime Version Description
fileAbsolutePath X   S17.4.0 Absolute path of the file.
fileCanonicalPath X   S17.4.0 Canonical path of the file.
fileName X   S17.4.0 Name of the file.
fileParentPath X   S17.4.0 Path of the folder containing the file.
filePath X   S17.4.0 Path of the file.
fileSequenceNumber X   S17.4.0 Place of the file in the queue of found files. Useful in case of using file masks.
fileTotalSpace X   S17.4.0 Total disk space.
nodeName   X S17.4.0

Name of the JSON node when writing a JSON File.

This can be used to define dynamically the node name at execution.

nodeLocalName X   S17.4.0 Name of the node.
nodeLocalPosition X   S17.4.1 Position of the current node in its parent
nodePath X   S17.4.1

Path of the current node.

For instance:

/root[1]/customers[1]/e[1]/phones[1]/e[1]

With [1] being the nodeLocalPosition

 

Using the Property fields in a Mapping

Retrieving file information

Except the nodeName that is used only at write, all the other Property Fields can be used at read to retrieve the JSON file information.

Simply map the fields into a target database as usual.

 JSON To Database

 

Loading node's name dynamically

The nodeName Property Field allows to load dynamically the JSON nodes' name at execution.

For this, simply map this field when loading a JSON file.

Database To JSON

 

The generated JSON file will look like this:

{
    "json_person": {
        "GIBBS": {
            "id": 1,
            "firstname": "Jason",
            "lastname": "GIBBS",
            "company": ""
       }
    }
}

 

You have no rights to post comments

Articles

Suggest a new Article!