jeudi 20 octobre 2011

How to copy records in a grid of a form

Here is an example of copying a record from a grid :
 In the clicked method of the button

public void clicked()
{
    super();
    ThyKanbanTable::createCopy(thyKanbanTable);
    thyKanbanTable_ds.executeQuery();
    thyKanbanTable_ds.last(); // set the cursor at the last record copied
    Tab.tab(1); // display the tab number one of the form
}
createCopy is declared under the ThyKanbanTable as following :

public static server void createCopy(ThyKanbanTable _ThyKanbanTable)
{
    ThyKanbanTable          newKanbanTable;

    ;

    ttsbegin;

    newKanbanTable.data(_ThyKanbanTable);
    newKanbanTable.KanbanID = NumberSeq::newGetNum(ThyKanbanParameters::numRefKanbanId()).num();
    newKanbanTable.insert();

    ttscommit;
}

Aucun commentaire:

Enregistrer un commentaire