Use variable as Database in an Advance query

Use variable as Database in an Advance query

  

Good day.

How can I use a variable(Text) in an advance query as Database name.

like "Select * FROM <variable>"

I have an application that list a name. When I click on the name it will connect to other assigned database to get data.

Thank you.

Hi Gerardo,

If the database you want to fetch data is an external database (not OutSystems db), use an extension to import the tables.

It's much more easy with the advantage you will be able to use aggregates as the tables will be seen by your app in the same way as OutSystems entities.

Cheers

Eduardo Jauch

Thank you for the reply.

The databases that I am using is in Outsystems.

Solution

Hi Gerardo,

You can set up your SQL Query like this:

And add as input parameter of the query the value "{Person}" (as an example).

The GenericStructure should have its attributes of the same type as the first attributes of the database table. Otherwise, I do not know exactly what will happen...

See if that was what you wanted.

Cheers,

José

Solution

I am doing the same as above for dynamic queries (for custom user searches and whatnot)

Make sure to set the Expand Inline to TRUE