Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX (Archived)

AX Query how to add mutli-DataSource

Posted on by 305

Hello,

My SQL is

select P.ATMA_SUBCONTRACTORVENDOR , PJ.ORDERACCOUNT ,P.PURCHNAME ,V.TAXGROUP ,V.PAYMTERMID ,V.CURRENCY , PJ.PURCHID ,PL.LINENUMBER , PT.ITEMID ,PT.NAME ,PL.PURCHQTY ,PT.QTY ,PL.REMAININVENTFINANCIAL , P.INCLTAX ,PL.PURCHPRICE ,PJ.PACKINGSLIPID ,PJ.DELIVERYDATE
from ((VENDPACKINGSLIPJOUR as PJ left join VENDPACKINGSLIPTRANS as PT on PJ.RECID = PT.VENDPACKINGSLIPJOUR) join (PURCHTABLE as P join VENDTABLE as V on P.ORDERACCOUNT = V.ACCOUNTNUM) on P.PURCHID = PJ.PURCHID) join PURCHLINE as PL on P.PURCHID = PL.PURCHID and PT.ITEMID = PL.ITEMID
where P.ATMA_SUBCONTRACTORVENDOR=1 and PJ.ORDERACCOUNT = 'TP011' and PJ.DELIVERYDATE >= '2018/11/20' and PJ.DELIVERYDATE <= '2019/1/20' and PL.REMAININVENTFINANCIAL <>0
order by PJ.ORDERACCOUNT,PJ.DELIVERYDATE

Please help to build the AX Query.

Thanks in advance.

Br, Jen

*This post is locked for comments

  • Verified answer
    nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: AX Query how to add mutli-DataSource

    Remove the prompt() call from your code. Then the job should work (this will not fix the query, just allows you to test it in the job).

    What data type is the field that you have added as query range? Is it an enum? What value did you assign to that range?

    Does your query work if you remove the range?

  • ATMA-Jen Profile Picture
    ATMA-Jen 305 on at
    RE: AX Query how to add mutli-DataSource

    Hello Nikolaos,

    I Try the example: docs.microsoft.com/.../gg923354(v=ax.60)

    I paste the script in AX Job, and get the below Error:

    Stack trace: Calling wait or detach before calling run.

    Stack trace

    (C)\Classes\FormRun\wait

    (C)\Classes\QueryRun\prompt

    (C)\Jobs\Jen_QueryExample - line 8

  • ATMA-Jen Profile Picture
    ATMA-Jen 305 on at
    RE: AX Query how to add mutli-DataSource

    Hello,

    Please help and Thanks a lot.

    The Erroe messages:

    1.

    Cannot select a record in Vendor product receipts (VendPackingSlipJour).
    The SQL database has issued an error.

    2.

    SQL error description: [Microsoft][SQL Server Native Client 11.0][SQL Server] An error occurred while converting the data type from nvarchar to bigint.

    3.

    SQL statement: SELECT T1.PURCHID,T1.ORDERACCOUNT,T1.INVOICEACCOUNT,T1.PACKINGSLIPID,T1.INTERCOMPANYPOSTED,T1.DELIVERYDATE,T1.DELIVERYNAME,T1.DELIVERYPOSTALADDRESS,T1.COUNTRYREGIONID,T1.INTRASTATDISPATCH,T1.DLVTERM,T1.DLVMODE,T1.DELIVERYTYPE,T1.PURCHASETYPE,T1.RETURNITEMNUM,T1.FREIGHTSLIPNUM,T1.FREIGHTSLIPTYPE,T1.ITEMBUYERGROUPID,T1.REQATTENTION,T1.NUMBERSEQUENCEGROUP,T1.INTERCOMPANYCOMPANYID,T1.INTERCOMPANYSALESID,T1.LANGUAGEID,T1.DOCUMENTDATE,T1.DEFAULTDIMENSION,T1.SOURCEDOCUMENTHEADER,T1.REQUESTER,T1.RECVERSION,T1.PARTITION,T1.RECID,T2.PURCHID,T2.PURCHNAME,T2.ORDERACCOUNT,T2.INVOICEACCOUNT,T2.FREIGHTZONE,T2.EMAIL,T2.DELIVERYDATE,T2.DELIVERYTYPE,T2.ADDRESSREFRECID,T2.ADDRESSREFTABLEID,T2.INTERCOMPANYORIGINALSALESID,T2.INTERCOMPANYORIGINALCUSTACCOUNT,T2.CURRENCYCODE,T2.PAYMENT,T2.CASHDISC,T2.INTERCOMPANYDIRECTDELIVERY,T2.VENDGROUP,T2.LINEDISC,T2.DISCPERCENT,T2.PRICEGROUPID,T2.MULTILINEDISC,T2.ENDDISC,T2.INTERCOMPANYCUSTPURCHORDERFORMNUM,T2.TAXGROUP,T2.DLVTERM,T2.DLVMODE,T2.PURCHSTATUS,T2.MARKUPGROUP,T2.PURCHASETYPE,T2.URL,T2.POSTINGPROFILE,T2.TRANSACTIONCODE,T2.SETTLEVOUCHER,T2.INTERCOMPANYALLOWINDIRECTCREATION,T2.INTERCOMPANYORIGIN,T2.CASHDISCPERCENT,T2.DELIVERYNAME,T2.COVSTATUS,T2.PAYMENTSCHED,T2.INVENTSITEID,T2.ONETIMEVENDOR,T2.RETURNITEMNUM,T2.FREIGHTSLIPTYPE,T2.DOCUMENTSTATUS,T2.CONTACTPERSONID,T2.INVENTLOCATIONID,T2.ITEMBUYERGROUPID,T2.PROJID,T2.PURCHPOOLID,T2.VATNUM,T2.PORT,T2.INCLTAX,T2.NUMBERSEQUENCEGROUP,T2.LANGUAGEID,T2.AUTOSUMMARYMODULETYPE,T2.TRANSPORT,T2.PAYMMODE,T2.PAYMSPEC,T2.FIXEDDUEDATE,T2.STATPROCID,T2.VENDORREF,T2.INTERCOMPANYCOMPANYID,T2.INTERCOMPANYSALESID,T2.INTERCOMPANYORDER,T2.RETURNREASONCODEID,T2.RETURNREPLACEMENTCREATED,T2.REQATTENTION,T2.DEFAULTDIMENSION,T2.CONFIRMEDDLVEARLIEST,T2.CHANGEREQUESTREQUIRED,T2.REASONTABLEREF,T2.DOCUMENTSTATE,T2.ISMODIFIED,T2.MATCHINGAGREEMENT,T2.SYSTEMENTRYSOURCE,T2.SYSTEMENTRYCHANGEPOLICY,T2.MANUALENTRYCHANGEPOLICY,T2.WORKERPURCHPLACER,T2.DELIVERYPOSTALADDRESS,T2.BANKDOCUMENTTYPE,T2.LISTCODE,T2.ISENCUMBRANCEREQUIRED,T2.SOURCEDOCUMENTLINE,T2.SOURCEDOCUMENTHEADER,T2.REQUESTER,T2.ACCOUNTINGDISTRIBUTIONTEMPLATE,T2.ACCOUNTINGDATE,T2.FINALIZECLOSINGDATE,T2.SERVICENAME,T2.SERVICEADDRESS,T2.ONETIMESUPPLIER,T2.SERVICEDATE,T2.CONFIRMEDDLV,T2.FSHAUTOCREATED,T2.CROSSDOCKINGDATE,T2.SERVICECATEGORY,T2.AVAILSALESDATE,T2.LOCALDELIVERYDATE,T2.REPLENISHMENTLOCATION,T2.RETAILRETAILSTATUSTYPE,T2.RETAILDRIVERDETAILS,T2.RETAILCONCESSIONPURCH,T2.CONFIRMINGPO,T2.MCRDROPSHIPMENT,T2.GUIDEDUCTIONCODE,T2.GUIVATNUMBER,T2.GUITITLE,T2.EXCHANGERATEDATE,T2.TAMVENDREBATEGROUPID,T2.GUIREPORTCODE,T2.ATMA_SUBCONTRACTORVENDOR,T2.CREATEDDATETIME,T2.CREATEDBY,T2.RECVERSION,T2.PARTITION,T2.RECID,T3.PURCHID,T3.ITEMID,T3.PURCHSTATUS,T3.SHIPPINGDATEREQUESTED,T3.DELIVERYDATE,T3.NAME,T3.TAXGROUP,T3.QTYORDERED,T3.PURCHRECEIVEDNOW,T3.REMAINPURCHPHYSICAL,T3.REMAINPURCHFINANCIAL,T3.PRICEUNIT,T3.PURCHPRICE,T3.CURRENCYCODE,T3.LINEPERCENT,T3.LINEDISC,T3.LINEAMOUNT,T3.EXTERNALITEMID,T3.PURCHUNIT,T3.CONFIRMEDDLV,T3.ADDRESSREFRECID,T3.INVENTTRANSID,T3.VENDGROUP,T3.VENDACCOUNT,T3.ADDRESSREFTABLEID,T3.PURCHQTY,T3.PURCHMARKUP,T3.INVENTRECEIVEDNOW,T3.MULTILNDISC,T3.MULTILNPERCENT,T3.PURCHASETYPE,T3.COVREF,T3.REMAININVENTPHYSICAL,T3.TAXITEMGROUP,T3.TRANSACTIONCODE,T3.SHIPPINGDATECONFIRMED,T3.TAXAUTOGENERATED,T3.UNDERDELIVERYPCT,T3.OVERDELIVERYPCT,T3.BARCODE,T3.BARCODETYPE,T3.INVENTREFID,T3.INVENTREFTRANSID,T3.ITEMREFTYPE,T3.PROJTRANSID,T3.BLOCKED,T3.COMPLETE,T3.REQPLANIDSCHED,T3.REQPOID,T3.ITEMROUTEID,T3.ITEMBOMID,T3.LINEHEADER,T3.SCRAP,T3.RETURNACTIONID,T3.INTERCOMPANYORIGIN,T3.PROJCATEGORYID,T3.PROJID,T3.INVENTDIMID,T3.TRANSPORT,T3.STATPROCID,T3.PORT,T3.ASSETID,T3.ASSETTRANSTYPEPURCH,T3.ASSETBOOKID,T3.PROJLINEPROPERTYID,T3.PROJTAXITEMGROUPID,T3.PROJTAXGROUPID,T3.PROJSALESPRICE,T3.PROJSALESCURRENCYID,T3.INTERCOMPANYINVENTTRANSID,T3.PROJSALESUNITID,T3.DELIVERYNAME,T3.DELIVERYTYPE,T3.CUSTOMERREF,T3.CUSTPURCHASEORDERFORMNUM,T3.STATTRIANGULARDEAL,T3.ITEMTAGGING,T3.CASETAGGING,T3.PALLETTAGGING,T3.REMAININVENTFINANCIAL,T3.PURCHREQLINEREFID,T3.ACTIVITYNUMBER,T3.RETURNSTATUS,T3.RETURNDISPOSITIONCODEID,T3.CREATEFIXEDASSET,T3.ASSETGROUP,T3.REQATTENTION,T3.PURCHREQID,T3.MATCHINGPOLICY,T3.PROCUREMENTCATEGORY,T3.LINEDELIVERYTYPE,T3.SOURCEDOCUMENTLINE,T3.DEFAULTDIMENSION,T3.LEDGERDIMENSION,T3.ISDELETED,T3.ISMODIFIED,T3.MATCHINGAGREEMENTLINE,T3.MANUALENTRYCHANGEPOLICY,T3.SYSTEMENTRYCHANGEPOLICY,T3.SYSTEMENTRYSOURCE,T3.WORKFLOWSTATE,T3.EDITABLEINWORKFLOW,T3.WFINVRECEIVEDSTATE,T3.WFDELIVERYDUESTATE,T3.DELIVERYPOSTALADDRESS,T3.LINENUMBER,T3.REQUESTER,T3.ACCOUNTINGDISTRIBUTIONTEMPLATE,T3.STOCKEDPRODUCT,T3.ISFINALIZED,T3.PLANREFERENCE,T3.ISINVOICEMATCHED,T3.ITEMPBAID,T3.PSARETAINSCHEDULEID,T3.PSATOTALRETAINAMOUNT,T3.SERVICEDATE,T3.REMAINDER,T3.SERVICEADDRESS,T3.INVENTINVOICENOW,T3.RETAILLINENUMEX1,T3.VARIANTID,T3.RETAILPACKAGEID,T3.RBOPACKAGELINENUM,T3.RETAILTEMPVALUEEX2,T3.MCRDROPSHIPMENT,T3.MCRDROPSHIPCOMMENT,T3.MCRDROPSHIPSTATUS,T3.AGREEMENTSKIPAUTOLINK,T3.CONFIRMEDTAXAMOUNT,T3.CONFIRMEDTAXWRITECODE,T3.DISCAMOUNT,T3.DISCPERCENT,T3.ISPWP,T3.MANUALMODIFIEDFIELD,T3.MCRORDERLINE2PRICEHISTORYREF,T3.PDSCALCULATIONID,T3.PDSCWINVENTRECEIVEDNOW,T3.PDSCWQTY,T3.PDSCWREMAININVENTFINANCIAL,T3.PDSCWREMAININVENTPHYSICAL,T3.PROJWORKER,T3.PURCHCOMMITMENTLINE_PSN,T3.SKIPDISTRIBUTIONUPDATE,T3.TAMITEMVENDREBATEGROUPID,T3.BUDGETRESERVATIONLINE_PSN,T3.CREDITEDVENDINVOICETRANS,T3.CONVERTUNITID,T3.STOCKINGID,T3.ATMA_FOCUS,T3.MODIFIEDDATETIME,T3.CREATEDDATETIME,T3.RECVERSION,T3.PARTITION,T3.RECID,T4.PACKINGSLIPID,T4.DELIVERYDATE,T4.LINENUM,T4.INVENTTRANSID,T4.DESTCOUNTRYREGIONID,T4.ITEMID,T4.EXTERNALITEMID,T4.NAME,T4.ORDERED,T4.QTY,T4.REMAIN,T4.PRICEUNIT,T4.VALUEMST,T4.INVENTREFID,T4.INVENTREFTYPE,T4.PURCHUNIT,T4.TRANSACTIONCODE,T4.INVENTREFTRANSID,T4.INTERCOMPANYINVENTTRANSID,T4.DESTSTATE,T4.REMAININVENT,T4.ORIGPURCHID,T4.RETURNACTIONID,T4.TRANSPORT,T4.INVENTDIMID,T4.STATPROCID,T4.PORT,T4.INVENTDATE,T4.NUMBERSEQUENCEGROUP,T4.DESTCOUNTY,T4.INTRASTATDISPATCHID,T4.INVENTQTY,T4.REASONTABLEREF,T4.PROCUREMENTCATEGORY,T4.ITEMCODEID,T4.ORIGSTATEID,T4.ORIGCOUNTRYREGIONID,T4.WEIGHT,T4.DEFAULTDIMENSION,T4.SOURCEDOCUMENTLINE,T4.WORKERPURCHASER,T4.PURCHASELINEEXPECTEDDELIVERYDATE,T4.PURCHASELINELINENUMBER,T4.VENDPACKINGSLIPJOUR,T4.FULLYMATCHED,T4.COSTLEDGERVOUCHER,T4.ACCOUNTINGDATE,T4.STOCKEDPRODUCT,T4.INVOICETRANSREFRECID,T4.PDSCWORDERED,T4.PDSCWQTY,T4.PDSCWREMAIN,T4.RECVERSION,T4.PARTITION,T4.RECID,T5.ACCOUNTNUM,T5.INVOICEACCOUNT,T5.VENDGROUP,T5.PAYMTERMID,T5.CASHDISC,T5.CURRENCY,T5.LINEDISC,T5.BLOCKED,T5.ONETIMEVENDOR,T5.PRICEGROUP,T5.MULTILINEDISC,T5.ENDDISC,T5.PAYMID,T5.VATNUM,T5.INVENTLOCATION,T5.YOURACCOUNTNUM,T5.DLVTERM,T5.DLVMODE,T5.BANKACCOUNT,T5.PAYMMODE,T5.PAYMSPEC,T5.MARKUPGROUP,T5.CLEARINGPERIOD,T5.TAXGROUP,T5.FREIGHTZONE,T5.CREDITRATING,T5.CREDITMAX,T5.PAYMSCHED,T5.ITEMBUYERGROUPID,T5.CONTACTPERSONID,T5.PURCHPOOLID,T5.PURCHAMOUNTPURCHASEORDER,T5.INCLTAX,T5.VENDITEMGROUPID,T5.NUMBERSEQUENCEGROUP,T5.PAYMDAYID,T5.DESTINATIONCODEID,T5.LINEOFBUSINESSID,T5.SUPPITEMGROUPID,T5.BANKCENTRALBANKPURPOSETEXT,T5.BANKCENTRALBANKPURPOSECODE,T5.OFFSETACCOUNTTYPE,T5.PURCHCALENDARID,T5.TAXWITHHOLDCALCULATE,T5.TAXWITHHOLDGROUP,T5.NAMECONTROL,T5.INVENTSITEID,T5.SEGMENTID,T5.SUBSEGMENTID,T5.COMPANYCHAINID,T5.VENDPRICETOLERANCEGROUPID,T5.SMALLBUSINESS,T5.LOCALLYOWNED,T5.BIDONLY,T5.MATCHINGPOLICY,T5.BLOCKEDRELEASEDATE,T5.BLOCKEDRELEASEDATETZID,T5.VENDEXCEPTIONGROUP,T5.PARTY,T5.DEFAULTDIMENSION,T5.OFFSETLEDGERDIMENSION,T5.CHANGEREQUESTENABLED,T5.CHANGEREQUESTALLOWOVERRIDE,T5.CHANGEREQUESTOVERRIDE,T5.MAINCONTACTWORKER,T5.GUIVATNUMBER,T5.DEFAULTINVENTSTATUSID,T5.DISABLEDOWNED,T5.ETHNICORIGINID,T5.TAMREBATEGROUPID,T5.USECASHDISC,T5.VETERANOWNED,T5.VENDORPORTALADMINISTRATORRECID,T5.ATMA_AREA,T5.ATMA_BRANDAGENT,T5.ATMA_DOCUMENTNO,T5.ATMA_INDUSTRY,T5.ATMA_ITEMNAME,T5.ATMA_ITEMNO,T5.ATMA_MAINCOOPERATIONPROJECT,T5.ATMA_MAINPROCESSING,T5.ATMA_MAINPROCESSINGDEVICE,T5.ATMA_MAINPRODUCT,T5.ATMA_MAXSIZE,T5.ATMA_PRODUCTOROGIN,T5.ATMA_RELATIONCOMPANY,T5.ATMA_SITUATION,T5.ATMA_SUBCONTRACTORVENDOR,T5.ATMA_TESTPRCESSINGDATE,T5.ATMA_UNDERREVIEW,T5.ATMA_VENDTYPE,T5.GUIDEDUCTIONCODE,T5.GUIREPORTCODE,T5.CHECKFORPROSPECT,T5.CUTOFFDAY,T5.ATMA_INVOICECODE,T5.MODIFIEDDATETIME,T5.DEL_MODIFIEDTIME,T5.MODIFIEDBY,T5.CREATEDDATETIME,T5.DEL_CREATEDTIME,T5.CREATEDBY,T5.RECVERSION,T5.PARTITION,T5.RECID,T5.MEMO FROM  VENDPACKINGSLIPJOUR T1 LEFT OUTER JOIN PURCHTABLE T2 ON (((T2.PARTITION=?) AND (T2.DATAAREAID=?)) AND ((T2.ATMA_SUBCONTRACTORVENDOR=?) AND (T1.PURCHID=T2.PURCHID))) CROSS JOIN PURCHLINE T3 CROSS JOIN VENDPACKINGSLIPTRANS T4 LEFT OUTER JOIN VENDTABLE T5 ON (((T5.PARTITION=?) AND (T5.DATAAREAID=?)) AND (T2.ORDERACCOUNT=T5.ACCOUNTNUM)) WHERE (((T1.PARTITION=?) AND (T1.DATAAREAID=?)) AND ((T1.ORDERACCOUNT=?) AND ((T1.DELIVERYDATE>=?) AND (T1.DELIVERYDATE<=?)))) AND (((T3.PARTITION=?) AND (T3.DATAAREAID=?)) AND ( NOT ((T3.REMAINPURCHFINANCIAL=?)) AND (T2.PURCHID=T3.PURCHID))) AND (((T4.PARTITION=?) AND (T4.DATAAREAID=?)) AND (T1.PURCHID=T4.VENDPACKINGSLIPJOUR)) ORDER BY T1.ORDERACCOUNT,T1.DELIVERYDATE

  • nmaenpaa Profile Picture
    nmaenpaa 101,156 on at
    RE: AX Query how to add mutli-DataSource

    Maybe you could change your system language to English so that we could see the complete error messge in English (now it starts with "SQL 語句: SELECT ") so we miss the critical information.

    Also, before adding your query to a form, you can test it in a job.

    You can find example on how to do that in the end of this article: docs.microsoft.com/.../gg923354(v=ax.60)

  • ATMA-Jen Profile Picture
    ATMA-Jen 305 on at
    RE: AX Query how to add mutli-DataSource

    AX190228_2D00_01.jpg

    Above is My Query,

    When I put it in the form get the Error:

    SQL ??: SELECT T1.PURCHID,T1.ORDERACCOUNT,T1.INVOICEACCOUNT,T1.PACKINGSLIPID,T1.INTERCOMPANYPOSTED,T1.DELIVERYDATE,T1.DELIVERYNAME,T1.DELIVERYPOSTALADDRESS,T1.COUNTRYREGIONID,T1.INTRASTATDISPATCH,T1.DLVTERM,T1.DLVMODE,T1.DELIVERYTYPE,T1.PURCHASETYPE,T1.RETURNITEMNUM,T1.FREIGHTSLIPNUM,T1.FREIGHTSLIPTYPE,T1.ITEMBUYERGROUPID,T1.REQATTENTION,T1.NUMBERSEQUENCEGROUP,T1.INTERCOMPANYCOMPANYID,T1.INTERCOMPANYSALESID,T1.LANGUAGEID,T1.DOCUMENTDATE,T1.DEFAULTDIMENSION,T1.SOURCEDOCUMENTHEADER,T1.REQUESTER,T1.RECVERSION,T1.PARTITION,T1.RECID,T2.PURCHID,T2.PURCHNAME,T2.ORDERACCOUNT,T2.INVOICEACCOUNT,T2.FREIGHTZONE,T2.EMAIL,T2.DELIVERYDATE,T2.DELIVERYTYPE,T2.ADDRESSREFRECID,T2.ADDRESSREFTABLEID,T2.INTERCOMPANYORIGINALSALESID,T2.INTERCOMPANYORIGINALCUSTACCOUNT,T2.CURRENCYCODE,T2.PAYMENT,T2.CASHDISC,T2.INTERCOMPANYDIRECTDELIVERY,T2.VENDGROUP,T2.LINEDISC,T2.DISCPERCENT,T2.PRICEGROUPID,T2.MULTILINEDISC,T2.ENDDISC,T2.INTERCOMPANYCUSTPURCHORDERFORMNUM,T2.TAXGROUP,T2.DLVTERM,T2.DLVMODE,T2.PURCHSTATUS,T2.MARKUPGROUP,T2.PURCHASETYPE,T2.URL,T2.POSTINGPROFILE,T2.TRANSACTIONCODE,T2.SETTLEVOUCHER,T2.INTERCOMPANYALLOWINDIRECTCREATION,T2.INTERCOMPANYORIGIN,T2.CASHDISCPERCENT,T2.DELIVERYNAME,T2.COVSTATUS,T2.PAYMENTSCHED,T2.INVENTSITEID,T2.ONETIMEVENDOR,T2.RETURNITEMNUM,T2.FREIGHTSLIPTYPE,T2.DOCUMENTSTATUS,T2.CONTACTPERSONID,T2.INVENTLOCATIONID,T2.ITEMBUYERGROUPID,T2.PROJID,T2.PURCHPOOLID,T2.VATNUM,T2.PORT,T2.INCLTAX,T2.NUMBERSEQUENCEGROUP,T2.LANGUAGEID,T2.AUTOSUMMARYMODULETYPE,T2.TRANSPORT,T2.PAYMMODE,T2.PAYMSPEC,T2.FIXEDDUEDATE,T2.STATPROCID,T2.VENDORREF,T2.INTERCOMPANYCOMPANYID,T2.INTERCOMPANYSALESID,T2.INTERCOMPANYORDER,T2.RETURNREASONCODEID,T2.RETURNREPLACEMENTCREATED,T2.REQATTENTION,T2.DEFAULTDIMENSION,T2.CONFIRMEDDLVEARLIEST,T2.CHANGEREQUESTREQUIRED,T2.REASONTABLEREF,T2.DOCUMENTSTATE,T2.ISMODIFIED,T2.MATCHINGAGREEMENT,T2.SYSTEMENTRYSOURCE,T2.SYSTEMENTRYCHANGEPOLICY,T2.MANUALENTRYCHANGEPOLICY,T2.WORKERPURCHPLACER,T2.DELIVERYPOSTALADDRESS,T2.BANKDOCUMENTTYPE,T2.LISTCODE,T2.ISENCUMBRANCEREQUIRED,T2.SOURCEDOCUMENTLINE,T2.SOURCEDOCUMENTHEADER,T2.REQUESTER,T2.ACCOUNTINGDISTRIBUTIONTEMPLATE,T2.ACCOUNTINGDATE,T2.FINALIZECLOSINGDATE,T2.SERVICENAME,T2.SERVICEADDRESS,T2.ONETIMESUPPLIER,T2.SERVICEDATE,T2.CONFIRMEDDLV,T2.FSHAUTOCREATED,T2.CROSSDOCKINGDATE,T2.SERVICECATEGORY,T2.AVAILSALESDATE,T2.LOCALDELIVERYDATE,T2.REPLENISHMENTLOCATION,T2.RETAILRETAILSTATUSTYPE,T2.RETAILDRIVERDETAILS,T2.RETAILCONCESSIONPURCH,T2.CONFIRMINGPO,T2.MCRDROPSHIPMENT,T2.GUIDEDUCTIONCODE,T2.GUIVATNUMBER,T2.GUITITLE,T2.EXCHANGERATEDATE,T2.TAMVENDREBATEGROUPID,T2.GUIREPORTCODE,T2.ATMA_SUBCONTRACTORVENDOR,T2.CREATEDDATETIME,T2.CREATEDBY,T2.RECVERSION,T2.PARTITION,T2.RECID,T3.PURCHID,T3.ITEMID,T3.PURCHSTATUS,T3.SHIPPINGDATEREQUESTED,T3.DELIVERYDATE,T3.NAME,T3.TAXGROUP,T3.QTYORDERED,T3.PURCHRECEIVEDNOW,T3.REMAINPURCHPHYSICAL,T3.REMAINPURCHFINANCIAL,T3.PRICEUNIT,T3.PURCHPRICE,T3.CURRENCYCODE,T3.LINEPERCENT,T3.LINEDISC,T3.LINEAMOUNT,T3.EXTERNALITEMID,T3.PURCHUNIT,T3.CONFIRMEDDLV,T3.ADDRESSREFRECID,T3.INVENTTRANSID,T3.VENDGROUP,T3.VENDACCOUNT,T3.ADDRESSREFTABLEID,T3.PURCHQTY,T3.PURCHMARKUP,T3.INVENTRECEIVEDNOW,T3.MULTILNDISC,T3.MULTILNPERCENT,T3.PURCHASETYPE,T3.COVREF,T3.REMAININVENTPHYSICAL,T3.TAXITEMGROUP,T3.TRANSACTIONCODE,T3.SHIPPINGDATECONFIRMED,T3.TAXAUTOGENERATED,T3.UNDERDELIVERYPCT,T3.OVERDELIVERYPCT,T3.BARCODE,T3.BARCODETYPE,T3.INVENTREFID,T3.INVENTREFTRANSID,T3.ITEMREFTYPE,T3.PROJTRANSID,T3.BLOCKED,T3.COMPLETE,T3.REQPLANIDSCHED,T3.REQPOID,T3.ITEMROUTEID,T3.ITEMBOMID,T3.LINEHEADER,T3.SCRAP,T3.RETURNACTIONID,T3.INTERCOMPANYORIGIN,T3.PROJCATEGORYID,T3.PROJID,T3.INVENTDIMID,T3.TRANSPORT,T3.STATPROCID,T3.PORT,T3.ASSETID,T3.ASSETTRANSTYPEPURCH,T3.ASSETBOOKID,T3.PROJLINEPROPERTYID,T3.PROJTAXITEMGROUPID,T3.PROJTAXGROUPID,T3.PROJSALESPRICE,T3.PROJSALESCURRENCYID,T3.INTERCOMPANYINVENTTRANSID,T3.PROJSALESUNITID,T3.DELIVERYNAME,T3.DELIVERYTYPE,T3.CUSTOMERREF,T3.CUSTPURCHASEORDERFORMNUM,T3.STATTRIANGULARDEAL,T3.ITEMTAGGING,T3.CASETAGGING,T3.PALLETTAGGING,T3.REMAININVENTFINANCIAL,T3.PURCHREQLINEREFID,T3.ACTIVITYNUMBER,T3.RETURNSTATUS,T3.RETURNDISPOSITIONCODEID,T3.CREATEFIXEDASSET,T3.ASSETGROUP,T3.REQATTENTION,T3.PURCHREQID,T3.MATCHINGPOLICY,T3.PROCUREMENTCATEGORY,T3.LINEDELIVERYTYPE,T3.SOURCEDOCUMENTLINE,T3.DEFAULTDIMENSION,T3.LEDGERDIMENSION,T3.ISDELETED,T3.ISMODIFIED,T3.MATCHINGAGREEMENTLINE,T3.MANUALENTRYCHANGEPOLICY,T3.SYSTEMENTRYCHANGEPOLICY,T3.SYSTEMENTRYSOURCE,T3.WORKFLOWSTATE,T3.EDITABLEINWORKFLOW,T3.WFINVRECEIVEDSTATE,T3.WFDELIVERYDUESTATE,T3.DELIVERYPOSTALADDRESS,T3.LINENUMBER,T3.REQUESTER,T3.ACCOUNTINGDISTRIBUTIONTEMPLATE,T3.STOCKEDPRODUCT,T3.ISFINALIZED,T3.PLANREFERENCE,T3.ISINVOICEMATCHED,T3.ITEMPBAID,T3.PSARETAINSCHEDULEID,T3.PSATOTALRETAINAMOUNT,T3.SERVICEDATE,T3.REMAINDER,T3.SERVICEADDRESS,T3.INVENTINVOICENOW,T3.RETAILLINENUMEX1,T3.VARIANTID,T3.RETAILPACKAGEID,T3.RBOPACKAGELINENUM,T3.RETAILTEMPVALUEEX2,T3.MCRDROPSHIPMENT,T3.MCRDROPSHIPCOMMENT,T3.MCRDROPSHIPSTATUS,T3.AGREEMENTSKIPAUTOLINK,T3.CONFIRMEDTAXAMOUNT,T3.CONFIRMEDTAXWRITECODE,T3.DISCAMOUNT,T3.DISCPERCENT,T3.ISPWP,T3.MANUALMODIFIEDFIELD,T3.MCRORDERLINE2PRICEHISTORYREF,T3.PDSCALCULATIONID,T3.PDSCWINVENTRECEIVEDNOW,T3.PDSCWQTY,T3.PDSCWREMAININVENTFINANCIAL,T3.PDSCWREMAININVENTPHYSICAL,T3.PROJWORKER,T3.PURCHCOMMITMENTLINE_PSN,T3.SKIPDISTRIBUTIONUPDATE,T3.TAMITEMVENDREBATEGROUPID,T3.BUDGETRESERVATIONLINE_PSN,T3.CREDITEDVENDINVOICETRANS,T3.CONVERTUNITID,T3.STOCKINGID,T3.ATMA_FOCUS,T3.MODIFIEDDATETIME,T3.CREATEDDATETIME,T3.RECVERSION,T3.PARTITION,T3.RECID,T4.PACKINGSLIPID,T4.DELIVERYDATE,T4.LINENUM,T4.INVENTTRANSID,T4.DESTCOUNTRYREGIONID,T4.ITEMID,T4.EXTERNALITEMID,T4.NAME,T4.ORDERED,T4.QTY,T4.REMAIN,T4.PRICEUNIT,T4.VALUEMST,T4.INVENTREFID,T4.INVENTREFTYPE,T4.PURCHUNIT,T4.TRANSACTIONCODE,T4.INVENTREFTRANSID,T4.INTERCOMPANYINVENTTRANSID,T4.DESTSTATE,T4.REMAININVENT,T4.ORIGPURCHID,T4.RETURNACTIONID,T4.TRANSPORT,T4.INVENTDIMID,T4.STATPROCID,T4.PORT,T4.INVENTDATE,T4.NUMBERSEQUENCEGROUP,T4.DESTCOUNTY,T4.INTRASTATDISPATCHID,T4.INVENTQTY,T4.REASONTABLEREF,T4.PROCUREMENTCATEGORY,T4.ITEMCODEID,T4.ORIGSTATEID,T4.ORIGCOUNTRYREGIONID,T4.WEIGHT,T4.DEFAULTDIMENSION,T4.SOURCEDOCUMENTLINE,T4.WORKERPURCHASER,T4.PURCHASELINEEXPECTEDDELIVERYDATE,T4.PURCHASELINELINENUMBER,T4.VENDPACKINGSLIPJOUR,T4.FULLYMATCHED,T4.COSTLEDGERVOUCHER,T4.ACCOUNTINGDATE,T4.STOCKEDPRODUCT,T4.INVOICETRANSREFRECID,T4.PDSCWORDERED,T4.PDSCWQTY,T4.PDSCWREMAIN,T4.RECVERSION,T4.PARTITION,T4.RECID,T5.ACCOUNTNUM,T5.INVOICEACCOUNT,T5.VENDGROUP,T5.PAYMTERMID,T5.CASHDISC,T5.CURRENCY,T5.LINEDISC,T5.BLOCKED,T5.ONETIMEVENDOR,T5.PRICEGROUP,T5.MULTILINEDISC,T5.ENDDISC,T5.PAYMID,T5.VATNUM,T5.INVENTLOCATION,T5.YOURACCOUNTNUM,T5.DLVTERM,T5.DLVMODE,T5.BANKACCOUNT,T5.PAYMMODE,T5.PAYMSPEC,T5.MARKUPGROUP,T5.CLEARINGPERIOD,T5.TAXGROUP,T5.FREIGHTZONE,T5.CREDITRATING,T5.CREDITMAX,T5.PAYMSCHED,T5.ITEMBUYERGROUPID,T5.CONTACTPERSONID,T5.PURCHPOOLID,T5.PURCHAMOUNTPURCHASEORDER,T5.INCLTAX,T5.VENDITEMGROUPID,T5.NUMBERSEQUENCEGROUP,T5.PAYMDAYID,T5.DESTINATIONCODEID,T5.LINEOFBUSINESSID,T5.SUPPITEMGROUPID,T5.BANKCENTRALBANKPURPOSETEXT,T5.BANKCENTRALBANKPURPOSECODE,T5.OFFSETACCOUNTTYPE,T5.PURCHCALENDARID,T5.TAXWITHHOLDCALCULATE,T5.TAXWITHHOLDGROUP,T5.NAMECONTROL,T5.INVENTSITEID,T5.SEGMENTID,T5.SUBSEGMENTID,T5.COMPANYCHAINID,T5.VENDPRICETOLERANCEGROUPID,T5.SMALLBUSINESS,T5.LOCALLYOWNED,T5.BIDONLY,T5.MATCHINGPOLICY,T5.BLOCKEDRELEASEDATE,T5.BLOCKEDRELEASEDATETZID,T5.VENDEXCEPTIONGROUP,T5.PARTY,T5.DEFAULTDIMENSION,T5.OFFSETLEDGERDIMENSION,T5.CHANGEREQUESTENABLED,T5.CHANGEREQUESTALLOWOVERRIDE,T5.CHANGEREQUESTOVERRIDE,T5.MAINCONTACTWORKER,T5.GUIVATNUMBER,T5.DEFAULTINVENTSTATUSID,T5.DISABLEDOWNED,T5.ETHNICORIGINID,T5.TAMREBATEGROUPID,T5.USECASHDISC,T5.VETERANOWNED,T5.VENDORPORTALADMINISTRATORRECID,T5.ATMA_AREA,T5.ATMA_BRANDAGENT,T5.ATMA_DOCUMENTNO,T5.ATMA_INDUSTRY,T5.ATMA_ITEMNAME,T5.ATMA_ITEMNO,T5.ATMA_MAINCOOPERATIONPROJECT,T5.ATMA_MAINPROCESSING,T5.ATMA_MAINPROCESSINGDEVICE,T5.ATMA_MAINPRODUCT,T5.ATMA_MAXSIZE,T5.ATMA_PRODUCTOROGIN,T5.ATMA_RELATIONCOMPANY,T5.ATMA_SITUATION,T5.ATMA_SUBCONTRACTORVENDOR,T5.ATMA_TESTPRCESSINGDATE,T5.ATMA_UNDERREVIEW,T5.ATMA_VENDTYPE,T5.GUIDEDUCTIONCODE,T5.GUIREPORTCODE,T5.CHECKFORPROSPECT,T5.CUTOFFDAY,T5.ATMA_INVOICECODE,T5.MODIFIEDDATETIME,T5.DEL_MODIFIEDTIME,T5.MODIFIEDBY,T5.CREATEDDATETIME,T5.DEL_CREATEDTIME,T5.CREATEDBY,T5.RECVERSION,T5.PARTITION,T5.RECID,T5.MEMO FROM  VENDPACKINGSLIPJOUR T1 LEFT OUTER JOIN PURCHTABLE T2 ON (((T2.PARTITION=?) AND (T2.DATAAREAID=?)) AND ((T2.ATMA_SUBCONTRACTORVENDOR=?) AND (T1.PURCHID=T2.PURCHID))) CROSS JOIN PURCHLINE T3 CROSS JOIN VENDPACKINGSLIPTRANS T4 LEFT OUTER JOIN VENDTABLE T5 ON (((T5.PARTITION=?) AND (T5.DATAAREAID=?)) AND (T2.ORDERACCOUNT=T5.ACCOUNTNUM)) WHERE (((T1.PARTITION=?) AND (T1.DATAAREAID=?)) AND ((T1.ORDERACCOUNT=?) AND ((T1.DELIVERYDATE>=?) AND (T1.DELIVERYDATE<=?)))) AND (((T3.PARTITION=?) AND (T3.DATAAREAID=?)) AND ( NOT ((T3.REMAINPURCHFINANCIAL=?)) AND (T2.PURCHID=T3.PURCHID))) AND (((T4.PARTITION=?) AND (T4.DATAAREAID=?)) AND (T1.PURCHID=T4.VENDPACKINGSLIPJOUR)) ORDER BY T1.ORDERACCOUNT,T1.DELIVERYDATE

  • Suggested answer
    Jie G Profile Picture
    Jie G on at
    RE: AX Query how to add mutli-DataSource

    Hello Jen,

    You can add parent and child data sources to a query.

    1. In the Application Object Tree (AOT), click Queries, locate the query you want to add data sources to, and then click the query node. For information about create queries, see Accessing Data.

    2. Right-click Data Dictionary, and then click Open New Window.

    3. Drag a table, map, or view from the new window to the Data Sources node below the query node to add a parent data source.

    4. Click the parent data source, and then drag a table, map, or view from the new window to the Data Sources node below the parent data source to add a child data source.

    5. Specify how the parent and child data sources are joined by setting the JoinMode property on the child data source

    6. Create a relationship between the data sources.

    For more details, please refer: docs.microsoft.com/.../how-to-add-multiple-data-sources-to-a-query

  • ATMA-Jen Profile Picture
    ATMA-Jen 305 on at
    RE: AX Query how to add mutli-DataSource

    Hello,

    I would like the use AOT Query object to buld if it could do.

    Thanks a lot.

    Br, Jen

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!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans