Reduction of attribute length

Hi everyone,

What is the expected behavior if I reduce the length of an attribute?

Let's say I have an attribute called 'Name' which has length 70 chars. If I now change the length of the attribute to 60 characters, what will happen to all the names with a length of more than 60 characters?  

Thanks in advance!

Wietse 

Solution

Hi Wietse,

The platform won't let you do it if you have data that will be truncated:

Solution

To do this first you need to make sure all data have less chars than the number you are changing or that the entity is empty.

If you need to truncate everything you can use the snipet below

update {TAble} set {TAble}.[Name] = substring({TAble}.[Name],1,60)


Afonso Carvalho wrote:

Hi Wietse,

The platform won't let you do it if you have data that will be truncated:

Hi Afonso,
Thank you for the quick response. We will be using a work around then! 


Wietse

Carlos Gonçalves wrote:

To do this first you need to make sure all data have less chars than the number you are changing or that the entity is empty.

If you need to truncate everything you can use the snipet below

update {TAble} set {TAble}.[Name] = substring({TAble}.[Name],1,60)


Hi Carlos,

knowing that OutSystems otherwise truncates the data it is indeed correct that all data should be changed first. Thank you for your answer!