Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

WHSLicensePlate variables not converted by user

Posted on by 200

Good morning,

We're planning to upgrade to Dynamics CU13 and something weird is occuring when we're trying to print WHS documentrouting labels. Since the upgrade the variables used in our documentrouting setup aren't converted to the values.

Example:

ZPL-error.png

I tried deleting all user data of these users through the client and through the AOT and even deleted the UAC files, but that didn't solve my problem.

The only solution I found is deleting the users and importing them again, then the process works. But that seems a little excessive ain't it?

Hopefully someone can help.

Yours,

Berthil

*This post is locked for comments

  • Verified answer
    Berthil Profile Picture
    Berthil 200 on at
    RE: WHSLicensePlate variables not converted by user

    I just went through the debugger and just realised that our users are in a different language that I am. When changing the language to 'en-us' the labels come out fine.

    Went researching further and it seems our business partner forgot to add 6 translations in the Extended Data Types that are used in the WHSLicensePlateLabel table. Since the first fieldLabel is empty, the code doesn't translate the remaining labels.

  • Berthil Profile Picture
    Berthil 200 on at
    RE: WHSLicensePlate variables not converted by user

    Dear Chrispin,

    The same code is sent to the printer so it also prints the variables on my TEST zebra printer.

    This is the code AX uses for a reprint:

    void clicked()
    {
        WHSLicensePlateLabel        whsLicensePlateLabel;
        WHSDocumentRouting          documentRouting = new WHSDocumentRouting();
        WHSContainerShipLabel       WHSContainerShipLabel;
    
        select whsLicensePlateLabel
            where whsLicensePlateLabel.ContainerId == WHSContainerTable.ContainerId;
    
        if (!whsLicensePlateLabel)
        {
            WHSContainerShipLabel = new WHSContainerShipLabel(WHSContainerTable);
            whsLicensePlateLabel = WHSLicensePlateLabel::find(WHSContainerShipLabel.buildLicensePlateLabels());
        }
    
        documentRouting.printDocument(whsLicensePlateLabel.WorkTransType, whsLicensePlateLabel);
    
    
    }

    public boolean printDocument(WHSWorkTransType _workTransType, WHSLicensePlateLabel _label)
    {
        WHSDocumentRoutingLine      routingLine;
        RefRecId                    routeRecId;
        boolean                     ret;
        str                         finalStr;
    
        routeRecId = this.getRoute(_workTransType, _label);
    
        while select LayoutId, PrinterName
            from routingLine
            where routingLine.DocumentRoutingTable == routeRecId
        {
            finalStr = this.translate(WHSDocumentRoutingLayout::find(routingLine.LayoutId).zpl, _label);
    
            Microsoft.Dynamics.AX.WHS.DeviceCom.Printer::SendStringToPrinter(routingLine.PrinterName, finalStr);
        }
    
        return ret;
    }


    So finalStr is the ZPL-code that is being built:

    str translate(str _inputStr, WHSLicensePlateLabel _label)
    {
        TmpSysTableField    tmpField;
        FieldLabel          label;
        str                 outputStr;
    
        outputStr = _inputStr;
    
        list.first(tmpField);
    
        while (tmpField.FieldLabel != '')
        {
            outputStr = strReplace(outputStr, strFmt('$%1$', tmpField.FieldName), strFmt('%1', _label.(tmpField.FieldId)));
    
            label = tmpField.FieldLabel;
    
            tmpField.clear();
    
            list.next(tmpField);
    
            if (label == tmpField.FieldLabel)
            {
                break;
            }
        }
    
        return outputStr;
    }


  • Berthil Profile Picture
    Berthil 200 on at
    RE: WHSLicensePlate variables not converted by user

    Dear Crispin,

    Yes, we use this to print to zebra printers. Our partner made a preview dialog so that I can see the label information before it is sent to the printer.

    Weird thing is that I suspect it is a usage data issue, but whenever I delete all data from the SysLastValue table and .UAC files the problem still persists.

    Yours,

    Berthil

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans