Archive

Posts Tagged ‘Labels’

Finding unused labels in Dynamics Ax 2009

March 15, 2011 Leave a comment

The pain of unused labels is felt when you start translating your application to support the global versions. As we were porting our application to German we were seeing every possible way to speed up the translation work, one of it was to avoid translating unused labels.  So we tried a few tools that helps us identify this but unfortunately nothing turned helpful. We then resorted to invent our own strategy 🙂 ….

I’m just reposting what my colleague had already posted on his blog with little more detail and a few additions …

*This job works only if your cross reference is updated*

static void FindUnUsedLabels()
{
    str 50          labelId;
    str             labelString;
    int             i;
    //set max label to the highest number of labelId in your application
    int             maxLabel = 2000;
    xRefNames       names;
    XRefReferences  ref;

    ;

    while (i <= maxLabel)  
    {
        //Sequential generation
        labelId = "@IFC" + int2str(i);
        
        //Find if the label id has an cross reference
        //record
        select recid from names
            where names.Name == labelid
        exists join ref
            where names.RecId == ref.xRefNameRecId;

        labelString = SysLabel::labelId2String(labelId);
        
        //If there is no record in cross reference then log it
        if (! names.RecId &&
        //avoid logging labels that are already deleted (This is because of sequential check like IFC1, IFC2, IFC3 etc...)
            labelString != labelId)
        {
            info(strfmt("%1 - %2\n", labelId, SysLabel::labelId2String(labelId)));
        }

        i++;
    }

}
Advertisements

Line Breaks in Label

April 9, 2010 Leave a comment

This is one problem we had often…

creating a label with line breaks. There is a solution for this here in http://axdaily.blogspot.com/2010/04/labels-with-line-breaks.html