In the company where I work outsystems platform is on Java, I am developing an application for dynamic reports in which I put any SQL and shows the result in a table on screen.

This I did in a xif starting from the sentence outsystems.internal.db.Command command = outsystems.internal.db.DatabaseAccess.forCurrentDatabase ().
getConnection (). createCommand ();

I am currently in search of the Java classes that perform the transformation at the entity level.

Example:

Entry:
Select {Entity1}. [Field1] from {Entity1}

Exit:
Select OSADMIN.OSUSR_1bw_BaseApp6.CCampo1 from OSADMIN.OSUSR_1bw_BaseApp6

I do not want to make replacements with my logic, but use the outsystems own method.

Can someone who has done something similar collaborate with me?

Hi Belisario,

The physical table names are in the meta-model, specifically the Entity "Entity":

You do not need an Extension to get the physical table name, you can just query it.

Hi,

Not sure about your use case and definitely recommend using Killian's suggestion. 

Assuming that you cannot do Killian's suggestion, you will have to search for table name in the query string, query the OSSYS_ENTITY table in the plugin, get the physical name and replace the sql string.

you can check the plugin AdvanceQuery. This plugin does similar thing but unfortunately this is just for .net stack but can be a very good reference.

Thanks




I developed a translator method of entity names to table names, but I do not want to use that method. I am looking for the method of Outsystems classes that allows such translation. The page of my development accepts any query at the database level and shows the result at the bottom, this is not something that can not be done with the components of outsystems because it is necessary that everything be fixed not dynamic, therefore my Extension XIF is responsible for creating the table.I want to do it better and I want the input query not to be with the names of the tables, but with the names of the entities, just as it is used with the native SQL component.I have a clue how to make such a translation, but I have not yet come to the conclusion, 

I am between the use of the following classes:

outsystems.hubedition.runtimeplatform.sql.ReplaceEntities;
outsystems.hubedition.runtimeplatform.BaseAppUtils;
outsystems.runtimepublic.db.SqlHelper;
outsystems.hubedition.runtimeplatform.DBHelper;


Any help in this regard?


The ultimate goal is to create a dynamic report generator, but I want to do it based on entity names not with table names.