Text Editor in Formula Mode Inconsistent?

My db has 2 fields, First & Last. On a form, I have 3 Text Editor objects. One for First, one for Last, and a third for Name. The text editor objects for First & Last use Field/Variable mode and display the values of those fields. The Name Text Editor object is in Formula mode with the ‘Data:’ being ‘First+" "+Last’ and the Procedure being

First = firstword(TextEditingResult)
Last = lastword(TextEditingResult)

On the Data Sheeti, If I enter a new record, the Form does reflect all 3 Text Editor objects with the proper values.
If I edit the Name field on the Form, the First & Last fields do update on both the Form and the Data Seet.

BUT… If I add a new record on the data sheet, and then on the Form, enter ‘Abe Adams’ in the Name Text Editor object, I only get ’ Adams’ in the Name field, and ‘Adams’ in the Last field, but nothing in the First field.

This might just be a typo on your post but the second line should be:

Last = lastword(TextEditingResult)

Dang. I was hoping that it was me but alas, my 2nd line of code is correct in that I did have ‘lastword’ as the command. (I’ve corrected my post above. It would also have come up as Abe Abe if it was working as I expect it to work.)

I can edit an existing record and all works fine. I can edit the Name field on the form and it parses correctly. I only get the problem when I add a new record and attempt to enter the name in the Name field on the form.

Ok, I was able to duplicate the problem and found out what was going wrong. For some reason under the conditions you noted when adding a new record the TextEditingResult variable is adding a space at the beginning. The solution to avoid this is to include a strip( function to the procedure formulas:

First = firstword(strip(TextEditingResult))
Last = lastword(strip(TextEditingResult))

This is definitely a minor bug.

I think what is actually happening here is that the formula in the object is being evaluated when the new record is created. First and Last are empty at that time so the formula First+" "+Last is just producing the invisible space in the middle. Try changing that formula to

strip(First+" "+Last)

Dave’e suggestion of using the strip( one will work in this case because the text in the middle is just a space. But you could also use the yoke( function, which is designed for this sort of thing.

yoke(First," ",Last)

In this particular example it doesn’t really matter which method you use, but suppose you wanted names in the format Last, First? The strip( function won’t help, but yoke( will do it.

yoke(Last+", "+First)

It’s kind of the opposite of the sandwich( function, and can be a handy tool in your belt.

Thanks Gary for the poke to look closer.

It appears that when the record is created in the Data Sheet, because the Name Text Editor object on the form has the equation of ‘First’+ " " + Last’, the TextEditingResult gets created immediately with just a single space. This is clear if you click in the Name field. The cursor displays just a bit to the right of its proper place showing that the space is leading the variables already calculated value. If I backspace before entering data in the Name field, all is good. But of course to Strip the variable will make it automatic until this gets corrected and will not be a problem later as well. Thanks again.