filler and filler character attribute:how does it work?

wicwic Member Posts: 96
edited 2011-08-24 in Navision Attain
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 ######

Answers

  • Torben_R.Torben_R. Member Posts: 99
    Try the PADSTR instead:

    Before:
    Value := PADSTR('',10 - STRLEN(FORMAT(Quantity)),0) + FORMAT(Quantity);

    After:
    Value := PADSTR("Location Code",10,' ');
  • BrijeshKarnatakBrijeshKarnatak Member Posts: 26
    I have the similar problem can any one assist on this.
    Thanks & Regards
    Brijesh Karnatak
  • BrijeshKarnatakBrijeshKarnatak Member Posts: 26
    In my Case I am explaining a scenario.

    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.
    Thanks & Regards
    Brijesh Karnatak
  • atis123atis123 Member Posts: 8
    Value := FORMAT(qty,10,'<FILLER CHARACTER,0>');

    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:
    Value:=FORMAT(qty,10,'<Integer,10><Filler Character,0>');
    
Sign In or Register to comment.