Hi All,
Good day. Please I am having problem writing script to cocatenate the first letter of the last name, first letter of the first name, and the middle initial from a name field.
Is there an example I can use.
Thanks
v/r
Tammy
Solved! Go to Solution.
Views
Replies
Total Likes
Tammy,
Could you please give one Rater- Name example?
I assumed the Rater - Name is "Mathew Easow Jacob"
Try below script on Rater-initial Field.
var names = Rater_Name.rawValue.split(" ");
var initials="";
for(i = 0; i<names.length; i++ ){
initials = initials +names[i].charAt(0);
}
this.rawValue = initials;
Below is the Screenshot.
Let me know if you need some more information.
Vjay
Views
Replies
Total Likes
Hi Tammy,
Keep below script on the result field where you wanted to get First Char of (First and Last Name) and Middile Initial from Name.
Language - JS and Event - Calculate.
// Last.rawValue.charAt(0) - gets first char of the last Name
// First.rawValue.charAt(0) - gets first char of the First Name
// Middle.rawValue.charAt(Middle.rawValue.search(" ")+1) - gets Middle Initial of the Name.
this.rawValue = Last.rawValue.charAt(0) + First.rawValue.charAt(0) + Middle.rawValue.charAt(Middle.rawValue.search(" ")+1);
Example
First Name : Mathew, Last Name : Jacob, Name: Mathew Easow Jacob
Result will be : JME
Let me know if this helps ..
Vjay
Views
Replies
Total Likes
Vjay,
Good morning, and thank you for the code. It is not working right.
Are you assuming that there are 3 different fields called Lastname, Firstname, and Middlename?
There is only one field called Rater_Name, which should have a last name, first name, and middle name entered into it. This Rater_Name entered should concatenate into an initial field called RaterInitial.
I was thinking that since there are no distinct fields, that a script that will concatenate the first character of any words entered into the Rater_Name field after any space or comma could work, but I do not know how the script will look like.
Thanks
v/r
Tammy
Views
Replies
Total Likes
Hi All,
I wrote the following script to see if it will extract the first character of the Lastname in Rater-Name.
var psny=xfa[0].form[0].form1[0].page1[0].Rater_Name[0].rawValue;
form1[0].Page1[0].RaterInitial[0].rawValue=Substr(psny, 1, 1 );
It actually extract the first character of the input, however, I do not know how to add the search for the next words which will be the first name, and middle name, and also add to the code for it to rextract their first characters.
I need help with this.
Thanks
v/r
Tammy
Views
Replies
Total Likes
Tammy,
Could you please give one Rater- Name example?
I assumed the Rater - Name is "Mathew Easow Jacob"
Try below script on Rater-initial Field.
var names = Rater_Name.rawValue.split(" ");
var initials="";
for(i = 0; i<names.length; i++ ){
initials = initials +names[i].charAt(0);
}
this.rawValue = initials;
Below is the Screenshot.
Let me know if you need some more information.
Vjay
Views
Replies
Total Likes
Thanks a lot Vjay, you saved my day!
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies