Skip to main content

Keep trailing spaces

  • August 19, 2020
  • 3 replies
  • 1 view

Hello,

I need keep trailing spaces - uniface keeps spaces in field in form but in the processing code spaces are trimmed.

In documentation for Field Syntax is info that : Uniface can be instructed to disregard leading or trailing spaces, or convert string data to uppercase. 

But I ve found  only https://u.uniface.info/docs/0907/Search.htm?q=NDTC

NDTC

Do not delete trailing control characters.

But it seems there is nothing as NDTS (Do not delete trailing spaces) in documentation.  https://u.uniface.info/docs/0907/Search.htm?q=NDTS

(Out of curiosity I tried set NDTS in syntax field -- there is no wrong syntax error – so is this undocumented field syntax? Nevertheless this  doesn't work.)

Any hint how to keep triling spaces in field in code?

Thanks 
Petr

3 replies

  • Rocketeer
  • August 19, 2020

Hello,

I need keep trailing spaces - uniface keeps spaces in field in form but in the processing code spaces are trimmed.

In documentation for Field Syntax is info that : Uniface can be instructed to disregard leading or trailing spaces, or convert string data to uppercase. 

But I ve found  only https://u.uniface.info/docs/0907/Search.htm?q=NDTC

NDTC

Do not delete trailing control characters.

But it seems there is nothing as NDTS (Do not delete trailing spaces) in documentation.  https://u.uniface.info/docs/0907/Search.htm?q=NDTS

(Out of curiosity I tried set NDTS in syntax field -- there is no wrong syntax error – so is this undocumented field syntax? Nevertheless this  doesn't work.)

Any hint how to keep triling spaces in field in code?

Thanks 
Petr

Hello Petr,

I (currently) know two possibilities to "keep" trailing spaces:

  • Surround the string with (e.g.) double quotes when entering data in a field; the double quotes can then be removed or ignored in code; this, however, requires the cooperation of the user
  • Use the Deformat trigger and $format: "This trigger is the only trigger that allows the developer to access the raw external data entered by the user. In any other trigger, references to the field refer to the internal format data."

Trailing spaces are always removed from the internal format data (this is when e.g. accessing the field value in code). This behavior is by design.

I hope this helps.

Kind regards,
Daniel


Forum|alt.badge.img
  • Participating Frequently
  • August 19, 2020

Hello,

I need keep trailing spaces - uniface keeps spaces in field in form but in the processing code spaces are trimmed.

In documentation for Field Syntax is info that : Uniface can be instructed to disregard leading or trailing spaces, or convert string data to uppercase. 

But I ve found  only https://u.uniface.info/docs/0907/Search.htm?q=NDTC

NDTC

Do not delete trailing control characters.

But it seems there is nothing as NDTS (Do not delete trailing spaces) in documentation.  https://u.uniface.info/docs/0907/Search.htm?q=NDTS

(Out of curiosity I tried set NDTS in syntax field -- there is no wrong syntax error – so is this undocumented field syntax? Nevertheless this  doesn't work.)

Any hint how to keep triling spaces in field in code?

Thanks 
Petr

Hi Petr,

Seems to work with data type is "raw data" too.

Kind regards,

Gilles.



Ingo Stiller
Forum|alt.badge.img+3
  • Participating Frequently
  • August 20, 2020

Hello,

I need keep trailing spaces - uniface keeps spaces in field in form but in the processing code spaces are trimmed.

In documentation for Field Syntax is info that : Uniface can be instructed to disregard leading or trailing spaces, or convert string data to uppercase. 

But I ve found  only https://u.uniface.info/docs/0907/Search.htm?q=NDTC

NDTC

Do not delete trailing control characters.

But it seems there is nothing as NDTS (Do not delete trailing spaces) in documentation.  https://u.uniface.info/docs/0907/Search.htm?q=NDTS

(Out of curiosity I tried set NDTS in syntax field -- there is no wrong syntax error – so is this undocumented field syntax? Nevertheless this  doesn't work.)

Any hint how to keep triling spaces in field in code?

Thanks 
Petr

Hi Petr

Maybe thie will help:
https://en.wikipedia.org/wiki/Non-breaking_space
In format-trigger replace all "normal" spaces by "non breaking spaces"
Didn't test it, but this blanks should be safe not to be removed :-)

Ingo