Yo,
I want to export data in a file but I've to format them specially. Example:
quantity must be 10 length and filled with 0 before (or after..same problem):
12 pces = 0000000012
location code: 10 length with <space> after
LOCA1 =>'LOCA1 '
:shock:
and so on. I thought I could use the FORMAT...FILLER attribute, but I can't get the expected result.
My code sample:
//how define left/right?
//why not filled with 0
Value := FORMAT(qty,10,'<FILLER CHARACTER,0>');
f.write(value);
thanx for all incoming ideas
#### Only one can survive ######
0
Answers
Before:
Value := PADSTR('',10 - STRLEN(FORMAT(Quantity)),0) + FORMAT(Quantity);
After:
Value := PADSTR("Location Code",10,' ');
Brijesh Karnatak
tt is a variable of type OutStream.
TextFile is a Variable of type File
TextFile.CREATEOUTSTREAM(tt);
tt.WRITETEXT('H');
tt.WRITETEXT('-',8);
tt.WRITETEXT("Gen. Journal Line1"."Journal Batch Name",31);
I need H as first character and then 8 Blank Spaces, after that the Journal Batch name should start. So the Batch name should start from 10th position
and should end at 31st position. As the field length of Batch name is 10 so the remaining character should be filled with filler as blank.
Brijesh Karnatak
The correct form of formatstring is '<Integer,10><Filler Character,0>'. You have to give the datatype of expression, and its lenght. Important, it operates only the filler character after the expression datatype, as i experienced it.
So the correct form of the code: