You are viewing limited content. For full access, please sign in.

Question

Question

How do you pad a text field on the right with spaces in Forms?

asked on September 23, 2020

Hi, there. I'm relatively new to Laserfiche, so this may be obvious to many, but this should not be as difficult as it has been.

I have a field on a form which needs to be padded to a specific size... in my case, 35 characters.

As an example...

I would expect this to result in "|Test                                   |", but the extra spaces are removed...

Using non-whitespace characters such as _ results in the expected results.

Is this a bug or a feature? How do I get trailing spaces in the data?

0 0

Replies

replied on September 23, 2020

What is your goal for making each field 35 characters wide? If you are trying to get it formatted nicely on the form, there probably is a better way than trying to add arbitrary white space characters. 

0 0
replied on September 23, 2020

I agree there are probably better ways to format the data on the form - line breaks, for example. Unfortunately, the legacy system we are interfacing with requires each field to be exactly 35 characters.

0 0
replied on September 23, 2020

Hi Cal,

 

You can use the pattern to get exact 35 char (but the user shoul write himself the 35 char)

Use this expression : .{35} (don't forget the dot at the begining)

 

 

 

If you cant to complete your begining text with more space, the workflow is better.

 

In your workflow just add 35 spaces " " at right of your value, then just keep 35 first characters.

E.G : value = "Test"

add 35 " " => "Test                                   " (total 35 + 4 characters)

get the 35 first characteres => "Test                               " (total 35 characters)

0 0
replied on September 25, 2020

Thanks for the tip, Olivier. I'll give that a try.

The field I am working with is actually 2 lines of 35 characters each, being populated from 2 separate values. The calculation for the field takes the first value, adds 35 characters, then takes the first 35 characters from the result, then repeats the process with the second field.

i.e. =left(<val1>&REPT(" ",35),35)&left(<val2>&REPT(" "),35)

Unfortunately, the extra spaces are removed when the the final result is placed in the form field.

0 0
replied on September 25, 2020

Hi Cal,

 

I tried your way but you have some restrictions.

1st : the first character should not be a space,

2nd : dont use the function "rept" (write espace 35 times)

3th : use function concatenate

 

=CONCATENATE(Ligne_1,"          ",Ligne_2)

 

0 0
replied on September 25, 2020

How are you interfacing into the other system from Forms?  Are you using Workflow, Connector, or another method?  You may not need it padded in Forms if you are using another system that you can format the token coming out of forms.

1 0
replied on September 28, 2020 Show version history

Nope, that doesn't work either... it still removes the extra spaces.

 

=CONCATENATE(LEFT(CONCATENATE(ServiceDescription,"                                   "),35),LEFT(CONCATENATE(ServiceInformation,"                                   "),35))

 

The application is looking for a string of characters pre-formatted to multiple 35 character lines.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.