<<
What is the correct method for creating a text variable with RJS padded
spaces??
>>
Whenever R:Base encounters text with trailing spaces it automatically trims the text. That's why you don't have annoying spaces when you load data from a text field, the way you do with certain server-type databases.
If you want the text to appear to have blank spaces at the end, pad it with CHAR(160) which is a form of "hard" space that is not trimmed. For instance, for to pad a variable to length 30:
SET VAR vMyPaddedText = (.vMyText + (SFIL(CHAR(160), 30-SLEN(.vMyText))))
Alternatively, only the very last character needs to be a 160:
SET VAR vMyPaddedText = (RJS(.vMyText, 29) + CHAR(160))
Be aware that if you pass this text to other programs, those CHAR(160) characters won't be treated as spaces.
--
Larry
spaces??
>>
Whenever R:Base encounters text with trailing spaces it automatically trims the text. That's why you don't have annoying spaces when you load data from a text field, the way you do with certain server-type databases.
If you want the text to appear to have blank spaces at the end, pad it with CHAR(160) which is a form of "hard" space that is not trimmed. For instance, for to pad a variable to length 30:
SET VAR vMyPaddedText = (.vMyText + (SFIL(CHAR(160), 30-SLEN(.vMyText))))
Alternatively, only the very last character needs to be a 160:
SET VAR vMyPaddedText = (RJS(.vMyText, 29) + CHAR(160))
Be aware that if you pass this text to other programs, those CHAR(160) characters won't be treated as spaces.
--
Larry

