It can be usefull to determin a table name at execution time, using a Metadata Variable. This article shows an example of how to do this.

The Metadata Variable

We created a new metadata variable, named "VAR_TABLE_NAME".

01-variable

 

The Table

For this example we use a very simple table. Note the presence of the Metadata link in the metadata structure, it refers to the Metadata Variable.

To do this, you need to drag and drop the Variable on the table.

Also, note the Physical Name of the table : %{VAR_TABLE_NAME}%.

02-table

The Process

Our process initializes the VAR_TABLE_NAME Variable, and executes a Sql Operation on the table.

03-process

 

Step 1: this action was created by drag'n'droping the variable on the process. Then, we set

  • VAR_OPERATION=SetValue
  • VAR_VALUE=table1

Step 2: we dragged the table on this SqlOperation so that the connection is automatically set.

View [3]: The SQL expression is:

insert into %x{$tableWithVarName/tech:physicalPath()}x%
values (99)

 

Execution

Here is the Sql expression that is executed :

insert into test.table1
values (99)