Microsoft Dynamics Ax developer's blog

Tuesday, July 31, 2007

Unwanted fields fetching when selecting by unique index

UPD: Sorry, EmplTable is not good example - because of cache enabled. But this behavoiur is tested with a specially created table with CacheLookup==None.

Last friday i was optimizing a form with a lof of display fields with an implementation like the following:

display EmplName emplName()
{
return EmplTable::find(this.EmplID).Name;
}

The one of sources to increase performance of such code is to select only fields which will be used lately. So I have replaced this code with the following:

display EmplName emplName()
{
return this.EmplID ?
(select Name from EmplTable
where EmplTable.emplID==this.EmplID).Name
:
"";
}

but when I enabled SQL tracing, I found, that this code producess select with ALL fields of EmplTable.
It was strange... With a great help of my co worker, i've found the following:
  • when there is only fields of any unique index in the where condition, all fields are fetched
  • when there is an extra field in the condition, only required fields is selected (and the extra fields in where)
  • So I converted previously mentioned methods to the following:


display EmplName emplName()
{
return this.EmplID ?
(select Name from EmplTable
where EmplTable.emplID==this.EmplID
&&
EmplTable.recID
).Name
:
"";
}

Thursday, July 12, 2007

TabaxLite

TabaxLite is a stripped down version of Tabax for end users.
It is focused solely on the window management and does not require any external component



Wednesday, July 04, 2007

Hosting the Windows Workflow Foundation designer


Windows Workflow Foundation (WF) is the new MS technology. It comes with .NET framework 3.0.

It is interesting that workflow designer can be hosted by any app (here is an example).

And maybe someone can make an ActiveX which can be hosted by Axapta form (here is an example of ActiveX control implemented in C#)