These are the similar posts I found but unable to produce the result in Outsystems 10.

https://www.outsystems.com/forums/discussion/36471/split-string-how-does-it-work/

https://www.outsystems.com/forums/discussion/33343/string-split/

I have added a local variable of type List of Text, but it kept giving error when I tried to use it in expression..

What is the proper way to use String_Split in Expression?

I am trying to change the text of Person Full name from "JENNY JENSON SEAH" to "Jenny Jenson Seah". Currently the database contains all full name in Caps, and my user does not want to see that.

Can you explain how did you implement the split string on your application?

You can have a function where your input is the Text (Person Full Name on your case) then you need a text list to get the result of the string_split.

Using for each loop, change the case of each value on the list and add them to your output TextValue.


HTH.

-Edwin

Hi Newbie,

You dont need the string_split. What you need is title case for your input. 

I had implemented this in a forge component String Utils . You can check the demo page here.

You can convert the string to lowercase and use the ToTitleCase() method to get the output you need. 

Hope this helps !!! 

Dear Amal Raj

Thank you for your post but I cannot use the String Utils component as my client does not want third party component to be installed in their project.

That is why i need to implement my own. It is easily done in C# but I am struggling with outsystems string_split.

Dear Edwin

Thank you for your post too.

Yes I know (theoretically) that i need to use a ForEach widget to loop through the entity and for each record, i need to split the word up, and then use a substring to change the first letter to upper case.

Where i am stuck is at how to use split_screen function.

Hi Newbie,

Both posts you reference (btw, great thing you searched first!) clearly show how to use String_Split. What exactly are you trying to do? Unfortunately "but it kept giving error when I tried to use it in expression" is too little information to go by: what error is displayed, when is it displayed (design time or run time?), and what does your expression look like? If you give some more information, it will be easier to help you.

Hi EnthusiaticNewbie,


If you want use string split function for "JENNY JENSON SEAH" to "Jenny Jenson Seah". 

first use string_split function provide to name and delimater to " ", (Space).

and use this expression 

SyntaxEditor Code Snippet

ToUpper(Substr(String_Split.List[0].Text.Value, 0, 1)) + ToLower(Substr(String_Split.List[0].Text.Value, 1, Length(String_Split.List[0].Text.Value)))
+" "+ToUpper(Substr(String_Split.List[1].Text.Value, 0, 1)) +ToLower(Substr(String_Split.List[1].Text.Value, 1, Length(String_Split.List[1].Text.Value)))
+" "+ToUpper(Substr(String_Split.List[2].Text.Value, 0, 1)) + ToLower(Substr(String_Split.List[2].Text.Value, 1, Length(String_Split.List[2].Text.Value)))

take this is one variable and set them in expression keep it minf plz check string_split length of person name does not content first,middle and last name.


hope this help,

kind regard

Rahul

@Rahul: though this solution works, I'd definitely put it in a seperate Function so it can be reused.

EnthusiaticNewbie wrote:

Dear Amal Raj

Thank you for your post but I cannot use the String Utils component as my client does not want third party component to be installed in their project.

That is why i need to implement my own. It is easily done in C# but I am struggling with outsystems string_split.

Hi 

Please share the screenshot of the error you are facing when using the String_Split. 

Regards


EnthusiaticNewbie wrote:

Dear Edwin

Thank you for your post too.

Yes I know (theoretically) that i need to use a ForEach widget to loop through the entity and for each record, i need to split the word up, and then use a substring to change the first letter to upper case.

Where i am stuck is at how to use split_screen function.

Hi EnthusiaticNewbie,

     Please find the attached OML to solve your issue. 

     Hop this helps.


Thanks,

Gowtham


EnthusiaticNewbie wrote:

These are the similar posts I found but unable to produce the result in Outsystems 10.

https://www.outsystems.com/forums/discussion/36471/split-string-how-does-it-work/

https://www.outsystems.com/forums/discussion/33343/string-split/

I have added a local variable of type List of Text, but it kept giving error when I tried to use it in expression..

What is the proper way to use String_Split in Expression?

I am trying to change the text of Person Full name from "JENNY JENSON SEAH" to "Jenny Jenson Seah". Currently the database contains all full name in Caps, and my user does not want to see that.

String_Split does not need a local variable; String_Split outputs a text list, so when using it, you can treat it as oneThe expression underneath results in "t". 

String_Split("text", "x")[1].Text.Value


I think using String_Split in an expression is not the ideal solution for your case at all. Unless all of the names in your database consist of exactly three parts as in your example, you would need to loop the result list of the String_Split function (or use an extraordinary amount of if statements, making it unreadable). An expression isn't made for looping. 

Instead, you could look into Regex_Replace() to use in an Expression. Alternatively, you could use the String_Split Action inside the Action you use to fetch the names from the database, and loop over the output. 

Though not the cleanest solution, if you simply want to capitalize the first letter of each word, the easiest solution is CSS. If you want to go the capitalization route, transform your string to lower case using the expression ToLower(MyTextVariable), then simply add the following CSS rule to this element:

text-transform: capitalize;

So many people always ready to help.

Hope you got the solution you need @EnthusiaticNewbie


- Edwin

Hi EnthusiaticNewbie,

Please give a reply is it solve or not. I hope what  @Gowtham is given is the proper solution for you. Please reply and if you got any solution from here please don't forget to mark it as a solution. It will help the people who are the newbie and searching for solutions. I hope you're getting the concepts of the forum.

Dear Amal Raj & Kilian Hekhuis

I attached the error for future others' reference.

The issue is caused by the fact that the output is in structure format in which i need to map. I got stuck because I cannot visualize how and why i need to map the output structure to a local variable of type Text List.

Kilian, you are right the statement "but it kept giving error when I tried to use it in expression" is vague. I will make sure i will put in more description next time.


Dear Rahul & Gowtham 

Your solution worked for fixed name length. There are some people with a longer name, But i get your idea. Thank you.


Dear Monique

Yes CSS can work magic but due to user requirement, i can't go that approach. I am using string_split with a foreach loop. 


Thank you all for your help. Sorry I was stuck at other threads as well as other bugs and took a while to get back. Unfortunately i can only mark one as solution, although other solution works as well.

Hi Newbie,

The error you got is because the output List of String_Split is of a different type than the List you are assigning it to. The way to handle that is in the accepted answer of the second post you linked to, here.