Jump to content
  • 0

Taking first letter from field A and combining with field B to create Field C


Question

6 answers to this question

Recommended Posts

  • 0
18 hours ago, rwoolf said:

Is there a way to take the first letter from a FIRST_NAME field and combine it with the LAST_NAME field to create a new USER_NAME field?  If so, how? I have been searching for instructions on how to do this and cannot find anything. Any suggestions?

Hi,

it can be done using sql substing query in the formula field: SUBSTRING ([@field:First_name] ,1 , 1)  + SUBSTRING ([@field:Last_name] ,1, 1)

However, in case of further using username field in authentication, this is not the best option since you can using only unique field as a username.

Therefore, you may insert the following script in the footer of your submission form.

<SCRIPT LANGUAGE="JavaScript">

function concatenate()
{
var position1 = document.getElementById("InsertRecordFirst_name").value;
var position2 = document.getElementById("InsertRecordLast_name").value;


document.getElementById("InsertRecordUsername").value = position1.substring(0, 1) + position2.substring(0, 1);

}

document.getElementById("caspioform").onsubmit=concatenate;
</SCRIPT>

 

Link to post
Share on other sites
  • 0
On 7/11/2017 at 8:13 AM, Mathilda said:

 

It can be done using sql substing query in the formula field: SUBSTRING ([@field:First_name] ,1 , 1)  + SUBSTRING ([@field:Last_name] ,1, 1)

 

The above formula works if I want the first initial of both the first AND last names. However, how do I keep the FULL last name?

For example:   First_Name = Bob

                           Last_Name - Smith

                           User_name = BSmith

Link to post
Share on other sites

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.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...