IT tutorials
 
Technology
 

Microsoft Dynamic AX 2009 : The Database Layer - Company Accounts

8/22/2013 9:32:53 AM
- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019

The business and system information in Dynamics AX is associated with company accounts and their interactions with the database tables. Several company accounts can share the same database infrastructure and use the same application logic. However, each company account must have its own set of data that other company accounts can’t directly access. Tables can contain information that can be reused by several company accounts. The design of company accounts involves the following elements:

  • Companies A company account can be based on one or more virtual company accounts. When you add data to a table that isn’t in a virtual company account, the data is stored directly in the company account.

  • Virtual companies A virtual company account is a collection of data from several company accounts that is common to all the companies and uses a list of one or more table collections to define the tables that it contains. The data in the tables included in the table collections is stored in the virtual company account. The user can’t work directly in a virtual company account, but the contents of the shared tables can be changed through the company account.

  • Table collections A table collection is a specification of a list of table names. Table collections define a graph of tables that have no foreign key relationships with tables outside the table collection. Developers define table collections. Each table and view in the system can occur only once in any one table collection, but tables and views can be added to more than one table collection. A table collection stores no table data; only companies and virtual companies store data.

The Dynamics AX application runtime uses these components to provide a powerful framework for integrating and optimizing the available and required business data across the enterprise, allowing chosen processes and structures to be centralized. The virtual company feature also improves data integrity because identical information is administrated only once and doesn’t have to be saved in multiple companies. Another significant benefit is that users don’t perceive the virtual company as a separate company account because it is completely transparent to users who are using the current company account.

Figure 1 illustrates how three virtual company accounts interact with company accounts and how a virtual company account can have multiple table collections associated with the individual virtual company account. Company AAA and Company BBB share the maintenance of currencies, whereas Company CCC and Company DDD share the chart of accounts. All companies share the maintenance of zip codes and countries. The last virtual company account also shows how company accounts can use multiple virtual company accounts.

Figure 1. Company account overview


Company accounts translate the organizational structures of the enterprise into elements that can be configured using Dynamics AX applications. Building the company structures by using company accounts involves the following straightforward steps:

1.
Create company accounts.

2.
Create table collections.

3.
Create virtual company accounts and associate the company accounts.

When you create a table collection, the foreign keys must not be part of the table in a virtual company where the key is in the (nonvirtual) company. When developing the table collection, you might have to adjust the data model to get the full benefit of the collection. Figure 2 shows the location of the table collection within the AOT and the tables included in the particular table collection.

Figure 2. Table collections in the AOT


Identification

Company accounts are identified by any four characters within the Unicode-supported character set in arbitrary combination, covering both real company accounts and virtual company accounts. So the Dynamics AX application can host thousands of companies within the same database using the same application logic. When choosing identification characters, be aware of characters that can affect the generated SQL statement (such as reserved words, !, ‘’ and “”) because the company identifier is an important part of the statement.

The DataArea table the application runtime uses when saving data stores information about company accounts. The SaveDataPerCompany table property determines, on a table level, whether data should be saved per company or exist as general available data without company account affiliation. If the property is set to Yes, the DataAreaID column is applied automatically for storing the company account reference.

The data flow diagram in Figure 3 illustrates how records are evaluated before they are inserted into tables. The process for inserting records into non-company-specific tables is important to recognize because data is related across companies, installation, database, AOT, tracing, or OLAP and is therefore accessible from all company accounts.

Figure 3. Data flow diagram for inserting data


Changing the Company Account

You can change the company account context at run time by using multiple methods, but you can also change the context at startup by using the configuration utility or by adding a company parameter directly in the application shortcut. Within the application runtime, users can launch the selection form to change the context by double-clicking the company name in the system’s status bar or by clicking File\Open\Company on the menu bar.

Changing the company account from within the code is even more interesting when working across company accounts, such as with consolidations, sales between operations, or multisite planning. MorphX supports changing of the company account by using the changeCompany function in X++, which also exists as a reserved keyword. The changeCompany statement alters the database settings to another (separate) company account. Here is the syntax of the statement.

changeCompany ( expression ) { statement }


In this statement, expression is a string that defines the company to be used. The statement is executed on the new company. The following code example shows how to use the changeCompany statement.

static void main()
{
    CustTable custTable;
    ;

    // Assume that we are running in company 'dat'.
    changeCompany('dmo') // Default company is now 'dmo'.
    {
        custTable = null;
        while select custTable
        {
            // custTable is now selected in company 'dmo'.
        }
    }
    // Default company is now set back to 'dat'.

    changeCompany('int') // Default company is now 'int'.
    {

    // Clear custTable to let the select work on the new default company.
        custTable = null;

        while select custTable
        {
            // custTable is now selected in company 'int'.
        }
    }
    // Default company is now 'dat' again.
}

					  


The changeCompany function is heavily used by the classes tagged InterCompany*, but you can also find it elsewhere.

External Accessibility

You can access the company-specific data in Dynamics AX from external sources by using COM Business Connector or .NET Business Connector and the X++ application logic for extracting or modeling the required data sets, or by using the Application Integration Framework (AIF). You can also access the data by interacting directly with the database.

Consultants often prefer to work directly with the database because they usually know the database tools well but sometimes don’t have experience with Dynamics AX. This approach can be challenging, however, if virtual company accounts are part of the company account data set. The database doesn’t include any information about references between company accounts and virtual company accounts.

You can use business views to expose a collection of data as self-contained database views that provide an accurate picture of a company’s status translated into human-readable format. Using business views can also provide valuable details about natively calculated fields (based on either edit or display methods), numeric field values, grouping of data, and company accounts, thereby increasing the data visibility for external parties. The Dynamics AX administrator defines and populates the business view to the database for further external processing. Creating business views doesn’t necessarily require changes to the application logic or Data Dictionary because the views are created from the application side and are data driven. Business views use existing tables and views from the AOT, but they create new database views within the same transactional database that the application runtime uses.

Here is the process for creating business views:

1.
Create database view prefixes.

2.
Manage the virtual company accounts from within the business views.

3.
Define the company accounts collection.

4.
Define groups of particular values, such as colors, numbers, and text.

5.
Define calculated fields by company accounts.

6.
Manage the numeric field values.

7.
Create and define the business view.

8.
Synchronize the created business view with the database.
 
Others
 
- Microsoft Dynamic AX 2009 : The Database Layer - Record Identifiers
- SQL Server 2008 R2 : Filtered Indexes and Statistics - Creating and Using Filtered Indexes
- SQL Server 2008 R2 : Index Design Guidelines - Indexed Views, Indexes on Computed Columns
- SQL Server 2008 R2 : Index Design Guidelines
- Windows Server 2008 : Manipulating Users and Groups with the net Command, Modifying NTFS Permissions with icacls
- Windows Server 2008 : Manipulating Shares with net share, Mapping Drives with net use
- Windows Server 2008 : Manipulating Shadow Copies with vssadmin
- Windows 7 : Disk Management (part 3) - Creating a Striped Volume, Creating and Attaching VHDs
- Windows 7 : Disk Management (part 2) - Dynamic Disk Management, Extending a Disk, Creating a Spanned Volume
- Windows 7 : Disk Management (part 1) - Assigning Drive Letters and Joining Volumes
 
 
Top 10
 
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
Technology FAQ
- Is possible to just to use a wireless router to extend wireless access to wireless access points?
- Ruby - Insert Struct to MySql
- how to find my Symantec pcAnywhere serial number
- About direct X / Open GL issue
- How to determine eclipse version?
- What SAN cert Exchange 2010 for UM, OA?
- How do I populate a SQL Express table from Excel file?
- code for express check out with Paypal.
- Problem with Templated User Control
- ShellExecute SW_HIDE
programming4us programming4us