I have a customer with Dynamics AX 2012 R2 CU7 that wants to use the SAF reports for Poland. We have setup and configured everything according to the Microsoft documentation around this. We have also installed the necessary localizations hotfixes needed. We have setup the AIF-ports which used XSL-files for transformation for all the SAF reports for Poland but we have trouble with the output for the report called "SAF VAT sales and purchase register (Poland)". The problem is in the XML report for XML element K_45.

The values in the xml file in element K_45 will be incorrect when using the XSL-file on the AIF-port. We get NaN values for K_45.

  1.  All rows in TaxInCostPrice values are filled in in an array. 
  2. An index keeps track of the array that contains all TaxInCostPrice values.
  3. For the K_45 element there is a test if the array exists.
  4. Then the value in K_45 is calculated according to the following formula:

           <xsl:when test="$TaxInCostPrice">
                  <xsl:value-of select="format-number($K_45 * ($K_46 div ($K_46 + $TaxInCostPrice[$Count])),'########0.00')"/>
                  <xsl:value-of select="format-number($K_45,'########0.00')"/>

The problem with NaN occurs when the variable Count is counted> 5 and the program tries to pick things that are not available. It occurs after

five managed lines, the first five lines will have value and on the sixth section and forward it will be NaN.

There isn´t always a value in the field TaxInCostPrice on the lines in the table TaxTrans.

How can we make the field K_45 to display the right values in the XML report?