look up showing duplicates vaulue

Dear all, I have created a look up in the customized sales order where it display the sales id and vairous details and in the called form it calls all the item id which are used says in sales line i have used itemid2456 3 times in the look up for the particular item it is being display 3 times where as it should be displayed only one times so basically i have to removed the duplicated look up vaulue which are called from the previous screen please refer the attchement

Hi Rohit,

What query or datasources did you use for the customized lookup?

Hi Andre I have a testsale table under that method i wrote public client static void Testsaleslookup(FormStringControl _ctrl, SalesId _filter) { // Intantiantes a SysTableLookup object telling it which control activated the lookup, and // what table should be displayed inside the lookup form. SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(SalesLine), _ctrl); Query query = new Query(); // This query will be used by the lookup form. QueryBuildDataSource qbds; ; // The “addLookupField” method adds the the fields that will be shown inside the lookup’s grid. // The second, boolean parameter indicates that this field will be returned from the lookup when a // record is selected. In this case, we’ll return our DummyPK. sysTableLookup.addLookupField(fieldnum(SalesLine, ItemId), true); // sysTableLookup.addLookupMethod(tableMethodStr(SalesLine, itemName()); sysTableLookup.addLookupMethod(“itemName”); // Using our dummy table as a DataSource Table. qbds = query.addDataSource(tablenum(SalesLine)); // This is the key part, what we want to filter to be displayed in the grid. qbds.addRange(fieldnum(SalesLine, SalesId)).value(_filter); // Passes the query to the sysTableLookup. sysTableLookup.parmQuery(query); // Activates the lookup. sysTableLookup.performFormLookup(); } under the testsale form there under field itemid i wrote public client static void Testsaleslookup(FormStringControl _ctrl, SalesId _filter) { // Intantiantes a SysTableLookup object telling it which control activated the lookup, and // what table should be displayed inside the lookup form. SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(SalesLine), _ctrl); Query query = new Query(); // This query will be used by the lookup form. QueryBuildDataSource qbds; ; // The “addLookupField” method adds the the fields that will be shown inside the lookup’s grid. // The second, boolean parameter indicates that this field will be returned from the lookup when a // record is selected. In this case, we’ll return our DummyPK. sysTableLookup.addLookupField(fieldnum(SalesLine, ItemId), true); // sysTableLookup.addLookupMethod(tableMethodStr(SalesLine, itemName()); sysTableLookup.addLookupMethod(“itemName”); // Using our dummy table as a DataSource Table. qbds = query.addDataSource(tablenum(SalesLine)); // This is the key part, what we want to filter to be displayed in the grid. qbds.addRange(fieldnum(SalesLine, SalesId)).value(_filter); // Passes the query to the sysTableLookup. sysTableLookup.parmQuery(query); // Activates the lookup. sysTableLookup.performFormLookup(); } and it is being called from the salestablelistpage where i kept one button one sales prder action pane under general

this is new image all the same vaulues are coming in look up we dont want get duplicates in look up from previous sales line screen

Here you go,

public client static void Testsaleslookup(FormStringControl _ctrl, SalesId _filter)

{

// Intantiantes a SysTableLookup object telling it which control activated the lookup, and

// what table should be displayed inside the lookup form.

SysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(SalesLine), _ctrl);

Query query = new Query(); // This query will be used by the lookup form. QueryBuildDataSource qbds; ;

// The “addLookupField” method adds the the fields that will be shown inside the lookup’s grid.

// The second, boolean parameter indicates that this field will be returned from the lookup when a

// record is selected. In this case, we’ll return our DummyPK.

sysTableLookup.addLookupField(fieldnum(SalesLine, ItemId), true);

// sysTableLookup.addLookupMethod(tableMethodStr(SalesLine, itemName());

sysTableLookup.addLookupMethod(“itemName”);

// Using our dummy table as a DataSource Table. qbds = query.addDataSource(tablenum(SalesLine));

// This is the key part, what we want to filter to be displayed in the grid.

qbds.addGroupByField(fieldNum(SalesLine, ItemId));

qbds.addRange(fieldnum(SalesLine, SalesId)).value(_filter);

// Passes the query to the sysTableLookup.

sysTableLookup.parmQuery(query);

// Activates the lookup.

sysTableLookup.performFormLookup();

}