Skip to main content

Posts

Axapta & Dynamics ax 4.0 & 2009: Formatting real-controls i AX reports using x++ code PART II

A classic problem with ERP-systems running in multinational enterprises is the formatting of amount fields in a report. One aspect of this is that the different currencies in which the different national companies of an enterprise operates can vary a lot with regards to number of digits in the amount. E.g. the exchange rate between a danish kroner and an indonesian rupiah is (at time of writing): 1 DKK - 1524,75 IDR. This would for an amount of 1 million danish kroner yield an converted amount of 1,524,750,000.75 IDR. An amount of the size can result in the Dynamics AX core returning Today I was asked by a customer, to come up with a prototype for user enabling the setting of widths of fields on a report The class that formats Real fields can be found here: http://www.fasor.dk/blogspotattachments/Class_ReportFieldControlFormatter.xpo

Recursively refreshing any calling forms with ONE method

CASE: In the project module you can create item requirements for a project (which are basically items you sell via the project). At a customer site, a customized table and form, has been added to the item requirements forms, so the customer is able to set up item specifications for each item requirement, consisting of records with different kinds of data which describes the item. A class bas been made to import a .csv-file to an set of intermediate tables where data which forms the basis of item requirements and item specifications are stored. On the item requirements form, you can call a form showing the contents of the intermediate tables and from this form you can then (via a menuitem button) call a class that facilitates population of the item requirements AND item specifications from the itermediate table. When populating the item requirements table based on the intermediate table, you deleted the contents of the intermediate table. So you have the Project form calling th...

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(...

Outlook WTF ?

A quick None AX-related post regarding strange software behaviour. I was booking my wifes work in my calendar. She works nights right now at a hospital, and I needed this in my calendar, to be able to plan in project work for my studies. She works night shifts 7 days in a row starting tuesday evening ending monday morning the following week, and this every second week. I tried to book this using reoccurence, and got an extreme amount of hours. WTF? :0)