axapta - How to add an extra row to a custom lookup query? -
i created custom lookup on prodbom table , displays bom items given production order user can select items listed on bom. want them able select produced bom item (prodtable.itemid) in list (1 item). how this?
here current lookup:
static void lookupitemidbomsubset(formstringcontrol _ctrl, prodid _prodid) { systablelookup systablelookup = systablelookup::newparameters(tablenum(prodbom), _ctrl); query query = new query(); querybuilddatasource qbds = query.adddatasource(tablenum(prodbom)); ; qbds.addrange(fieldnum(prodbom, prodid)).value(queryvalue(_prodid)); qbds.addsortfield(fieldnum(prodbom, linenum), sortorder::ascending); systablelookup.parmquery(query); systablelookup.addlookupfield(fieldnum(prodbom, linenum)); systablelookup.addlookupfield(fieldnum(prodbom, bomid)); systablelookup.addlookupfield(fieldnum(prodbom, itemid), true); systablelookup.addlookupmethod(tablemethodstr(prodbom, itemname)); systablelookup.addlookupfield(fieldnum(prodbom, prodlinetype)); systablelookup.addlookupfield(fieldnum(prodbom, inventtransid)); systablelookup.performformlookup(); }
you try using temp version of prodbom, populate necessary information , use buffer perform lookup:
prodbom tmpprodbom, prodbom; prodtable prodtable; ; //set table temp buffer tmpprodbom.settmp(); //first record, insert temp buffer select prodtable prodtable.prodid = _prodid; tmpprodbom.linenum = 0; tmpprodbom.bomid = ""; tmpprodbom.itemid = prodtable.itemid; //...etc each field have/want available tmpprodbom.insert(); //insert rest of records while select prodbom prodbom.prodid = _prodid { tmpprodbom.linenum = prodbom.linenum; tmpprodbom.bomid = prodbom.bomid; //...etc each field want available tmpprodbom.insert(); } systablelookup.parmtmpbuffer(tmpprodbom); systablelookup.addlookupfield(fieldnum(prodbom, linenum)); //etc systablelookup.performformlookup();
i don't have adequate form set test lookup, may need play around in testing environment, have used similar method in past.
Comments
Post a Comment