LookUp On forms

hi guys,
Here i am sharing a method to how to use a lookup In FROM Control....
so just try the following method in your code..


public void lookup()
{

    Query                   query = new Query();
    QueryBuildDataSource    qbds,qbds1;  
    QuerybuildRange         QuerybuildRange,QuerybuildRange1,QuerybuildRange2;
    QuerybuildLink          QuerybuildLink;
    SysTableLookup          sysTableLookup;

    ;

    sysTableLookup = SysTableLookup::newParameters(tablenum(UB_ResourceRequest1), this);

    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,ResourceRequestNo), true);
    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,RRStatus), true);
    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,ApprovedNumber),true);
    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,AllocatedNumber),true);
    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,DateOfRequirement),true);
    sysTableLookup.addLookupfield(fieldnum(ResourceRequest1,ApprovalStatus),true);

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

    QuerybuildRange = qbds.addRange(fieldnum(ResourceRequest1,RRStatus));
    QuerybuildRange1 = qbds.addRange(fieldnum(ResourceRequest1,RRStatus));
    QuerybuildRange2 = qbds.addRange(fieldnum(ResourceRequest1,ApprovalStatus));

    QuerybuildRange.value(enum2str(RRStatus::Open));
    QuerybuildRange1.value(enum2str(RRStatus::Partial));
    QuerybuildRange2.value(enum2str(RRWFApprovalStatus::Approved));

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

    super();
}

-Harry

Comments

Popular posts from this blog

Connecting to Databases through X++ PART -I

X++ code for document attachment

Multiple Tables In Query