Monday, February 20, 2012

RPC Server Is Unavailable.



Yesterday I was working on Ax reports. And suddenly a message occured .
RPC server is unavailable when I was trying to open report even AOT.

Then I found "Print Spooler" service was stoped. So I started that service and My ax application was working fine.

Thursday, December 8, 2011

By in group by is optional

public static void GroupBy(Args _args)
{
InventTable inventTable;
while select inventTable
group by itemGroupid
{
info(inventtTable.itemGroupId);
}
while select inventTable
group itemGroupId
{
info(inventTable.itemGroupId);
}

}

Here both will give same output. Really funny.

Saturday, May 7, 2011

Thursday, March 10, 2011

How to identify unused labels in application

We often creates labels in our development environment and we not use the labels.Following is a job to identify unused labels in application .

Here my label file is IFC

static void I4C_UnusedLabels(Args _args)
{
str 50 labelId;
int i;
int maxLabel = 2000;
xRefNames names;
XRefReferences ref;

str info = "LabelId#LabelStr\n"
;

while (i <= maxLabel) {
labelId = "@IFC" + int2str(i);
// The particular label file.
select recid from names
where names.Name == labelid
exists join ref
where names.RecId == ref.xRefNameRecId;

if (! names.RecId)
{
info += strfmt("%1#%2\n", labelId,
SysLabel::labelId2String(labelId));
}

i++;
}

}

Friday, August 6, 2010

How To Cache A object Globally in Ax

There are three way to cache objects.

A global cache is an instance of class - SysGlobalCache, which is nothing but a Map containing Maps with a Key. These Maps contain the actual value and a key.
In Ax, we have three Global Cache Classes

1.Infolog.globalCache()

2.Appl.globalCache()

3. ClassFactory.GlobalCache().

How to use:

static void GlobalCacheSetAndGet(Args _args)
{
SysGlobalCache globalCache;
class test;
;

globalCache = infolog.globalCache();

if (globalCache.isSet(classstr(test), 0))
{
test= globalCache.get(classstr(Test), 0);
return test;
}
else
{
test= new test();
globalCache.set(classstr(Test), 0, test);
return test;
}

}