Microflow that splits string attribute into two attributes

0
Hi, I'm a bit new to Mendix (just got my Rapid Developer Cert.). :) I have an entity Account with 'Full name' attribute and and entity Profile with 'First name' and 'Last name'. All strings. I want to keep these attributes in each entity as is. What I want to build is an microflow that reads the value in 'Full Name' and splits it in two (using the space as a breakpoint) and saves the values in the 'First name' and 'Last Name'.  What's the best trick to do this.  Thanks! Joël
asked
2 answers
1

 

This is harder than it may appear.. What happens if someone has last name 'van der Water'? What you're trying to do is usually done the other way around: compose the full name by adding firstname and last name together.

answered
0

Capturing First name and Last name separately and then using a Before Commit event handler to create the full name string would make your life so much easier. With that said, you could accomplish this in java. It would be a custom java action that takes in two string parameters ( One for the full name, and a second one for a regular expression for a space), and then would return a list (the first and last name). But as Luc said, this will be harder than it appears, so if you do have the option to capture first and last name separately, I recommend doing that.

 

answered