Re: Text caculation – break out 1st and last name

Home Forum Formula and Condition Editor Text caculation – break out 1st and last name Re: Text caculation – break out 1st and last name

#4399

ehuezo
Keymaster

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.