Tuesday, August 19, 2014

Spelling errors in Office Add-In can cause wrong value substitution in table columns in R2

When you create a Word template with the Office Add-In and Word for some reason marks field names  in your columns as being misspelled, these columns aren't getting their names properly replaced with actual values when you merge the template into a document with values.

You can reproduce the problem by going through the following steps on for example a standard AX 2012 R2 demo machine.
  1. Make sure your AX user is setup to run en-us as language.
  2. Make sure that you in Word have at least one other proofing language than en-us installed.
  3. Make sure that Word uses en-us as the default proofing language.
  4. Go to Organization administration / Setup / Document Management / Documents data sources.
  5. Add the SalesLine query and activate it.
  6. Open Word.
  7. Add some text in top of the document, just to make some space to the table you are about to insert.
  8. Insert a table with two rows and five columns.
  9. Go to the Dynamics AX tab and click Add Data.
  10. Select the data source you started out setting up.
  11. Add the following fields.
    • Sales order
    • Item number
    • Quantity (ordered quantity)
    • Unit price
    • Net amount
  12. Save the document and run a Merge.
  13. That should look ok.
  14. Go back to the template, select all with Ctrl-A and change the proofing language to something other than en-us.
  15. Run a spell-check and check that it finds supposed spelling errors in your column names.
  16. Save the document and do a new Merge.
  17. Now things don't look alright.
Some screenshots:
The template

The first well done merge

The template with the new proofing language and after spell check
The not so well done merge

There are some workarounds:

  1. Keep you fields names to just on word.
  2. Run a spell-check of the template and choose to ignore all spelling errors in fields names, making the squiggly lines disappear.
  3. Use a speciel Word style, which set up to not being checked for spelling errors, for the fields.
  4. Sometimes just shortening the name of the field in the table helps; for example from "Item number" to just "Item".
Well, it is an odd issue. But now you know a probable cause if you run into it.

For some KB2904824 should fix the issue. I havn't had any luck on my systems though.
I can't reproduce the issue in R3, so it must be fair to assume that is has been fixed for R3.

Thursday, August 7, 2014

Check the SQL statement generated from a regular X++ select statement

So here is another small tip based on me reading Inside Microsoft Dynamics AX 2012 R3.

If you want to know what SQL statement the SQL Server query processor generates based on a regular X++ select statement, you can add to the keyword generateOnly to the statement and afterwards call the getSQLStatement method on the record buffer.

Example:
   AccountingEvent         accountingEvent;
   SourceDocumentHeader    sourceDocumentHeader;
   
   select generateonly accountingEvent
   join sourceDocumentHeader 
       where sourceDocumentHeader.RecId == accountingEvent.SourceDocumentHeader;

   info (accountingEvent.getSQLStatement());

That turns out something like this:


Friday, August 1, 2014

Use the Filter tab of the Find dialog

I have started to read Inside Microsoft Dynamics AX 2012 R3 and I read it from cover to cover. Sometimes you get reminded of great but forgotten features when doing so.

This time I was reminded of the Filter tab of the Find dialog. With this filter you can create any kind of boolean function to control what the tool returns of findings.

Here is a small example you can use to find methods with more that 50 lines:


Here I have used it on the SalesFormLetter class.

Tuesday, July 29, 2014

New online course: Data Management in Microsoft Dynamics AX 2012 R3

Requires access to http://itacademy.microsoft.com

This e-Learning course provides students with the necessary tools and resources to configure and use the Data Import / Export Framework and the Master Data Management Framework in Microsoft Dynamics AX 2012 R3. 

Topics covered in this eLearning course include:

  • Module 00: Course Introduction and Expert Introductio
  • Module 01: Overview of Data Management
  • Module 02: Introduction to Data Import Export Framework
  • Module 03: Migrating Data using the Data Import Export Framework
  • Module 04: Creating a Custom Entity
  • Module 05: Introduction to Master Data Management
  • Module 06: Using Master Data Management
  • Module 07: Course Review

Go to http://itacademy.microsoft.com and search for course 80645. 

Friday, July 25, 2014

New Flipboard magazine

I have created a new Flipboard magazine to hold, only, the very best articles about AX development.

You can read it here: http://flip.it/AZGSQ

Feel free to drop me a comment if you think I have missed a good article.

Tuesday, July 1, 2014

Packt's 10 Year Celebration Campaign

Packt Publishing is celebrating their first ten years by offering all its eBooks and Videos at 10$ each until July 5th.

So this is a good opportunity to get any of their Dynamics AX books you are missing in your electronic library. 

Click here to take advantage of the offer: http://bit.ly/1jFI3OK