Skip to main content

Posts

Showing posts from April, 2011

Methods of opening a browser

Mental note to self: Ways of programmatically opening a browser with a webpage in x++: infolog.urllookup('http://www.fasor.dk'); This will open the standard browser. Or WinAPI::shellExecute('iexplore.exe','http://www.fasor.dk'); This specifically opens internetexplorer. The last method can also be used for starting up 3rd party applications from Axapta.

A quick way of dumping records of a table in an xml-file.

A quick way of of dumping table records into a xml-file is to use the kernel method xml, which is present on all instances of a tablebuffer. However, the xml produced by this method is NOT well-formed. Three problems exists: No header info for the xml-document is written No root node is written The data within tags are not html escaped When the xml-method is called a call to the GLOBAL class method XMLString method is made. With a little adjustment to this method we can make the XML data output wellformed. But first you must add this method to the GLOBAL class: public static str escapeHTMLChars(str _in) {     int x;     str out;     for(x=1;x<=strlen(_in);x++)     {         if ((char2num(_in,x) < 32) && (char2num(_in,x) > 126))         {             out += '&#'+num2str(char2num(_in,x),0,0,0,0)+';';         }         else         {             out += substr(_in,x,1);         }     }     return out; } And now back to the global::XMLString m