Показать сообщение отдельно
Старый 29.03.2006, 13:56   #1  
Maxim Gorbunov is offline
Maxim Gorbunov
Administrator
Соотечественники
Лучший по профессии 2009
 
2,483 / 645 (26) +++++++
Регистрация: 27.11.2001
Адрес: Dubai, UAE
The X++ Print Statement (by Sharon E. Cannon)
Цитата:
Posted on 28-Mar-2006 at microsoft.public.axapta.programming by Sharon E. Cannon

When I'm writing a job to test something or to update some data, I know that
I can use the PRINT command to print to the screen. But sometimes I'd like
to print to a printer instead, so that I can keep a hard copy of what I've
done.

My background is Visual Basic, and I know that in VB I can just use

Printer.Print

But I've looked all through the Axapta developer's guide and the few X++
books that we have here, and I cannot find an equivalent command in X++.
I'm sure that it's something simple, but I'm just not seeing it. The
closest thing I've found is the ReportOutputUser class, but it seems to be
designed for reports.

Can anyone help me, please? Thanks!
Try using the info() function instead of the print statement. There is a disadvantage - you only can output strings with this function. But there is the strfmt() function which can convert any data to string and format it accordingly. Take a look at my example:
X++:
int x = 1;
real y = 2.55;
;
info(strfmt("x = %1, y = %2", x, y)); // x = 1, y = 2.55
info() function will open the Infolog window and collect all your messages there. This window can be printed out by clicking on the printer button in toolbar.

For more information on strfmt(), open AOT and go to System documentation/Functions/strfmt
__________________
Not registered yet? Register here!
Have comments, questions, suggestions or anything else regarding our web site? Don't hesitate, send them to me