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++;
}

}