Dynamic SQL Query to fetch records from DB | Outsystems


I am trying to create an application in which SQL Query will be entered by user dynamically. And then under actions and SQL widget, query will get triggered and records will get reflected on page.

Is there any possible ways to trigger a query dynamically to fetch the data from existing table?

(Same in case of external database liked with the application.)

How can we fetch the all existing tables in database (even if there is external database linked with the application)? 


Prashant Salunke


Considering you have take in account the dangers of that procedure, you'll need 

Create a Action in the screen;

Put an AdvancedSQL widget 

In the AdvancedSQL create a parameter , type "Text" , and with Expand In line = Yes

The parameter will get the content from the input field with tour users query 

You must define or select in dependencies manager all the entities you want the users can query;

Sanitize the input string , and probably validate the content. 

Then treat that action output as any other in your screen.

Last warning: that's one of the worst ideas I have read lately, you will regret it if you let your users to use that screen.

Good luck.



as @Maria da Graça Peixoto mention you can follow this process for dynamic SQL.

For Database Entity with External or Internal Database you can use this entity from System Module.


Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.