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.

Using the Object Selection Metadata to make a customized Metadata view

    You may have noticed the 'Object Selection' technology that is listed in the Metadata Creation Wizard.

    This specific Metadata allows to aggregate in the same place a list of existing Metadata, to create a 'view' of Metadata.

    This can be useful to create a referential of Metadata regrouping all the Metadata used in a Project, for instance.

    Read more: Using the Object Selection Metadata to make a customized Metadata view

    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

         

         

        Updating a table metadata

          Once they are reversed, the metadatas are not updated automatically if there is a change in the database.

          For example if there is a new column on a table, it will not be added directly.

          It is possible to delete the metadata table and re-reverse it from scratch, but all the mappings and processes which referred to this table will have errors, because the new metadata will be considered as a new object.

          The best solution is to update the existing table node. 

          With reverse Action

          Since Stambia Designer S18.0.3, it is possible to re-reverse directly from an Action on the table :

          reverseButton

          This action will update the metadatas of the table.

           

          From the Wizard

          The second solution is to re-reverse the table from the wizard on the same schema, but without deleting it first. It will overload the table metadatas with the updates.

          The Wizard is accessible with Right Click > Launch DataSchema Wizard on the schema in which the table is.

          dataWizard

          Then, re-reverse the table which have changed

          reverseWizard

          Note :

          The Delete No Longer Existing Column can be used to remove the old columns in the table metadata which don't exist anymore.

          Beware, it does not delete the Foreign/Primary Keys which have to be deleted manually.

           

          Articles

          Suggest a new Article!