To build a query use this job:
static void Queries_SystemClasses(Args _args)
{
SysQuery query;
SysQueryRun queryRun;
QueryBuildDataSource custInvoiceJourDS, custInvoiceTransDS;
;
query = new Query();
custInvoiceJourDS = query.addDataSource(tablenum(CustInvoiceJour));
custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceAccount));
custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, CurrencyCode));
custInvoiceTransDS = custInvoiceJourDS.addDataSource(tablenum(CustInvoiceTrans));
custInvoiceTransDS.addRange(fieldnum(CustInvoiceTrans, ItemId));
custInvoiceTransDS.relations(true);
queryRun = new SysQueryRun(query);
queryRun.prompt();
}
{
SysQuery query;
SysQueryRun queryRun;
QueryBuildDataSource custInvoiceJourDS, custInvoiceTransDS;
;
query = new Query();
custInvoiceJourDS = query.addDataSource(tablenum(CustInvoiceJour));
custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceAccount));
custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, CurrencyCode));
custInvoiceTransDS = custInvoiceJourDS.addDataSource(tablenum(CustInvoiceTrans));
custInvoiceTransDS.addRange(fieldnum(CustInvoiceTrans, ItemId));
custInvoiceTransDS.relations(true);
queryRun = new SysQueryRun(query);
queryRun.prompt();
}
To add ranges with specified values you can use this:
static void Queries_SystemClassesRanges(Args _args)
{
SysQuery query;
SysQueryRun queryRun;
QueryBuildDataSource custInvoiceJourDS;
QueryBuildRange rangeInvoiceAccount, rangeInvoiceDate, rangeDimensionDepartment;
;
query = new Query();
custInvoiceJourDS = query.addDataSource(tablenum(CustInvoiceJour));
rangeInvoiceAccount = custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceAccount));
rangeInvoiceAccount.value(queryValue("4000"));
rangeInvoiceDate = custInvoiceJourDS.addRange(fieldnum(CustInvoiceJour, InvoiceDate));
rangeInvoiceDate.value(queryRange(datenull(), systemdateget()));
rangeDimensionDepartment = custInvoiceJourDS.addRange(fieldId2Ext(fieldnum(CustInvoiceJour, Dimension), 1));
rangeDimensionDepartment.value(queryValue("Sales"));
queryRun = new SysQueryRun(query);
queryRun.prompt();
}
Happy Daxing!
Aucun commentaire:
Enregistrer un commentaire