0

How can a count the number of letters and space in a field ?

How can a count the number of letters and space in a field ?
What i need to do is to complete a field always with 50 letters or spaces. 
Exemple: "Home" is a 4 letter word. The field should be completed with "Home" and 46 white space. 

Is any way to do that ? 

5 replies

null
    • Sean
    • 4 yrs ago
    • Reported - view

    You can enter this in "Trigger after update" of the Text field...

     

    YourField := rpad(YourField, 50, " ")

    • vacunasrls
    • 4 yrs ago
    • Reported - view

    Thank you for halping!

    Is there any way to use it in a formula ? I have to creare a file .txt where different information must be one next to the other using a specific lenth of spaces. 
    as example of two information:

    Name and Surname ( Name 30 characters) ( Surname 50 characters) 

    - "Marco" + 25 white spaces "Rossi" + 45 white spaces 

    - "Antonio" + 23 white spaces "Ventimis" + 42 white spaces  

    I will take Name and Surname from two different field. 

    • vacunasrls
    • 4 yrs ago
    • Reported - view

    I need this to work with number field too

    • Sean
    • 4 yrs ago
    • Reported - view

    In a formula field you could use this...

     

    rpad(Name, 30, " ") + rpad(Surname, 50, " ")

     

    When you enter the space, you need to use option+space. To use rpad() with a number you would need to convert the number to text...

     

    rpad(text(NumberField), n, " ")

    • vacunasrls
    • 4 yrs ago
    • Reported - view

    it seems to work! thank you so much! 

Content aside

  • 4 yrs agoLast active
  • 5Replies
  • 1363Views