Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

SetPrefix function in the while select loop with the continue statement

(0) ShareShare
ReportReport
Posted on by 70

When I use setprefix function in the while select loop with the continue statement, than the behaviour is unexpected. It seems that the continue statement doesn't reset prefix level. See example below. Is it a bug?

static void TestPrefixWithContinue(Args _args)
{
    int i;
    TaxTable    taxTable;

    setPrefix("setPrefix with continue");
    while select taxTable
    {
        setPrefix(strFmt("Tax code %1", taxTable.TaxCode));
        if (i < 3)
        {
            info("Something wrong");
            i++;
            continue;
        }
        
        // Some useful code here        
        
        i++;
    }
}


*This post is locked for comments

  • Suggested answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SetPrefix function in the while select loop with the continue statement

    static void _tmp(Args _args)

    {

       int i;

       TaxTable    taxTable;

       void infomonotree()

       {

           setPrefix(strFmt("Tax code %1", taxTable.TaxCode));

           info("Something wrong");

       }

       setPrefix("setPrefix with continue");

       setPrefix("setPrefix with continue main sublevel");

       while select taxTable

       {

           if (i < 3)

           {

               infomonotree();

               i++;

               continue;

           }

           // Some useful code here        

           i++;

       }

    }

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: SetPrefix function in the while select loop with the continue statement

    This is the trick

    static void _tmp(Args _args)
    {
    int i;
    TaxTable taxTable;

    void infomonotree()
    {
    setPrefix(strFmt("Tax code %1", taxTable.TaxCode));
    info("Something wrong");
    }

    setPrefix("setPrefix with continue");
    while select taxTable
    {

    if (i < 3)
    {
    infomonotree();
    i++;
    continue;
    }

    // Some useful code here

    i++;
    }
    }

  • RE: SetPrefix function in the while select loop with the continue statement

    Yes, looks that way.

    Log a bug with support if you feel this is important to fix.

    Thanks

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,371 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans