Tuesday, February 11, 2014

Unit Conversions

Another project I worked on recently involved Unit Conversions ('Eaches' to 'Lbs'). This one was a tricky one because I wasn't sure how each unit would convert to another unit!  There could be a lot of potential conversions that would have to be made.

Fortunately AX can handle of that for us.  On the Unit conversion form:

 
The User will set up the conversions via this Form and that will determine which conversions can be made and how they are made.

When writing your modifications you can use the UnitOfMeasureConverter class that has methods of CanBeConverted and Convert.  Before converting the unit, simply check if it can be converted!

'modifiedField' on the Table or the Form?

I came across a scenario the other day where my project lead wanted certain things to happen upon a field being modified.  He also stipulated that the changes should take place on the Table if at all possible.

In doing a little research I found that if you are modifying a sys form, as I was (SalesTable), then you should avoid making changes like this to the form itself.  In this case, I was actually able to use the SalesTableType class and modify the 'modifiedField' method.  In this method you will find a switch statement:

Simply add the field you want to have things happen upon 'modifiedField' occuring.

Not all objects have a class like this.  In those cases it would be prudent to check the table of the field that you are dealing with.  You can use the 'modifiedField' method there to make things happen.

Tuesday, February 4, 2014

Label file checkout causes AX Client crash

Not sure why this occurs, but sometimes when you try and checkout a Label file via the Label editor, it will cause the AX client to crash.

The simplest solution I have found for this is going to Version Control -> Synchronization log and then Clean the log.  That should allow you to check it out!

Monday, January 27, 2014

Editing a Cheque SSRS report

Changing Cheque_US design

I recently worked on a project where I had to change the design of the standard US check.

Changing the design was relatively simple.  Run Visual Studio, find the Cheque_US in the SSRS Reports group, right click it and hit edit.  I was able to make all of my changes fairly easily.

The problem that I ran into was that if I wanted to see my changes I had to deploy the report, go to a Payment Journal, add a line in that payment journal and then finally generate a payment.  That was a lot of work to simply see how my changes affected the design.

A friend of mine helped me find a much simpler solution.  Go to Cash and bank management -> Common -> Bank Accounts and select the Set up tab.  In the Layout section, select Check and you will see the Check layout form.



There is a button at the top called 'Print Test' which will allow you to quickly see any changes you have made.  Just be sure to change the 'Check form' option to the U.S. format.

Wednesday, January 15, 2014

Form Datasource Active Record

If you have a form with DataSource MyDatasource, you can access the 'current' or active record in that datasource by simply typing MyDatasource.  .  You can then access all the fields in that record.  This came in very handy in a project I was working on.  

Tuesday, January 14, 2014

Book Recommendation

Microsoft Dynamics AX 2012 Cookbook












This is a GREAT book for beginners.  Step by step instructions along with with excellent "recipes" on how everything works.  The "recipe" is really what makes the difference for me.  A lot of books don't bother to explain each step.

 

Monday, January 13, 2014

What is a table buffer?

This probably seems like a very simple topic, however, that is what we are about here!  I was thinking about this yesterday and wondered what a table buffer REALLY is!  

CustTable custTable;

Declaring a table buffer is relatively simple and straightforward.  We can also populate that table buffer with all the records in CustTable by doing the following:

select custTable;

We now have all the CustTable records in our custTable buffer.  It is important to note that until you perform this step, custTable has NOTHING in it.  You must select records into the buffer to be able to work with them.  
Once selected, you could have more than 1 record, however, only 1 of the records will be the 'active' record in the buffer.  That means when you go to retrieve and/or set information in the record, it will be from the 'active' record.

activeRecordAccount = custTable.AccountNum;
custTable.Account = 123456;

It's important to make sure you have working with the record you want before you change it.

In summary, what is a table buffer?  I'm not sure I have an exact definition of what it is, however, a co-worker gave me the following definition:

"A class that points to a selection of records with up to one 'active' record at a time."

I think this summarizes it pretty well!  Feel free to comment or criticize!