Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Answered

how to reorganize infolog output

Posted on by 768

Hello,

I have written the following query and some logic inside:

public void run()
{
    while select RecId from inventSum
        where inventSum.Closed == NoYes::No &&
              (inventSum.PostedQty   inventSum.Received - inventSum.Deducted   inventSum.Registered - inventSum.Picked > 0)
        join RecId,ItemId from inventTableExpanded_ICL
             where inventTableExpanded_ICL.ItemId == inventSum.ItemId
        join RecId from inventDim
            where inventDim.inventDimId == inventSum.InventDimId
        join inventLocationId, wMSLocationId from wmsLocationIntermediate_ICL
            group by wmsLocationIntermediate_ICL.InventLocationId, wmsLocationIntermediate_ICL.WMSLocationId, inventTableExpanded_ICL.ItemId
            where wmsLocationIntermediate_ICL.InventLocationId == inventDim.InventLocationId &&
                  wmsLocationIntermediate_ICL.WMSLocationId    == inventDim.wMSLocationId
    {

        //info(strfmt("%1 %2 %3 ", wmsLocationIntermediate_ICL.InventLocationId, wmsLocationIntermediate_ICL.WMSLocationId,inventTableExpanded_ICL.ItemId));
        try
        {
            wmsOnlineCountingServer = WmsOnlineCountingServer::constructItem(inventTableExpanded_ICL.itemId, wmsLocationIntermediate_ICL.InventLocationId,
                                                                                   wmsLocationIntermediate_ICL.WMSLocationId,NoYes::Yes);
            wmsOnlineCountingServer.run();
        }
        catch (Exception::Error)
        {
            //setPrefix(strFmt("@SYS14077", inventTableExpanded_ICL.itemId));
            continue;
        }

    }
}

It gives me the following output:

6428.JPG

Instead of giving a different message for each itemid it created root element only for the first itemid and then added all messages from different itemids to the same root element. Is there any way to separate the infolog messages for each itemid?

Thanks.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: how to reorganize infolog output

    Thanks. Helped me as always your advises do))

  • Verified answer
    Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: how to reorganize infolog output

    No, I meant using setPrefix() above the loop(), not inside the loop.

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: how to reorganize infolog output

    I have added here it before try statement. I hope that's what you meant:

    public void run()
    {
        while select RecId from inventSum
            where inventSum.Closed == NoYes::No &&
                  (inventSum.PostedQty   inventSum.Received - inventSum.Deducted   inventSum.Registered - inventSum.Picked > 0)
            join RecId,ItemId from inventTableExpanded_ICL
                 where inventTableExpanded_ICL.ItemId == inventSum.ItemId
            join RecId from inventDim
                where inventDim.inventDimId == inventSum.InventDimId
            join inventLocationId, wMSLocationId from wmsLocationIntermediate_ICL
                group by wmsLocationIntermediate_ICL.InventLocationId, wmsLocationIntermediate_ICL.WMSLocationId, inventTableExpanded_ICL.ItemId
                where wmsLocationIntermediate_ICL.InventLocationId == inventDim.InventLocationId &&
                      wmsLocationIntermediate_ICL.WMSLocationId    == inventDim.wMSLocationId
        {
            setPrefix(strFmt("@SYS14077", inventTableExpanded_ICL.itemId));
            //info(strfmt("%1 %2 %3 ", wmsLocationIntermediate_ICL.InventLocationId, wmsLocationIntermediate_ICL.WMSLocationId,inventTableExpanded_ICL.ItemId));
            try
            {
                wmsOnlineCountingServer = WmsOnlineCountingServer::constructItem(inventTableExpanded_ICL.itemId, wmsLocationIntermediate_ICL.InventLocationId,
                                                                                       wmsLocationIntermediate_ICL.WMSLocationId,NoYes::Yes);
                wmsOnlineCountingServer.run();
            }
            catch (Exception::Error)
            {
                //setPrefix(strFmt("@SYS14077", inventTableExpanded_ICL.itemId));
                continue;
            }
    
        }
    }

    In that case every next itemid is inside the previous itemid message which isn't correct for me. I need a separate heading for each new itemid as it is for the very first itemid 0000000000000101900 in the screenshot below:

    Also I need only those itemids to be showed in the infolog which call error throwing but now the message with itemid will be called for all itemids even for those which don't call error throwing. Is it real to implement anything like that? If yes where to start from?

    Thanks.

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: how to reorganize infolog output

    Did you try my suggestion?

  • dark_knight Profile Picture
    dark_knight 768 on at
    RE: how to reorganize infolog output

    Hello Martin,

    Yes you are right. I have mistaken with the AX version. It's 2012. The relevant code for the infolog is in wmsOnlineCountingServer class run() method. When there is an error occurring this class throws an infolog message but it was designed for only one itemid at a time  not for many itemid as I'm trying to do. Therefor the infolog is built incorrectly in that case. I have no idea how to change this behavior.

    Thanks.  

  • Martin Dráb Profile Picture
    Martin Dráb 230,198 Most Valuable Professional on at
    RE: how to reorganize infolog output

    It seems you're talking about setPrefix(), but you're not using it in your code at all. It seems the relevant code is somewhere else.

    Maybe you'll solve your problem by using setPrefix() (for the top-level context) before actually calling your loop.

    Also, you selected "current version" as your version of AX, but this clearly isn't F&O. Isn't AX 2012 the right version?

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,198 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans