(1) Report
-- 1) Reload the clicked () event in the Form Control "button" and pass the current value in form to the report
Void clicked () <br/>{< br/> ARGs _ A = new ARGs (); <br/> yam_unqualifiedmanageiqcline _ iqcline; <br/> yam_unqualifiedmanagehead _ iqchead; <br/> STR 100 _ iqcid; <br/> SET _ set = new set (types: string); <br/>;< br/> super (); </P> <p> If (yam_unqualifiedmanagehead_ds.mark () <br/>{< br/> _ iqchead = yam_unqualifiedmanagehead_ds.getfirst (1); <br/> while) <br/> {<br/> While select _ iqcline <br/> group by iqcid <br/> where _ iqcline. itemid = _ iqchead. itemid <br/> & _ iqcline. numberdocuments = _ iqchead. numberdocuments <br/>{< br/> _ set. add (_ iqcline. iqcid); <br/>}</P> <p> _ iqchead = yam_unqualifiedmanagehead_ds.getnext (); <br/>}< br/> else <br/> While select _ iqcline <br/> group by iqcid <br/> where _ iqcline. itemid = yam_unqualifiedmanagehead.itemid <br/> & _ iqcline. numberdocuments = yam_unqualifiedmanagehead.numberdocuments <br/>{< br/> _ set. add (_ iqcline. iqcid); <br/>}</P> <p> _. parmobject (_ set); <br/> New menufunction ("yam_returnmatersingle", menuitemtype: output ). run (_ A); </P> <p>}
-- 2) in the report pop-up query dialog box, reload the init () and fetch () Methods to initialize and display the values passed from the button.
Public void Init () <br/>/*** <br/> from the Form Control "button", set to report? <Br/> */<br/> {<br/> syslastvalue _ syslastvalue; // place the Operation Records of all objects in Table <br/> fieldid _ fieldid = fieldnum (esgiqcline, iqcid); // declare the field ID <br/> SET _ set = new set (types: string); <br/> setiterator it; // extract the set container result set <br/> STR 100 longstr; <br/>/* global variable in classdeclaration method <br/> querybuilddatasource qbds; <br/> querybuildrange qbr; <br/> queryrun _ queryrun; <br/> */<br/>; <br/>/*** start... remark By xyf 20090922 + <br/> Delete the report operation records so that the current set value is displayed during each initialization in the query dialog box, to meet user requirements <br/> */<br/> ttsbegin; <br/> delete_from _ syslastvalue <br/> where _ syslastvalue. recordtype = utilelementtype: Report <br/> & _ syslastvalue. elementname = element. name () <br/> & _ syslastvalue. userid = curuserid (); <br/> ttscommit; <br/>/*** end... remark by xyf 20090922 -- <br/> Delete the report operation records so that the query dialog box displays To meet user requirements <br/> */</P> <p> _ set = element. ARGs (). parmobject (); // obtain the value set container passed in the form control button <br/> it = new setiterator (_ set); // place the set container value, remove redundancy and automatically sort changes </P> <p> while (it. more () <br/>{< br/> If (! Longstr) <br/> longstr = it. value (); <br/> else <br/> longstr + = ',' + It. value (); <br/> it. next (); <br/>}</P> <p> _ queryrun = new queryrun (this); // query of the overloaded data source <br/> qbds = _ queryrun. query (). ceno (1); // Second Method -- this. query (). datasourceno (1); <br/> qbr = sysquery: findorcreaterange (qbds, _ fieldid); // automatically create a query Filter field in the query dialog box <br/> qbr. value (longstr); // value initialization </P> <p>/* <br/> the method write in fect () ---- <br/> Info (this. query (). ceno (1 ). tostring (); <br/> while (_ queryrun. next () <br/>{< br/> doing something ......... <br/>}< br/> */<br/>}
Public Boolean fetch ()
{
Esgiqcline _ esgiqcline;
;
While (_ queryrun. Next ())
{
_ Esgiqcline = _ queryrun. Get (tablenum (esgiqcline ));
Doing something .....................
}
Return true;
}
Bytes ---------------------------------------------------------------------------------------------------------
(2) Form -- button
Obtain the btton object in form in the query initialization dialog box. Because the element object does not have this enumeration type, you must use the primary table and secondary table (Data Source) in the current form) tablenum is used as the Element Object value.
In the clicked event of the button, you can clear the element value of the object that succeeded in the last query operation to display the value of the current form as the initial value of the query!
NameName;
Name ='t: '+ num2str (tablenum (csm_packinglisttable),) + ','
+ Num2str (tablenum (csm_packinglistline), 1, 0, 1, 0 );
Delete_from syslastvalue
Where syslastvalue. userid = curuserid ()
& Amp; syslastvalue. elementname = Name;