Wednesday 10 October 2012

Lookup for Temporary Table

Declare the Table Buffer on the Form Class Declaration

Ex:

public class FormRun extends ObjectRun
{
        ClassNamesList    classNamesList ;
}

Write the Business loging on init method of the form
Ex:

public void init()
{
   TreeNode rootNode =TreeNode::findNode("\Classes"); // used find the Class Node in AOT
    TreeNode childNode = rootNode.AOTfirstChild();
    int classCount,i=1;
    classCount= rootNode.AOTchildNodeCount();// gets the Fist Child

    while(childnode.aotnextsibling())
    {
        classNamesList.ClassName = childNode.AOTname();
        //classNamesList.ClassId = childNode.AOTgetProperty("ID");
        childnode = childnode.aotnextsibling();
        classNamesList.insert();
    }
    super();
}

Override the lookup method on which filed you want to perform lookup
Ex:


public void lookup()
{

    SysTableLookup        sysTableLookup = SysTableLookup::newParameters(tablenum(ClassNamesList), this);
    ;
       sysTableLookup.addLookupfield(fieldnum(ClassNamesList, ClassName));
    sysTableLookup.parmTmpBuffer(ClassNamesList);
    sysTableLookup.performFormLookup();
    super();
}

Make sure that TableType is InMemory for the above code


No comments:

Post a Comment