Easy to Create, Easy to Change - Easy to use!


How can I right pad a text field with blank spaces


Started by Clare Bush
Search
You will need to Sign In to be able to add or comment on the forum!

How can I right pad a text field with blank spaces

Good Morning

Quick question:

How can I right pad a text field with blank spaces? I want to export a number of fields in that way.

Thank you

Written by Clare Bush 16/10/18 at 10:07:57 Dataease [{8}]FIVE

Re:How can I right pad a text field with blank spaces

Hi Clare.

There is a number of ways to achieve this.

As you are still using DataEase 8.2 I have to be a little careful as a lot of the best features just came in 8.5 (free upgrade).

It also depends on which method you are using for exporting.

If you are using the exportdata directly in form you need to create a virtual field that format the number.

You can then use FixedWidth() which was introduced in 8.0.

http://www.dataease.com/DG3_BlogList/?ParentID=000...

You then simply create a virtual field with the derivation/formatting you desire and export that field instead of the original field.

You can do the same in a traditional DQL export by using a text variable in the DQL 

define "Mynumber" text .
.
.
MyNumber := Fixedwidth(NumberField,2,10) .
.
.
list records
MyNumer ;
.
.
.export 
etc

But the best way is to use MemoExecDQL() with body and then export it ready formatted the way you want it (like DFD).

http://www.dataease.com/dg3_HelpView/?PageID=10340&field1=*MemoExecDQL*

Written by DataEase 16/10/18 at 10:11:40 Dataease [{8}]FIVE