web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

how to reorganize infolog output

(0) ShareShare
ReportReport
Posted on by 942

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.

I have the same question (0)
  • Martin Dráb Profile Picture
    237,961 Most Valuable Professional on at

    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?

  • dark_knight Profile Picture
    942 on at

    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
    237,961 Most Valuable Professional on at

    Did you try my suggestion?

  • dark_knight Profile Picture
    942 on at

    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.

  • Verified answer
    Martin Dráb Profile Picture
    237,961 Most Valuable Professional on at

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

  • dark_knight Profile Picture
    942 on at

    Thanks. Helped me as always your advises do))

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 592 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 478 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 305 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans