417
Views
9
Comments
How to get entity attribute name list using SQL
Application Type
Reactive

SELECT COLUMN_NAME

FROM INFORMATION_SCHEMA.COLUMNS

WHERE TABLE_NAME = {Customers}

ORDER BY ORDINAL_POSITION 


I am using above query for getting only attribute names from entity .I have used same query in mysql database there it is working and getting list of only column names of table.but i dont know how to use in outsystems 

2021-05-21 21-56-03
Anderson!

{Table}.[Attribute]

Select Column_Name FROM {Table} 

WHERE {Table}.[Name] = @Customer

ORDER BY {Table}.[Position]


UserImage.jpg
Manisha Pardhe

This is not working .I want all attribute name from entity for example

User is entity and having id,name, email ,mobile  attributes .these are the attributes and i want these attribute list in excel , meaning it will return only name of attribute not data

2024-07-05 14-16-55
Daniël Kuhlmann
 
MVP

Hi,

You don't need an SQL, you can do it with an aggregate around the correct system entity.

Regards, Daniel

UserImage.jpg
SS27

Hi, a little late to discussion but i tried getting the data from entity and entity_attr seperately and downloading the data through a excel download button i see that the data doesn't make sense at all. No column inside the sheet is matching what my entities have and their attributes. Is there another way, perhaps? Can you suggest how to use sql here if possible?

2020-02-05 04-54-55
Changalrao Bairaboyana

@Satvik Srivastava ,

Hope you are doing well.

I believe that's the best way to get the list of attributes, and I am sure you have implemented the above solution correctly, however can you let me know you implemented it?

You can follow the below approach.

My entity is test in espace 123

SELECT * FROM ossys_Entity WHERE NAME = 'test' and espace = 123 

this will give the id of the entity

SELECT * FROM ossys_Entity_Attr WHERE ENTITY_ID = 456

Let me know if that helps

UserImage.jpg
SS27

https://success.outsystems.com/Documentation/How-to_Guides/Data/How_to_Export_Entity_Data_to_Excel i followed this and the table of entities looks like this:-

Similarly for entity_attr table 
and for the sql code i have over 100 entities in my application , i don't want to write the query 100 times for same thing, anyway to optimise it

2023-01-25 05-43-21
Murugan S S

Hi Manisha, 

To get the Columns names instead of SQL query you can use dynamic tables.  

2023-10-30 09-31-27
Shivam Mishra

 hi 
Manisha Pardhe 

you used record to excel widget in sever side pass the list of aggregate and select all the attributes.  

it return binary file assign with output (binary type) and download this file.

2025-11-25 13-20-12
Tamirys Silva Barina

@Manisha Pardhe You can use an aggregate to fetch data from the Customers table. If you wanna see only Customer names on the excel sheet, then select the Customer Name attribute as showed in the screenshot:

You can check my oml below as well.

Kind Regards,

Tami


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