How can you specify that a string (definied as a code of 10 positions) will always be at position 50 when writing to a ascii-file ? Thanks
MailText := RecOnderhoudsopdracht.Omschr;
LFil_Mail.WRITE(MailText);
I want Mailtext at pos 50 in the ascii-file.
0
Comments
Regards,
Slawek
Dynamics NAV, MS SQL Server, Wherescape RED;
PRINCE2 Practitioner - License GR657010572SG
GDPR Certified Data Protection Officer - PECB License DPCDPO1025070-2018-03
Do you mean on the line or on the absolute position?
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
text1 at pos 5
text2 at pos 20
text3 at pos 30
LFil_Mail.TEXTMODE := TRUE;
LFil_Mail.WRITEMODE := TRUE;
LFil_Mail.CREATE(file);
if employee.find('-') then begin
repeat
write employee-num at pos 5, employee-name at pos 30, .... CRLF;
until employee.next = 0;
end;
LFil_Mail.CLOSE;
BTW, you can use a dataport with fixed format fields or you can also use padstr function with blank spaces and text variables as long as you need
e.g. employee no. with maxlen = 25
"Never memorize what you can easily find in a book".....Or Mibuso
My Blog
I understand you have something you would write to a file. I was just curious as to why.
You need the correct spacing because of a strict program import policy or just for the visual effect?
If the latter then why not use CSV format, open the resultant document in Excel, and cut your time consumption in half by formatting it there?
*shrug*
BlanketText := 'H1 ' +
rFormatText("No.",18) + ///PO_No
PADSTR(' ',2) +
rFormatText('R1',4) + ///PO_No_Ex
PADSTR(' ',2) +
FORMAT("Order Date",0,'<Day,2>/<Month,2>/<Year,2>') + ///PO_Date
PADSTR(' ',2) +
rFormatText("No.",24) + ///Ref_no
PADSTR(' ',2) +
rFormatText("Ship-to Name",30) + ///USE_Name
rFormatText(TxtString : Text[100];TxtLen : Integer) PadText : Text[100]
TxtLen1 := STRLEN(TxtString);
TxtVal1 := TxtLen - TxtLen1;
IF TxtVal1 < 0 THEN TxtVal1 := 0;
PadText := TxtString + PADSTR(' ',TxtVal1);
That's some information we could've used to help you with your situation.
You are aware Pickup Directory message files can be of MIME content right? Which would allow you to use HTML to create tables (and make all the data in the message(s) aligned and pretty like you want.)