Form Calculation widget: Truncating Text

  • USTAPNW
    Asked on September 18, 2024 at 10:58 AM

    Hello,


    How would I create a calculated field as follows:

    The input field is PL - Pine Lake.

    I would like to create a calculated field that is just PL (the text before the "-").


    Thank you.

  • Ruan JotForm Support
    Replied on September 18, 2024 at 11:34 AM

    Hi USTAPNW,

    Thanks for reaching out to us for help. I checked your account and found that you have multiple forms. Can you share with us the URL of the form you're working on so that we can check it out? It will also be helpful if you can explain a bit more about what you're trying to achieve.

    After we hear back from you, we'll be able to move forward with a solution.

  • USTAPNW
    Replied on September 18, 2024 at 12:13 PM

    My form is: 2025 NWW Team Confirmation/Captain's Agreement-Adult 40 - Jotform Form Builder



    I'm trying to create a field in teamName72 .

    It would take the abbreviation in the facility plus the fun team name (in youMay) plus the captain's last name. For example, a team that has:


    Facility PL - Pine Lake

    Fun team name Aces & Lobs

    Captain name Amit Wadha

    Would then have PL-Aces & Lobs-Wadha in the field teamname72.



  • Deanne JotForm Support
    Replied on September 18, 2024 at 1:06 PM

    Hi USTAPNW,

    You can do this by using Calculation Values and the Form Calculation widget. Let me show you how to do it:

    1. Click on the Facility field and click on the gear icon on the right.

    2. Under the Options tab, scroll a bit down and Toggle On the Calculation Values.

    3. Set Pine Lake to PL.

    Form Calculation widget: Truncating Text Image 1 Screenshot 40

    4. On the left side of the form, click on Add Element+.

    5. Under the Widgets tab, drag the Form Calculation and place it on your form.

    6. On the right panel, add the fields and format it the way you want.

    7. Be sure to click each of the element and make them gray so they will be recognized as strings.

    8. Click on Save when you're done.

    Form Calculation widget: Truncating Text Image 2 Screenshot 51

    Here's a sample result:

    Form Calculation widget: Truncating Text Image 3 Screenshot 62

    Here's also my demo form that you can clone and check out.

    Let us know if you need any more help.

  • USTAPNW
    Replied on September 18, 2024 at 1:57 PM

    Oh wow - I'm going to try this right now. Thank you.


  • USTAPNW
    Replied on September 18, 2024 at 2:03 PM

    How would I get just last name of the captain to show up instead of the full name? THanks!!!!!

  • Deanne JotForm Support
    Replied on September 18, 2024 at 2:18 PM

    Hi USTAPNW,

    The first and last name is saved as one element so you can't just pick one. As a workaround, you can instead use a Short Text element to separate the first and last name so you can only get the last name. Here's how to do it:

    1. Add Short Text elements for First Name and Last Name.

    Form Calculation widget: Truncating Text Image 1 Screenshot 40

    2. Update the Form Calculation widget to only get the Last Name and Save when you're done.

    Form Calculation widget: Truncating Text Image 2 Screenshot 51

    And that's it. Here's a sample result:

    Form Calculation widget: Truncating Text Image 3 Screenshot 62

    I made another demo form that you can clone and check out.

    Give it a try and let us know if you need any help.

Your Answer