Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have a field from sql data i.e. MyField but I need it to be padded to 40 characters with trailing spaces in a chart i.e. MyFieldSSSSSSSSSSSSSSSSS
(where S is a space)
I know there are sql functions..
i.e. to pad to a certain length (20, in this example): left('MyText' & space(20), 20)
..but QV script does not like this.
Does anyone know either a script or an expression function that could achieve this please ?
Thanks in advance
Bob
Something like this: MyField & Repeat(' ', 40 - len(MyField))
Something like this: MyField & Repeat(' ', 40 - len(MyField))
Thank you - that worked perfectly !!
In addition, I would say that sometimes repeating the character ' ' is not enough to add spaces at the left for indentation because they are trimmed and ignored. In those cases, a workaround is to repeat the tab character Chr(9) instead of ' ' to get the desired indentation.
I'm trying to left pad the field with spaces with no luck, it keeps getting trimmed. Any other ideas?
Here is what I've tried:
='My Label: ' & Repeat(' ', 20-len(MY_FIELD)) & MY_FIELD
='My Label: ' & Repeat(Chr(9), 20-len(MY_FIELD)) & MY_FIELD
='My Label: ' & Repeat(" ", 20-len(MY_FIELD)) & MY_FIELD