outsystems

Dynamically return entity attribute


Context Using Outsystems 11. I have an external REST API that is being consumed by my application, and a corresponding database table on SQL Server that matches the expected data type coming in from the API fields. However, I need to truncate some of the data from the API since it is exceeding spec.

Question Is there a way to dynamically read an entity's length attribute so that I don't have to hard code length into the app?

What I've tried Text LENGTH function

Example:

ArticleOut.Title = Substr(ArticleIn.Title,0,Length(ArticleOut.Title))
ArticleOut.Description = Substr(ArticleIn.Description,0,Length(ArticleOut.Description))

The Length function call is returning a length of 0 since there is no data in the field yet - and I hoped for it to return the entity attribute length.


Solution

  • Find the table and attribute using entities Entity and Entity_Attr from (System) component.

    Entity_Attr entity has one filed Length that should be what you're looking for.