Pass Query from dialog to Form and Filter records


Created a Runbase class which has dialog selection using QueryStr.
I need to pass this Query range selection to a form and need to filter records based on this query Selection. Call the form by passing the Query selection from the class
Args _args;
FormRun _formRun;
EmplId _empId;
;
_args = new Args(); // creating a object for args class
_args.name(formstr(xtgCummeInquiry)); // Form Menuitem
_args.caller(this); // Form Caller(Current Form is mentioned as this)
_args.object(CummeQueryRun.query());
_formRun = ClassFactory.formRunClass(_args);
//new FormRun(_args);
// Creating object for FormRun
_formRun.init(); // Form Initialization for Load
_formRun.run(); // Form Run for process
_formRun.wait(); // Form Wait for Display
and from the called form run method,assign the Query range value to the form datasource
public void run()
{
boolean ret;
Query q;
DictField dictField;
str fieldLabel;
Addressing PrintRange;
int i, j, rangeCount;
QueryBuildRange QBR;
QueryRun Qrun;
super();
if(element.args().caller())
{
CallerOBJ = element.args().caller();
Qrun = CallerObj.QueryRun();
q = QRun.query();
for(i = 1; i <= q.dataSourceCount(); i++)
{
rangeCount = q.dataSourceNo(i).rangeCount();
for(j = 1; j <= rangeCount; j++)
{
QBR = q.dataSourceNo(i).range(j);
dictField = new DictField(QBR.table(),fieldname2id(QBR.table(),QBR.name()));
fieldLabel = dictField.label();
if(QBR.value())
{
CummeTransTable_q.dataSourceTable(QBR.table()).addRange(fieldname2id(QBR.table(),QBR.name())).value(QBR.value());
}
}
}
}
CummeTransTable_ds.executeQuery();
}

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.