Assistance with a formula script

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • BigBoss
    Member
    • Nov 2023
    • 86

    Assistance with a formula script

    How can I extract the first letter of the first name, the first letter of the last name, and the last letter?

    And here's the example with your case:

    First name: John
    Last name: DOUNMINIC

    Desired result: JDC

    The corrected sentence would be:

    I tried this code, but it doesn't work


    PHP Code:
    
    prenom= "John";
    nom= "DOUNMINIC";
    
    first_letter_prenom = LEFT(prenom, 1); 
    first_letter_nom = LEFT(nom, 1); 
    last_letter_nom = RIGHT(nom, 1); 
    
    someField = string\concatenate(first_letter_prenom, first_letter_nom, last_letter_nom); / 
    
  • item
    Active Community Member
    • Mar 2017
    • 1476

    #2
    Hi,

    PHP Code:
    $value = string\substring(name, -1, 1);  <---- last char
    output\print($value);​
    
    
    $value = string\substring(name, 0, 1);  <---- first char
    output\print($value);
    You can test on demo
    If you could give the project a star on GitHub. EspoCrm believe our work truly deserves more recognition. Thanks.​

    Comment

    • esforim
      Active Community Member
      • Jan 2020
      • 2204

      #3
      Be sure to change name field to nom and prenom

      Comment

      Working...