I encountered problems in using the built-in OutSystems Text library functions.
I dont know if my parameter Delimiter in String_Split is correct. When I throw in a text, and a delimiter, the result has nothing inside. Is the format of my delimiter wrong?
Additionally, can I split by word (i.e. delimiter is a word)?
Also, for String_LastIndexOf, I got the position 0. I read documentation that only empty text will return 0, but the input contains content. Also, what is the format of the input parameter to the function (i.e. pattern)?
I am new to OutSystems. Can anyone explain what happened? I am very confused.
Just test it, works like normal.
Hi @Rochefort McGill,
That's some strange behavior for sure. I used that action many times and never had issues. Can you share the module (.oml) file?
I created a test screen using the same String_Split action. You can try it here: https://personal-inxwbdht.outsystemscloud.com/TestStringSplit/StringSplit. I also attached the OML. I add a ListFilter to remove any empty records returned by the StringSplit.
It works ok on my side. Let me know if I can help more.
"Additionally, can I split by word (i.e. delimiter is a word)?" - No, the description of that input parameter is "Contains all the characters that should be considered as separators.". If you input ",1" you will get the following:
Meaning that each character is treated as a separator. Separates by "," and "1". Not by ",1".
Hi @José Gandarez
The file tested other stuff. The ButtonOnClick function is the one for String_Split. When i run debugger on the function, the return list of String_Split is empty.
In the UI, the bottom button will trigger the ButtonOnClick function
Hi @Rochefort McGill ,
you are executing these server actions from a client action, and then you are not doing anything with the result of them.
OutSystems generates code optimized for performance, and as one of those features, it will not send back from the server to the client, data that the client isn't using anywhere.
Dorine
Hi @José Gandarez,
I don't know why the result of this one is like this, could you explain it.
Hi @Kiet Phan ,
both 'n' and 'o' are separator, so your string would be separated in
"Text1 "
""
" Test2 "
" Test3"
so in other words, twice an empty string between the 'n' and the 'o'
Hi @Kiet Phan,
@Dorine Boudry is right, and that's why I am doing a ListFilter to remove any empty records returned by the StringSplit (Value <> "").
We should also do a trim on each value in case there's multiple " " (spaces).
I updated the OML, so you can see both results on the screen.
Not sure why it's showing unavailable on the debugger.
Hi Rochefort,
Try binding the data to a screen, so that you can see the result and if you're not using this output anywhere platform optimiser may not return you the data even if it executes.
Regards,
Sandeep.
Hi @Ho Yin Wong ,
The String_Split that you are using a server-side action. If you need to use these kind for functionalities in client side, you can use:
Client Side Text Utils O11 - Overview (O11) | OutSystems.
Client side utils are more responsive, fast and based on JS library with type safety.
Cheers,
Saugat