How to get first character in a name.

User267
Tera Contributor

This are two fields in catalogue form.

PH last name- Mary

Check digit- when you entered something in field"PH last name" then the starting ( First character) letter of name will.

1 ACCEPTED SOLUTION

Riya Verma
Kilo Sage
Kilo Sage

Hi @User267 ,

 

 

Hope you are doing great.

 

Create on change client script on last name field and try usig below script in onchange function:

 

  var lastnameField = g_form.getValue('lastname');
  if (lastnameField.length > 0) {
    var firstCharacter = newValue.charAt(0);
    g_form.setValue('check_digit', firstCharacter);
  } else {
    g_form.clearValue('check_digit');
  }

 

 
Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

View solution in original post

11 REPLIES 11

Thank you so much

OlaN
Giga Sage
Giga Sage

Hi,

What is the purpose of the "Check digit" field?

If it always should contain the first letter of another field value, there is not really any need to create a input field for check digit, since the user should never fill out this field.

You can extract the value after the form has been filled out, without the additional variable.

Providing example on how to extract the first character from a variable with Flow designer.

store-first-char-from-catalog-variable.png