Announcements
hi all,
my requirement is to get the value from dialog and manipulate based on that. like
***here in the dialog the select parameters is coming from Cust table. i made 1 query and put 2 ranges...
cust account and
cust group.
User can select multiple cust account and cust groups.
i wrote one query but unable to understand how i will call the cust table in my below query? So, that i can get the values , whatever i mentioned in the dialog
My code
class decleration ()
{
QueryRun queryRun;
}
private void buildQR()
{
Query query;
QueryRun qrRun;
QueryBuildDatasource qbds,qbds1;
QueryBuildRange qbr;
;
query = queryRun.query();
qbds = query.addDataSource(tablenum(CustConfirmJour));
qBds.addGroupByField(fieldNum(CustConfirmJour,SalesId));
// date range
qbr = qbds.addRange(fieldNum(CustConfirmJour,ConfirmDate));
qbr.value(queryRange(fromDate, toDate));
// group by
qbds.addGroupByField(fieldNum(CustConfirmJour,SalesId));
// max
qbds.addSelectionField(fieldNum(CustConfirmJour,RecId),SelectionField::Max);
queryRun = new QueryRun(query);
while (queryRun.next())
{
custConfirmJour = queryRun.get(TableNum(CustConfirmJour));
}
}
new() --
public void new()
{
;
super();
queryRun = new QueryRun(querystr(CustCustGroupQR));
}
run()--
public void run()
{
;
super();
this.excelDataExport();
}
public void excelDataExport()
{
;
.
this.buildQR();
//export data and set permission
}
main() --
static void main(Args _args)
{
GDJ_JPN_SODetailedReport soDetailedReport = new GDJ_JPN_SODetailedReport();
;
if(soDetailedReport.prompt())
{
soDetailedReport.run();
}
}
kindly let me know what i need to add the code for cust table in above query? so, that i can get the values from the dialog in select parameters.
please give me more shed on this.
thanks!
thanks Uday
Hi,
When query having multiple datasources we need to specify the datasource to make our new datasource connected to the right parent datasource.
For that reason, we added datasourceno(1) which is custtable in your case.
Uday
uday,
what is the difference between these two code ?
qbds = query.addDataSource(tablenum(CustConfirmJour));
qbds = query.dataSourceNo(1).addDataSource(tablenum(CustConfirmJour));
my code is working if customer is not matched ***
qbds = query.dataSourceNo(1).addDataSource(tablenum(CustConfirmJour));
uday,
give me your contact number please. will talk later
Hi,
Great,
Uday
it's working bro
thanks a lot
how you will paste the code in above format in rich text formatting?
Hi,
You need to assign query as queryRun.query() to get the AOT query.
query = new Query(queryRun.query());
qbds = query.dataSourceNo(1).addDataSource(tableNum(CustConfirmJour));
public void excelExecution() { Query query; QueryRun qrRun; TransDate maxSalesConfrmDate; QueryBuildDatasource qbds,qbds1; QueryBuildRange qbr; RecId chkRecid; boolean headerPrint = true; i = 1; // initlize the SysExcelApplication instance sysExcelApplication = SysExcelApplication::construct(); //create excel workbook and excel worksheet excelWorkbookCollection = sysExcelApplication.workbooks(); excelWorkbook = excelWorkbookCollection.add(); excelWorksheetCollection = excelWorkbook.worksheets(); excelWorksheet = excelWorksheetCollection.itemFromNum(1); // query ( GDJ_CustCustGroupQR )started *** query = new Query(queryRun.query()); qbds = query.dataSourceNo(1).addDataSource(tablenum(CustConfirmJour)); qbds.relations(true); // date range qbr = qbds.addRange(fieldNum(CustConfirmJour,ConfirmDate)); qbr.value(queryRange(fromDate, toDate)); qbds.addGroupByField(fieldNum(CustConfirmJour, SalesId)); qbds.addSelectionField(fieldNum(CustConfirmJour, RecId), SelectionField::Max); /*qbds.addRange( fieldNum(CustConfirmJour, SalesId)).value("440-000009"); qbr = qbds.addRange(fieldNum(CustConfirmJour, SalesId)); qbr.value("");*/ qrRun = new QueryRun(query); try { while (qrRun.next()) { custConfirmJour = qrRun.get(TableNum(CustConfirmJour)); } }
Uday
need to add any relation with custtable?
like addlink...
yes,
public void new()
{
;
super();
queryRun = new QueryRun(querystr(GDJ_CustCustGroupQR));
}
HI
Have you added the AOT query to your code ?
Your code shows query = new Query(); should be new query(querystr(yourQuery));
Uday
André Arnaud de Cal...
294,101
Super User 2025 Season 1
Martin Dráb
232,866
Most Valuable Professional
nmaenpaa
101,158
Moderator