2012-10-08

Connectivity studio for MS DAX 4.0

The company To-Increase delivers an add-on for Dynamics AX (4.0 - 2012) called Connectivity studio. I've been assigned to set up an integration to one of our suppliers and the plan is to use CS for this, or at least part of the integration. In the upcoming posts I will be writing about how-to and pitfalls on the way.

Connectivity studio and behind it conversion studio is basically an import export tool box, as a thin layer on top of that is connectivity studio, to manage connections and trigger mechanism for the import/exports.

Anyone that have been trying to get an integration to AX 4.0 using AIF knows that the AIF has some limitations. The update functionality is more or less non existing and the create functionality does take a lot of effort to get working. Connectivity studio offers a much more flexible and easy-to-use alternative, plus it is much more powerful.

Next post will be how to post a purhccase order packing slip via CS.

Calculating the weight of a shipment per delivery address and date

The Dispatch department wanted a simple solution to see the weight of the product per delivery address.
I created a temporary table in AX, a form and this method on the form


you also need this init method on the form


Add a call button on the Sales order form and overwrite the clicked method like so
As you can see by the above code, you'll need a Display menuitem.

The result should be a simple form showing the dispatch department to what address and dates they need to book transports for, and the weight.

Setting one value on header level based on line data

Some time ago I came across a interesting problem, we were measuring or delivery performance based on the whole order and not the lines itself, simply put if one line was late the whole order was to be considered late, this poses a problem as most of the data in the data warehouse was on line level.
I struggled some time before I came up with this solution, I even considered using a cursor before finally decided to go with this

select
der.[Order ID]
,case when SUM(der.Late) = 0 then 0 else 1 end as [Late]
,MAX(der.ShipDate) as [ShipDate]
,AVG(der.Days) as [AvgDays]
,COUNT(der.[Order ID]) as [NoOfTrans]
,der.DataAreaID
,der.Company
from(     
           select
           t1.[Order ID]
           ,case when DATEDIFF(dd, t1.[Last packing slip date]
,t1.[Original Confirmed Shipping Date]) < 0 then 1 else 0 end as [Late]
           ,t1.[Last packing slip date] as [ShipDate]
           ,DATEDIFF(dd, t1.[Last packing slip date]
,t1.[Original Confirmed Shipping Date]) as [Days]
           ,upper(t1.DataAreaID) as [DataAreaID]
           ,t1.Company          
           from SalesOrderStatistics t1 inner join Items t2 on t1.ItemID = t2.[Item ID] and t1.DataAreaId = t2.DataAreaID
           where t1.[Last packing slip date] >= '2011-01-01'
           and t1.[Order status] in('Delivered','Invoiced')
           ) as der
group by der.Company, der.DataAreaID, der.[Order ID]
order by der.[Order ID]

Enabeling field in forms based on other field value

Quite simple solution but something I keep forgetting how to set up.

You want to enable or disable a field in a form based on the value of a different field. here is how I solved in a recent project.

On the table add a method to check the value of the main field (field that controls the functionality)


On the field that should be eneblad, add a modified method

Finaly you need to add the same code on the Active method on the datasource of the form


Note that if you add your code prior to the call to Super() you will get unexpeted result.

Make sure the to set the field (on the form) property Autodeclaration = True
It is proabaly a god idea to base the enebaling on a boolean or enumeration expression, rather the a string value.

2012-10-04

Welcome!

Been working with IT about 12 years now and thought it was about time I share some ideas, tips and knowledge around that via this blog. It is quite common that I find tips and trick in other peoples blog, it is only fair that I share as well. Keep in mind, all code is provided as is with no warranties