rrdwitt Posted January 18, 2019 Share Posted January 18, 2019 Hi All, I will try and explain this issue as best I can. We have a mail list. With header names, "First name", "Last Name", but the customer only wants to use the "First name", UNLESS there is only a single letter. If there is only a single letter for the "First name" they want the "Last name" added. Example: "First Name" "R." "Last name" "Johnson" how they want it to appear is "R. Johnson" But they do not want the "Last name" field on all the records. ONLY on the ones that have a single letter "First name". Thanks!!! Quote Link to comment Share on other sites More sharing options...
merski007 Posted January 21, 2019 Share Posted January 21, 2019 Hello, Maybe a rule like this would work: var name= ''; if(firstName.length === 1){ name = firstName + '. ' + lastName; // depending on the data, you might need to strip away any character that's not a letter, and then add the period to the string. } else{ name = firstName; } return name; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.