Monday, February 17, 2014

Populating Data source Using Temp Table

Form init method

public void init()
{
    custtable        nut; // regular table in AOT
    custtable        tmp; // instead of creating in AOT a temporary table
                                   // we can create a temporary instance of the preivous regular table
    ;
     super();

    // here we make it temporary;
    // it will disappear from memory when loses the scope
    // in other words, when we close the form
    tmp.setTmp();

    // simply selecting some of records from the regular table
    while select nut
        where nut.City=='Toronto'
    {
        // and putting them in the temporary one
        tmp.data(nut);
        tmp.doInsert();

    }
    // finally to show them on the form
    // we set the form data source to the temporary table
    custtable.setTmp();
    custtable.setTmpData(tmp);
}

No comments:

Post a Comment