lookup method

Hi ,

i have a question for the lookup.

i want to show lookup on a control of form from a table (Id ,description) , i want to put description on the control after see the value on lookup, but i want to sort it on the basis of Id . Currently it is sorted on description. In lookup i only want to show description only

Thanks

Your lookup should show Description only, but it doesn’t mean that you can’t sort the query by Id. What exactly is the problem?

the Description is sorted alphabetically but i want to sort it on the basis of Id. For ex:

id Desc

1 xyz

2 abc

3 mno

currently , when i show description in look up, it shows abc, mno,xyz but i want to show xyz,abc,mno

thanks

You just have to sort the query by ID. I can’t tell you what exactly to do unless you explain how you created the lookup. If you used SysTableLookup, sort the query by calling addSortField().

here is the code on control lookup method

public void lookup()
{
//super();
sysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(SARPRPDelayedTaskStatus),this);
Query query = New Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;

qbds = query.addDataSource(tablenum(SARPRPDelayedTaskStatus));

qbr = qbds.addRange(fieldnum(SARPRPDelayedTaskStatus,ManualAdjustment));

qbr.value(strfmt(’%1’,NoYes::Yes));

sysTableLookup.addLookupfield(fieldnum(SARPRPDelayedTaskStatus,Description)) ;

sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();

}

Hi Manish,

Refer link https://sites.google.com/site/shalombelaishax/query/datasource

https://sites.google.com/site/shalombelaishax/query/datasource

public void lookup()
{
//super();
sysTableLookup sysTableLookup = SysTableLookup::newParameters(tablenum(SARPRPDelayedTaskStatus),this);
Query query = New Query();
QueryBuildDataSource qbds;
QueryBuildRange qbr;
;
qbds = query.addDataSource(tablenum(SARPRPDelayedTaskStatus));
qbds.addSortField(fieldnum(SARPRPDelayedTaskStatus,ID), SortOrder::Ascending);
qbr = qbds.addRange(fieldnum(SARPRPDelayedTaskStatus,ManualAdjustment));
qbr.value(strfmt(’%1’,NoYes::Yes));
sysTableLookup.addLookupfield(fieldnum(SARPRPDelayedTaskStatus,Description)) ;
sysTableLookup.parmQuery(query);
sysTableLookup.performFormLookup();
}

HI ,

I already tried addsortfield method , but is does not worked

First of all, check the query string generated from the query definition (you can get it by calling qbds.toString()). If it’s wrong, you have to fix the query. If it’s correct, the problem must be somewhere else.

Yes, I checked that, actually I am not able to add join with “! =” clause secondly when I add data source of TabC to TabA, TabB gets wiped out.

Sorry, posted in the wrong thread.