Search code examples
sql-serverssisaxaptadynamics-ax-2012x++

linking OMOperatingUnit table to CompanyInfo in AX 2012


My first table temporary return result of companyInfo and the second table temporary return result of omoeratingUnit So i want to link the both table but i don't Know how can i do that .So for that i"m trying to test this query but it return 0 record.

SELECT * 
FROM DIRPARTYTABLE Party
    INNER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE Common
        ON  Common.RECID = Party.RECID
        AND Common.INSTANCERELATIONTYPE = 2376

    LEFT OUTER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE  OMOPerating 
        ON  OMOPerating.RECID   = Common.RECID
        AND OMOPerating.INSTANCERELATIONTYPE = 2377
        AND OMOPerating.RECID   = Party.RECID

    LEFT OUTER JOIN MicrosoftDynamicsAx.dbo.DIRPARTYTABLE CompanyInfo 
        ON   CompanyInfo.RECID = Common.RECID
        AND  CompanyInfo.INSTANCERELATIONTYPE = 41
        AND  CompanyInfo.RECID  = Party.RECID
        AND  CompanyInfo.DATAAREA = 'USMF'

SO is there a relation between CompanyInfo Table and OMOperatingUnit Table

Any body help in this regards.


Solution

  • AX extended tables are saved in SQL as flatted of all extended tables. So all OMOperatingUnit fields are in the same row in the DirPartyTable table.

    One record/row can be only one of the types. You can not mix CompanyInfo and OMOperatingUnit.

    OMOperatingUnit OMOperatingUnit - fields