Hi,
Try using View. Create a view for your lookup form. Don't need to trouble yourself. Then you just need to filter it out in you form. Regards From: development-axapta@yahoogroups.com [mailto:development-axa...@yahoogroups.com] On Behalf Of pkpeterson652 Sent: Tuesday, March 02, 2010 9:49 PM To: development-axapta@yahoogroups.com Subject: [development-axapta] Re: Query extended range failure, linking InventTrans and InventDim Of course as soon as I submitted this, found the problem. Changed the addRange for InventSerial id to value(SysQuery::valueEmptyString()); Paul --- In development-axapta@yahoogroups.com <mailto:development-axapta%40yahoogroups.com> , "pkpeterson652" <ppeter...@...> wrote: > > Creating a custom lookup Form and when I execute the lookup I receive the following message: > > Query extended range failure: InventDim.InventSerialId is not a valid datasource.field pair near pos 29. > > What I want selected from InventTrans is: > > 1. Records associated with a particluar Production order (ItemId and InventTransId selections) > 2. Records that aren't associated with a serial number. > > In the init method of the data source (InventTrans) I have coded the following: > > public void init() > { > Query q; > QueryBuildDataSource qB; > QueryBuildDataSource qB2; > ; > > super(); > > q = new Query(); > qB = q.addDataSource(tablenum(InventTrans)); > qB.addRange(Fieldnum(InventTrans,ItemId)).value(prodTable.itemid); > qB.addRange(FieldNum(InventTrans,InventTransId)).value(prodTable.InventTrans Id); > qB.addRange(FieldNum(InventTrans,Qty)).value('> 0'); > > qB2 = qB.addDataSource(tablenum(InventDim)); > qB2.addLink(FieldNum(InventTrans, InventDimId),fieldNum(InventDim,InventDimid), qB.name()); > qB2.addRange(Fieldnum(InventDim,InventSerialId)).value(strfmt('(%1.%2 = "")', 'InventDim', fieldStr(InventDim, InventSerialId))); > qB2.joinMode(JoinMode::InnerJoin); > > this.query(q); > } > > The query that is built from the above looks like this: > > SELECT * FROM InventTrans WHERE ((ItemId = N'038020AH')) AND ((InventTransId = N'LOT003279')) AND ((Qty>0)) JOIN * FROM InventDim WHERE InventTrans.inventDimId = InventDim.inventDimId AND (((InventDim.InventSerialId = ""))) > > Don't understand the reason for the message and what what I need to change to eliminate it. > > Any help would be appreciated, Paul > __________ Information from ESET NOD32 Antivirus, version of virus signature database 4910 (20100302) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4910 (20100302) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 4913 (20100303) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com [Non-text portions of this message have been removed]