Welcome Guest! Log in
×

Notice

The forum is in read only mode.
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…

Topic-icon Question How to substiture a table name during the execution

More
01 Feb 2017 18:01 #1 by letancel
Hi,

I have a process with a SQL Operation which executes a query stored in a table :
DECLARE @sqlCommand nvarchar(1000)
SET @sqlCommand = :{CODE_SQL_ACTION}:

EXECUTE sp_executesql @sqlCommand .....

The query executed with the sp_executesql :
SELECT 1
FROM %x{$RAPPROCHEMENT/tech:physicalPath()}x%
WHERE 1 = 1 AND ....

My issue is that the %x{$RAPPROCHEMENT/tech:physicalPath()}x% is generated from metadata information during the build.

So when my process is executed, the %x{$RAPPROCHEMENT/tech:physicalPath()}x% is not replaced with metadata information.

Is there a synthax to do it?

Thanks
More
03 Feb 2017 17:29 #2 by ENDY
Hi
Yes you are right, the xpath expression is translated during compilation.

if it is not mandatory to user xpath, you can juste store you table name in the table without xpath like:

SELECT 1
FROM RAPPROCHEMENT

and once you configuration is changed, juste change the value in your table.

or:
declare the variables like TABLE_NAME in you process which will use xpath, and modify your query like this:

ELECT 1
FROM ${~/TABLE_NAME}$
WHERE 1 = 1 AND ....

during execution, value will be translated


wish can help you!
More
07 Feb 2017 18:12 #3 by risson
@letancel
What do you mean when you say that "%x{$RAPPROCHEMENT/tech:physicalPath()}x% is not replaced with metadata information" ? What is generated ?
Normally, in the built delivery you should get the table name. Is it not the case ?
It should work fine as long as you have a metadata link named RAPPROCHEMENT on your process or action...

Please provide more details as %x{$RAPPROCHEMENT/tech:physicalPath()}x% is really a good way to refer to table names in Sql operations and it should work fine, there must be something missing (a metadata link maybe). Can you share a screenshot of action and process ?
More
08 Feb 2017 11:30 #4 by ENDY
In fact, the %x{$RAPPROCHEMENT/tech:physicalPath()}x% is a xpath expression, once your transformation of your process to xml is done, the life of this expression is over. in your xml file, value of %x{$RAPPROCHEMENT/tech:physicalPath()}x% will be translated smthing like: RAPPROCHEMENT which is the physical name of your table. so nothing with your link your metadata.
More
08 Feb 2017 14:34 #5 by risson
Thanks Endy, you are right and I know this.
But the original poster wrote "%x{$RAPPROCHEMENT/tech:physicalPath()}x% is not replaced with metadata information".
=> My understanding is that his metadata's information is not being replaced at all, not even at build time.
@letancel can you please clarify?
More
08 Feb 2017 15:23 #6 by ENDY
@risson thank you for your reply.

If i have well understood the context, letancel has stored his xpath expression in the data base, and use sql parameter or operation to get this xpath, like there is no more transformation of xpath, so runtime can not run the query.