Welcome Guest! Log in
Stambia versions 2.x, 3.x, S17, S18, S19 and S20 are reaching End of Support January, 15th, 2024. Please consider upgrading to the supported Semarchy xDI versions. See Global Policy Support and the Semarchy Documentation.

The Stambia User Community is moving to Semarchy! All the applicable resources have already been moved or are currently being moved to their new location. Read more…

Parameterizing metadata properties

    Metadata properties can be set directly in the Metadata editor, and the value will shared by all the mappings/processes using this Metadata.

    It is also possible to make them dynamic, with the use of Process parameters or Variables.

     

    Using Metadata Variables

    There are already some articles which can be consulted on the subject:

    How to use a variable as a table physical name

    How to generate files with dynamic name

    These articles should give a good idea on how to use Metadata Variables to make Metadata properties dynamic.

     

    Using Process Parameters

    Like with the Metadata Variables, a Process Parameter can be used for this.

    First, the metadata has to be configured:

    metadata

    Note: the path to the Process Parameter starts with a ~. This is important as the Metadata may be used in any Sub-Process or Action within the main Process. As a consequence, it is important that the parameter value can be retrieved from each of them.

    Then, we can use it as a parameter in the main Process:

    process

    The physicalName will now be dynamically set with the parameter value when executing the process.

     

    To go further, this article can also be consulted to learn how to use process parameters in a Mapping:

    How to use a process parameter in a mapping

     

    Using metadata queries

      Introduction

      A metadata query is a SQL query (a select query most of the time), which can be reversed and used like a datastore.

      This feature was introduced with Stambia S18.0.3 and it allows to have custom datastores representing SQL queries.

       

      Creating a metadata query

      The first step is to create a query folder, in which our queries will be stored :

      Right click on the server node > New > Query Folder

      Then, give a name to the folder. My Queries for example.

      Now, you can create a query with :

      Right click on a query folder > New > Query

      Configure the query with a name and a sql query, and finally reverse it with :

      Right click > Actions > Reverse

      Result :

      newQuery

       

      A query defined like that will be always selecting from the table HOTEL_MANAGEMENT.T_CUSTOMER (since the name of the schema is hardcoded).

      To make it dependent on the configuration used on the metadata you can use the expression of this type :

      SELECT * FROM  {./md:objectPath(ref:schema('METADATA_SCHEMA_NAME'), 'TABLE_NAME')}

      For example:

      SELECT * FROM {./md:objectPath(ref:schema('HOTEL_MANAGEMENT'), 'T_CUSTOMER')}

      This allows to get the schema name from HOTEL_MANAGEMENT metadata element, so in case you apply a configuration for this element and change its 'Schema Name' property this change will be reflected in the executed query.

       

      Using a Metadata query

      Like said before, a query can be used like any other datastore.

      mappingExample

      Note :

      As metadata queries are most of the time select queries, there is no sense to use it as target

       

       

      Metadata XPath Expressions Wizard

        Metadata files have a bunch of information about the connection properties, file's path, and more depending on the type of Metadata.

        To access those information and use it dynamically, a language called XPath can be used, which is standard language allowing to browse XML file data (which is how Metadata files are stored in background.)

        Depending on the technology on which you are working, we added a bunch of dedicated XPath custom functions which allows to retrieve various information.

        Read more: Metadata XPath Expressions Wizard

        Articles

        Suggest a new Article!