Home › Forum › Formula and Condition Editor › Text caculation – break out 1st and last name
This topic contains 1 reply, has 0 voices, and was last updated by Anonymous 12 years, 8 months ago.
I need to store 1st and last name seperately, yet the user input field is the combine of the two. How do I seperate them? Thx.
If you have a ‘name’ field on your form where the first and last name are separated by a space, or any separator,and you want to have the first and last name stripped out, here is how to do it.
First make sure you have the objects to collect the first and last name, as well as a hidden object to store the index.
Choose a behavior to script on, then first drag a ‘set field’ object to set the index. Use the ‘Index of’ function to search for the separator in the name field.
Next, drag another ‘set field’ for the First name and use the ‘sub-text 1’ function. In the function, set the start index to 0 and the end index to the field you created for the ‘index’.
Next, drag another ‘set field’ for the Last name. You will use the ‘sub-text 1’ function. In the function set the start index to the field you created for the ‘index’ and the end index to 99.
Last, drag another ‘set field’ to remove the leading space from the last name. You will use the ‘Left Trim’ function to do this. Make sure you write this value back into the ‘Last name’ object.
You must be logged in to reply to this topic.