Look up Methods

Lookup() Method

Implement this code in the lookup() method of the field where you need the lookup to be displayed.


NS: The same code can be written in three places to achieve the lookup.
1) Under AOT->Table->Method and call this method from the form design where you want to display the lookup.
2) Form->Datasource->Table->Field->method
3) Form->Design->Field->Method.



public void lookup()
{
    uerWordFieldMapping uerWordFieldMappingLocal;
    SysTableLookup sysTableLookup;
    Query query;
    QueryBuildDataSource qbd;

   // Instantiate sysTableLookup object using table which will provide the visible fields 
    sysTableLookup = SysTableLookup::newParameters(tablenum(uerWordMergeFieldList),this);
    uerWordFieldMappingLocal = element.ParentFormValue();

    query = new Query();
    qbd = query.addDataSource(tablenum(uerWordMergeFieldList));
         qbd.addRange(fieldnum(uerWordMergeFieldList,TableName)).value(uerWordFieldMappingLocal.TableName);
// Specify the fields to show in the form
    sysTableLookup.addLookupfield(fieldnum(uerWordMergeFieldList,uerWordMergeFieldName));
  
// Set the query to be used by the lookup form
sysTableLookup.parmQuery(query);
//
    sysTableLookup.performFormLookup();
}


LookUp on datasource level :


public void lookup(FormControl _formControl, str _filterStr)
{
   SysTableLookup          sysTableLookup ;
    Query                   query = new Query();

    QueryBuildDataSource    queryBuildDataSource;
     sysTableLookup = SysTableLookup::newParameters(tableNum(OMInternalOrganization),_formControl);
    queryBuildDataSource = query.addDataSource(tableNum(OMInternalOrganization));

     sysTableLookup.addLookupfield(fieldNum(OMInternalOrganization, Name));
    sysTableLookup.parmQuery(query);
    sysTableLookup.performFormLookup();

}

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s