Wednesday 31 October 2018

Populate a temporary table on a form

  • Create a class to populate the temporarytable
 
public temporaryTable populateTemporaryTable()
{
   
 temporaryTable temporaryTable;
   
 int I;
   
 for(i = 0;i <= 5; i++)
 {
  //
  // Set the data in the table
  //
  temporaryTable.Field1 = "InterestungString";
  temporaryTable.Field2 = i;
  temporaryTable.insert();
 }
 return temporaryTable;
}
 
  • In the form add the temporary table as a datasource
  • In the form class declaration add a buffer based on the temporary table
 
public class FormRun extends ObjectRun
{
 //
 // Global temporaryTable
 //
 temporaryTable temporaryTable;
}
  • Populate the table in the form (usually in the init method)
 
public void init()
{
 BuildTempTable BuildTempTable = new BuildTempTable();
   
 super();
 //
 // Fill the buffer with data
 //
 temporaryTable = BuildTempTable.populateTemporaryTable();
 //
 // link the form datasource with the buffer
 //
 temporaryTable.linkPhysicalTableInstance(temporaryTable);
}

No comments:

Post a Comment