Skip to main content

Notifications

Microsoft Dynamics AX (Archived)

check Enum value of RetailStoreTable from RetailStatementTable Form

Posted on by 2,016

i created new column in RetailStoreTable type Enum (acceptnegativevalue) and type of this enum is (NoYes) as you see here in Retail stores

64483.1.JPG

now i want check this value when i press post statement  in open statement form 

17748.2.JPG

so i edit main code of post statement for check if total Difference is negative or positive to this code

void clicked()
{
    if(Sale_M_totalDifferenceStore.realValue()>=0)
    {
    super();
    statementLine_ds.executeQuery();
    element.close();
    }
    else
    {
        info ("in this case can't accept negative value you must change case");
    }
}


so i need to check (acceptnegativevalue) first befor start my previous code

how can i add this into my code?

*This post is locked for comments

  • Verified answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: check Enum value of RetailStoreTable from RetailStatementTable Form

    If you put your current store value to where statement - yes.

    RetailStoreTable retailStoreTable;
        
    select retailStoreTable
    where retailStoreTable.StoreNumber == yourStoreId;

    if (retailStoreTable.acceptnegativevalue == NoYes::No)
  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: check Enum value of RetailStoreTable from RetailStatementTable Form

    so is that query will get the current store ?!

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: check Enum value of RetailStoreTable from RetailStatementTable Form

    No. Next you need to get the record of retailStoreTable.

    RetailStoreTable retailStoreTable;
        
    select retailStoreTable
    where ...

    if (retailStoreTable.acceptnegativevalue == NoYes::No)
  • mohammed.mqi Profile Picture
    mohammed.mqi 2,016 on at
    RE: check Enum value of RetailStoreTable from RetailStatementTable Form

    thanks for replay but i got this error

    (Variable RetailStoreTable has not been declared.)

    so i edited it to this 

    
    
    void clicked()
    {
        RetailStoreTable retailStoreTable;
        
        if (retailStoreTable.acceptnegativevalue == NoYes::No)
        {
            if(Sale_M_totalDifferenceStore.realValue()>=0)
        {
        super();
        statementLine_ds.executeQuery();
        element.close();
        }
        else
        {
            info ("in this case can't accept negative value you must change case");
        }
        
        }
        else
        {
            
        super();
        statementLine_ds.executeQuery();
        element.close();
        }
        
    }

    and error gone is that ok?!

  • Suggested answer
    Rustem Galiamov Profile Picture
    Rustem Galiamov 8,072 on at
    RE: check Enum value of RetailStoreTable from RetailStatementTable Form

    Hi!

    If you already have the record of RetailStoreTable just add this:

    if (RetailStoreTable.acceptnegativevalue == NoYes::Yes) - depends of that you need to check

    if you haven't record of RetailStoreTable, you should select the record first of all and then check the value.

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