Passing Entity name as parameter to a procedure

Passing Entity name as parameter to a procedure

I have a procedure in the backend which expects Entity name as parameter. I created an action with advance query and in my SQL statement i have Exec Proc1 {MenuItem}.
This fails because {MenuItem} = db.schema.object
If I say '{MenuItem}' then the entity name is not materialized. I'm Version 9.0 SQl Server 2012.
Is there a way to accomplish this?  I would like to have EXEC Proc1 'db.Schema.Object' in quotes.

Thanks in advance.

Hi Brian,

To get the physical table name from an OutSystems entity you can add a reference to the Entity table and use an aggregate / query to fetch that value from the table. Make sure to also include the Espace table and join them as well as filter the Espace.Name with your espace module name.

With that you can then use a parameter in your SQL widget (e.g. TableName) and pass the table name you got. It could then be something like: Exec Proc1 @TableName if you want to put in quotes you could pass them in the input parameter

Hope this helps.