10. Juli 2009 14:00
static void __TEST(Args _args)
{
QueryBuildDatasource qbds;
QueryBuildDatasource qbdsBase;
DictTable dictTable;
Query cQuerySearch;
QueryRun qr;
int i;
str sQueryExpression;
;
cQuerySearch = new Query();
dictTable = new dictTable(tablenum(InventTable));
qbdsBase = cQuerySearch.addDataSource(tablenum(InventTable));
qbdsBase.name(dictTable.name());
dictTable = new dictTable(tablenum(CustVendExternalItem));
qbds = qbdsBase.addDataSource(tablenum(CustVendExternalItem));
qbds.name(dictTable.name());
qbds.relations(true);
qbds.joinMode(JoinMode::OuterJoin);
sQueryExpression = "(ItemId Like \"MUTT*\") || (CustVendExternalItem.ExternalItemId Like \"MUTT*\")";
sQueryExpression = "(" + sQueryExpression + ")";
SysQuery::findOrCreateRange(cQuerySearch.dataSourceTable(tablenum(InventTable)), fieldname2id(tablenum(InventTable), "dataareaid")).value(strfmt(sQueryExpression));
qr = new QueryRun(cQuerySearch);
while(qr.next())
{
i++;
print i;
if(i > 10)
break;
}
pause;
}
SELECT * FROM InventTable WHERE ((((ItemId Like "MUTT*") || (CustVendExternalItem.ExternalItemId Like "MUTT*")))) OUTER JOIN * FROM CustVendExternalItem WHERE InventTable.ItemId = CustVendExternalItem.ItemId
static void __TEST2(Args _args)
{
QueryBuildDatasource qbds;
QueryBuildDatasource qbdsBase;
DictTable dictTable;
Query cQuerySearch;
QueryRun qr;
int i;
str sQueryExpression;
;
cQuerySearch = new Query();
dictTable = new dictTable(tablenum(InventTable));
qbdsBase = cQuerySearch.addDataSource(tablenum(InventTable));
qbdsBase.name(dictTable.name());
dictTable = new dictTable(tablenum(CustVendExternalItem));
qbds = qbdsBase.addDataSource(tablenum(CustVendExternalItem));
qbds.name(dictTable.name());
qbds.relations(true);
qbds.joinMode(JoinMode::OuterJoin);
sQueryExpression = "(InventTable.ItemId Like \"MUTT*\") || (ExternalItemId Like \"MUTT*\")";
sQueryExpression = "(" + sQueryExpression + ")";
SysQuery::findOrCreateRange(cQuerySearch.dataSourceTable(tablenum(CustVendExternalItem)), fieldname2id(tablenum(CustVendExternalItem), "dataareaid")).value(strfmt(sQueryExpression));
qr = new QueryRun(cQuerySearch);
while(qr.next())
{
i++;
print i;
if(i > 10)
break;
}
pause;
}
SELECT *
FROM InventTable OUTER JOIN * FROM CustVendExternalItem WHERE
InventTable.ItemId = CustVendExternalItem.ItemId AND
((((InventTable.ItemId Like "MUTT*") || (ExternalItemId Like "MUTT*"))))
SELECT * FROM {oj INVENTTABLE A LEFT OUTER JOIN CUSTVENDEXTERNALITEM B ON ((B.DATAAREAID=?) AND (((A.ITEMID LIKE ? ESCAPE '\' ) OR (B.EXTERNALITEMID LIKE ? ESCAPE '\' )) AND (A.ITEMID=B.ITEMID)))} WHERE (A.DATAAREAID=?) ORDER BY A.DATAAREAID,A.ITEMID [Kennung=471, Wiederverwendet=Nein]