How to break/ split a string on the basis of specific length
I have a requirement. There is a property containing string value. I am using pxReplaceAllViaRegex function to replace/ remove some special chars/ regular expressions. But it seems when the length of the property value exceeds 2100, this functions fails. Currently this property is used in response DataTransform of Service REST rule. So how can I overcome this issue.
If I need to break/ split the property value for every 2000 charecters (i.e. on the basis of length), create a list (either value or page) and then loop it for substring. And for each splitted substring value use pxReplaceAllViaRegex and later concat it in a single property. How to achieve this within Data Transform. If not possible, please suggest the possible approach.
You can try to write a function that will perform all logic - splitting and looping and removing special characters and call that function in DT. Instead of splitting and looping in DT and then removing specials characters.
As per my observations java function performs faster than looping steps in DT (multiple/recursive loops).
As of now, I have called an activity using pxExcecuteAnActivity function and passed the required parameter. In the activity, i have used a For Loop to divide the string after every 2000th character, process every divided/ splitted string through pxReplaceAllViaRegex function and concatenating at the end. I am able to process them successfully now.