Custom 30th string character

0
Hi guys, I have a question. Theres an attribute called ‘’FullName’’, wich have unlimited lenght, but, if the user enter more than 30 characters I want to trim/cut/limit that to the last 30th character in the microflow without setting a custom 30 lenght directly on the input ‘’fullname’’ field. Any help?
asked
1 answers
2

You can use the substring function to limit the length of the string. Add a check before to see if you need to do this by checking the length with the length function.

If you have string in the $MyString variable, something like this should work.
 

if (length($MyString) > 30) then
  substring($MyString, 0, 30)
else
  $MyString


https://docs.mendix.com/refguide/string-function-calls/#4-length
https://docs.mendix.com/refguide/string-function-calls/#5-substring

 

answered