Evelio
2/16/2006 11:20:00 PM
I found a solution for the problem I had before:
I changed the last line:
lookupCtrl.performFormLookup(sysTableLookup.formRun());
for the following:
sysTableLookup.performFormLookup();
And it works perfect.
Thank you so much for your code Welk, it was a great help for me.
"Evelio" wrote:
> Unfurtunally, using Axapta 3.0 SP3, this solution raise an error while trying
> to execute the last line of code:
>
> lookupCtrl.performFormLookup(sysTableLookup.formRun());
>
> The error state the formRun() method is protected, so it must be called from
> an inherited class of SysTableLookup. Due to this reason the code won't run
> if you create this method as static in the InventTable table.
>
> Please let me know if you have a work around for this problem or maybe an
> alternative class.
>
> Thanks in advance,
>
> Evelio.
>
>
>
> "Welk" wrote:
>
> > Put this Methode on the InventTable. And overload a Field used for ItemId.
> >
> > --------------
> > client static void lookupItemId_Example(Object lookupCtrl, VendAccount _VendAccount, str _itemId = "")
> > {
> > SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable),lookupCtrl);
> > Query query = new Query();
> > QueryBuildDataSource queryBuildDataSource = query.addDataSource(tableNum(InventTable));
> > QueryBuildRange queryBuildRange = queryBuildDataSource.addRange(fieldNum(InventTable, PrimaryVendorId));
> > QueryBuildRange queryBuildRange2 = queryBuildDataSource.addRange(fieldNum(InventTable, ItemID));
> > ;
> >
> > QueryBuildDataSource.addSortIndex(indexnum(InventTable, ItemIdx));
> > queryBuildRange.value(_VendAccount);
> >
> > if( strFind(_ItemId,"*",1,999) ||
> > strFind(_ItemId,"?",1,999))
> > queryBuildRange2.value(_ItemId);
> >
> > sysTableLookup.addLookupfield(fieldNum(InventTable,ItemID));
> > sysTableLookup.addLookupfield(fieldNum(InventTable,ItemName));
> > SysTableLookup.addLookupfield(fieldnum(InventTable,BarCode));
> > sysTableLookup.parmQuery(query);
> > lookupCtrl.performFormLookup(sysTableLookup.formRun());
> >
> > /*
> > HowTo:
> >
> > void lookup()
> > {
> > ;
> > InventTable::LookupItemId_Example(this, // Lookup Object
> > "1234", // example VendAccount (used for Query)
> > this.text()); // Entered String, maybe used for Query2
> > // super();
> > }
> >
> > */
> > }
> >
> >
> >
> >
> > technet.navision.com Posting date: Friday, March 02, 2001
> >
> > technet.navision.com Posting path: Navision Axapta/Technology (Ax)/MorphX