Formatting Using Code in AX 2009 using X++


Can anyone help in formatting in X++

Please help me understaning and formatting the following code

chequeSlipTxt += strfmt(’%1 %2 %3 %4 %5 %6**\r\n’,**
num2str(-custTrans.AmountCur, 16, 2, -1, -1),

My scenario is right now Invoice date is printing at top of the page but I want to take it to bootom of the page.

1- I want to know How can I take just invoice Date to bottom of the page so that it print at desired place I want.

2- what does \r\n’, mean in X++

3- what does 15 mean in code "strLFix(custTrans.Invoice,15"

4- what does “16, 2, -1, -1” mean in code “num2str(-custTrans.AmountCur, 16, 2, -1, -1)”,

Any help will be highly appreciated.

Thanks & Regards


\n is used for new line

what does 15 mean in code "strLFix(custTrans.Invoice,15"

it prints only the 15 characters from the left of a string value…



16 is the length of the string

2 is the number of decimals

-1 and -1 are the separators before and for the decimal place.

Thanks Kranti, You are simply awesome. I think what I ll do I ll pass multiple n n n to bring the invoice date to bottom of the page. It should work right?

Where you are using this code - and for what? If you want to print the date at bottom - print it separately…

Hi Kranti

I am using this in class custvendcheque where vendor payment detail are printed on the cheque. my client is having pre printed cheque format with all boxes for vendor payment detail like invoice no. invoice date total of all the lines etc. Since in std cheque these are not aligned and payment detail is coming through slipTxt code I was aligning through code.

can you also help me in making alignment fix because even though through new line (/n/n) I am able to insert line and taken Total amount at the bottom of cheque. but when I settle more then 2 invoice and those number of lines are printed on the cheque my Total Amount also go Down

and as lines increases total amount field also go down with each line. Can I make Total Amount Field Fix This is the Code I am having with for total amount

if (!totalPrinted && totalLines == lines &&
(_chequeFormType == ChequeFormType::USStyle ||
_chequeFormType == ChequeFormType::MXStyle ||
_chequeFormType == ChequeFormType::CAStyle)
chequeSlipTxt += strfmt(’\n\n%1 %2’,
strLFix(" . ",66),
num2str(totalAmountCur,16, 2, -1, -1));

Thanks & Regards