Substring issue in Type into Activity


In my text box support on Max 20 Character…

i will use VarStr.Substring(0,20) VarStr is more than 20 Character is working fine…

if less than 20 Character how to type it… i got below error


i want trim character more than 20 character or is less than that print all character.

Any idea


you have to check the string before type so before type use condition String.length > 20 in if condition

Hi @Veera_Raj

i have more than 20 type into activity used… each one having if condition means it will take long process…

do you have other idea?


Hello @Shyam_Pragash,

If you always start from 0, you could alse use Left(VarStr,20)

Best Regards

Hi @lukas.gamper

It will print all character less than or more than.


isn´t that what you wanted? If it´s less then 20, take everything, if it´s more than 20 take just 20 chars?

best regards

Hi @Shyam_Pragash ,

You can use below Expression in Assign Activity :
MyResultStr = If(VarStr.Length >20, VarStr.Substring(0,20),VarStr)

This will provide you the substring only if there are more than 20 characters else it will give original text.


1 Like

Hey @Shyam_Pragash

It will not take more time to process 20 type into activity, It will finish with in a min. Just try it is the easy to get the solution

Hi @lukas.gamper


Hi @Shyam_Pragash,

As @Veera_Raj said, do not perform manipulations before you perform necessary checks on the original string.

In this case you perform string manipulation if the str.length>20. If less, it will continue with type into using original string. If more than 20 then it will either use approach from @lukas.gamper or your own.

Booleans are you friend.

Hi @rohith.prabhu

Thanks :slight_smile:

it working.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.