我正在尝试在VendTrans和VendTable之间创建一个简单的跨公司查询。我们启用了全局通讯簿,因此一些条目在公司之间共享。如果我正在编写SQL,它看起来像:
select vtxn.Voucher, vtxn.TransDate, vt.AccountNum, vt.Name
from dbo.vendtrans vtxn
join dbo.vendtable vt on vtxn.accountnum = vt.accountnum
and vt.dataareaid in (vtxn.dataareaid, 'shr')
我遇到的问题是,由于全局地址簿,我从下面定义的查询和视图中得不到任何结果。我将不胜感激任何帮助。
感谢。
QUERY #spTestQuery PROPERTIES Name #spTestQuery UserUpdate #No Version #524 NextUniqueId #1008 AllowCrossCompany #Yes ENDPROPERTIES METHODS Version: 3 SOURCE #classDeclaration #public class QueryRun extends ObjectRun #{ #} ENDSOURCE ENDMETHODS BLOCKS BLOCK #LedgerJournalTrans PROPERTIES Name #LedgerJournalTrans_1 Table #LedgerJournalTrans UniqueId #1000 FirstFast #Yes AllowAdd #No fields ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #BankChequeNum FIELD #TransDate ENDFIELDLIST SORTING ENDSORTING LINES LINE #BankChequeNum PROPERTIES Name #BankChequeNum Table #LedgerJournalTrans Field #BankChequeNum Value #> 0 ENDPROPERTIES ENDLINES BLOCKS BLOCK #VendTrans PROPERTIES Name #VendTrans_1 Table #VendTrans UniqueId #1003 AllowAdd #No fields FetchMode #1:1 Relations #Yes ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #AccountNum FIELD #LastSettleVoucher ENDFIELDLIST SORTING ENDSORTING LINES ENDLINES BLOCKS BLOCK #VendTable PROPERTIES Name #VendTable_1 Table #VendTable UniqueId #1004 Relations #Yes Enabled #No ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #Name FIELD #AccountNum ENDFIELDLIST SORTING ENDSORTING LINES ENDLINES BLOCKS ENDBLOCKS ASSOCIATIONS ASSOCIATION MASTERFIELD #AccountNum DETAILSFIELD #AccountNum ENDASSOCIATIONS ENDBLOCK ENDBLOCKS ASSOCIATIONS ASSOCIATION MASTERFIELD #AccountNum DETAILSFIELD #AccountNum ENDASSOCIATIONS ENDBLOCK BLOCK #LedgerTrans PROPERTIES Name #LedgerTrans_1 Table #LedgerTrans UniqueId #1005 AllowAdd #No fields FetchMode #1:1 Relations #Yes ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #AccountNum FIELD #Voucher FIELD #AmountMST FIELD #TransDate FIELD #Voucher FIELD #Dimension ENDFIELDLIST SORTING ENDSORTING LINES LINE #AccountNum PROPERTIES Name #AccountNum Table #LedgerTrans Field #AccountNum Value #!211000 ENDPROPERTIES ENDLINES BLOCKS BLOCK #LedgerTable PROPERTIES Name #LedgerTable_1 Table #LedgerTable UniqueId #1006 AllowAdd #No fields Relations #Yes ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #AccountName FIELD #AccountNum ENDFIELDLIST SORTING ENDSORTING LINES ENDLINES BLOCKS ENDBLOCKS ASSOCIATIONS ASSOCIATION MASTERFIELD #AccountNum DETAILSFIELD #AccountNum ENDASSOCIATIONS ENDBLOCK BLOCK #Dimensions PROPERTIES Name #Dimensions_1 Table #Dimensions UniqueId #1007 AllowAdd #No fields ENDPROPERTIES FIELDLIST PROPERTIES Dynamic #No ENDPROPERTIES FIELD #Description FIELD #Num FIELD #DimensionCode ENDFIELDLIST SORTING ENDSORTING LINES LINE #DimensionCode PROPERTIES Name #DimensionCode Table #Dimensions Field #DimensionCode Value #Purpose ENDPROPERTIES ENDLINES BLOCKS ENDBLOCKS ASSOCIATIONS ASSOCIATION JOINDATASOURCE #LedgerTrans_1 MASTERFIELD #Dimension[3] DETAILSFIELD #Num ENDASSOCIATIONS ENDBLOCK ENDBLOCKS ASSOCIATIONS ASSOCIATION MASTERFIELD #TransDate DETAILSFIELD #TransDate ASSOCIATION MASTERFIELD #Voucher DETAILSFIELD #Voucher ENDASSOCIATIONS ENDBLOCK ENDBLOCKS GROUPBY ENDGROUPBY ORDERBY ENDORDERBY ENDBLOCK ENDBLOCKS DEPENDENTS DEPENDENT PROPERTIES Name #spTestView DependentType #View ENDPROPERTIES Id 50005 ENDDEPENDENTS COMPOSITEQUERIES ENDCOMPOSITEQUERIES ENDQUERY VIEW #spVendTestView Id 50008 PROPERTIES Name #spVendTestView SaveDataPerCompany #Yes Query #spvendtest ENDPROPERTIES QUERY #Metadata PROPERTIES Name #Metadata AllowCrossCompany #Yes ENDPROPERTIES BLOCKS ENDBLOCKS QUERY #spVendTest ENDQUERY ENDQUERY FIELDS VIEWFIELD #Voucher Id 50001 PROPERTIES Name #Voucher Table #spVendTestView ExtendedDataType #Voucher StringSize #25 DataSource #VendTrans_1 DataField #Voucher ENDPROPERTIES ENDVIEWFIELD VIEWFIELD #TransDate Id 50003 PROPERTIES Type #Date Name #TransDate Table #spVendTestView ExtendedDataType #TransDate StringSize #(Memo) DataSource #VendTrans_1 DataField #TransDate ENDPROPERTIES ENDVIEWFIELD VIEWFIELD #AccountNum Id 50004 PROPERTIES Name #AccountNum Table #spVendTestView ExtendedDataType #VendAccount StringSize #20 DataSource #VendTable_1 DataField #AccountNum ENDPROPERTIES ENDVIEWFIELD VIEWFIELD #Name Id 50002 PROPERTIES Name #Name Table #spVendTestView ExtendedDataType #VendName StringSize #120 DataSource #VendTable_1 DataField #Name ENDPROPERTIES ENDVIEWFIELD ENDFIELDS GROUPS ENDGROUPS ENDVIEW
答案 0 :(得分:2)
我可以看到您使用crosscompany
定义查询,然后根据查询定义视图。
但是,查询中的crosscompany
并不意味着视图也是crosscompany
。
查看Cross-Company Queries for Views。
摘录:
在应用程序对象树(AOT)中,您可以通过拖动来构建视图 查询节点到视图的“数据源”节点上。查询可以 将AllowCrossCompany属性设置为Yes。但是,这不会 从视图中返回跨公司的结果。
要从视图返回跨公司结果,您需要使用 从视图中读取的select语句上的crossCompany关键字。 视图的数据源查询上的AllowCrossCompany设置是 在从视图中读取的X ++ select语句中被忽略。