29 Mar 2013

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;
}

No comments:

Create number sequence in D365 FO

Create the data type. Add code in the loadModule method of the appropriate NumberSeqModule subclass. Add a method to the module’s paramet...