Wednesday 16 August 2017

Passing a temp table between forms

Sometimes you need to pass a built temp table from one form to another.

The following is a button opening another form, but the buffer is shared between them.


Form 1:
It's assumed that the temp data is already built by this point
Override the clicked event on the button


void clicked()

{
Args args;
FormRun formRun; super();
args = new args(formStr(Form1Name));
args.record(tempTable);
formrun = classFactory.formRunClass(args);
formRun.init();
formRun.run();
formRun.wait();
formRun.detach();
}


Form 2:

Code in form, in the temporary table datasource – tempTable:

Override the init event in the table


public void init()
{
tempTable _tempTable;
_tempTable = element.args().record();
super();

tempTable.linkPhysicalTableInstance(_tempTable);
tempTable_ds.refresh();
}