Ruslan,
If you think of the contents of a string as an array of single character strings, this result makes a bit more sense. When calling Substring, Mendix tries to get the contents of the array in positions 0-99, however, if there are no values in some of the array positions, an error results. The way around this that I’ve used is:
if length($a) > 100
then
substring($a,0,100)
else
substring($a,0,length($a))
Hope that helps,
Mike