Does C/AL has message box like Visual Basic to display the value of varibles for debugging?
No. If you are wanting such during normal processing (not using the debugger) you have to code your own. If you are using the debugger, there is a variable display function available at breakpointss, but it is very crude. And now in Attain, the debugger is so broken that it is almost impossible to use. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
Hi, not like vb but similar, while debugging the code (you have to activate Tools, Debugger, Active before executing the code you want to check) simply select C/AL Globals or C/AL Locals from the View menu which will open additional windows with the vars… that works fine with Financials, at least I use it a lot… then use F8 and F5 to debug the steps. Saludos Nils Edited by - nilsm on 2002 Jan 30 23:56:10
David, Thank you for you kind reply. I realise that the debugger is not good at all. That is why I am trying to find out other way to help me to debug.
Achen, if you are simple-minded like me, do this: As a C/AL “Message” doesn’t show up until the whole code (i.e. report) is run, use the Confirm function to get a glimpse of the value of your variables. Syntax: if confirm('First glimpse ’ + format(MyDecimalOrWhateverVariable)) then; and you will get the message as soon as the code is processed. Second best to viewing the global/local windows. Pelle
I use Pelle’s approach sometimes. I also use ERROR sometimes when I want to find out what is happening without changing my data. Or I insert Message or Confirm code then put an ERROR at the end of all the processing to let Navsision save me the trouble of recreating my test circumstances. Dave Studebaker das@libertyforever.com Liberty Grove Software A Navision Services Partner
Thanks for all your replies. They are very helpful and I appreciate all of you.
Tips & Tricks! If jou want to display the content of a record in a message or confirm, define a variable with datatype ‘Variant’. Assign the record to the variant-variable and use that in the message. Example: Message(’%1’,customerRec); will show only the first part of the record. Variant1 := CustomerRec; Message(’%1’,variant1); Will show the total record content.
You don’t have to use the datatype variant to be able to show hole record in a message box. You simply do: MESSAGE(FORMAT(MyRec)); Bjarni Thor Bjarnason Software Development Landsteinar Iceland
@Willy: looks very interesting with the variant-type. Sometimes i want to write down a whole record into an ascii-file. Is there a better way to write down the total contents of a record than to write every single item ? Stefan Weinreich Billing Analyst
Bjarni, Thank you, i was playing with the variant type to see what is possible with it. I overlooked the existing and most obvious possibility. Stefan: You can write down the total content of a record by using this method. file.WRITE(format(record))
@Willy and Bjarni: thanks, your solution works fine. I should contact the forum more often than to try myself… Stefan Weinreich Billing Analyst