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 :
Microsoft Dynamics AX (Archived)

How to access Store Name field?

(0) ShareShare
ReportReport
Posted on by 325

I am trying to display store information in an ePOS customized form. Right now I have Store Number from RetailStoreTable. I found that Store Name is in the OMOperatingUnit table, but only if you specifically open the table. If you look at it's fields Name is not one of them. It has a method find::Name but this method just calls OMOperatingUnit.Name.

How can I access this data?

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    fatihgork Profile Picture
    3,817 on at

    Hello,

    Name is located at DirPartyTable.

    And RetailChannelTable.OmOperatingUnit equals to DirPartyTable's RecId.

    The SQL query I wrote is:

    select distinct dpl.name,rtc.STORENUMBER from DIRPARTYTABLE dpl (nolock)

    inner join RETAILCHANNELTABLE rtc (nolock) on

    rtc.OMOPERATINGUNITID=dpl.RECID

    Hope that helps.

  • Verified answer
    Tyler1986 Profile Picture
    325 on at

    What makes this difficult is that the channel db is all that I'm aware of that the pos has access to and the channel db is a lighter weight version of the full ax db. So you are missing some fields you may see available in AX HQ but not seein the channel db. To get the store data I found the ax.retailstoretable held store id and name. I was able to access it with the following code:

    DataTable storeTable = new DataTable();
    string connString = @"Server=ServerName;Database=DBName;Trusted_Connection=True;";
    string query = "SELECT storenumber, OMOperatingUnitID FROM ax.retailstoretable";
    
    SqlConnection conn = new SqlConnection(connString); 
    SqlCommand cmd = new SqlCommand(query, conn);
    conn.Open();
    
    SqlDataAdapter da = new SqlDataAdapter(cmd);
    da.Fill(storeTable);
    conn.Close();
    da.Dispose();


    That fills the storeTable with the data from the query. But, there is a better way to get the data from a built in pos class called the datamanager. In this case we would use the storeDataManager to get store info.

    using DM = Microsoft.Dynamics.Retail.Pos.DataManager;
    
    // Gather Store data from channel DB into storeList.
                IList<Store> storeList;                
                DM.StoreDataManager storeDataManager = new DM.StoreDataManager(
                        LSRetailPosis.Settings.ApplicationSettings.Database.LocalConnection,
                        LSRetailPosis.Settings.ApplicationSettings.Database.DATAAREAID);
    
                storeList = storeDataManager.GetStores();                    
    
                DataTable storeTable = new DataTable();
                storeTable.Columns.Add("Number");
                storeTable.Columns.Add("Name");
                storeTable.Columns.Add("Address");
    
                // Populate table with Store data.
                foreach (Store store in storeList)
                {
                    storeTable.Rows.Add(store.Number, store.Name, store.Address);
                }


    This gave me a table with store number, name, and address to work with within the c# code.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans