insert the selected rows as a new record

      1. If i click the button, the selected line value(record) in the Grid should be inserted as new record

        1. If i click the button then selected line should be split as two record(Based on the Table numeric Field value(If that Field value = 5 means, after divided the first record that Field value = 3 and another one will be 2.

How to achieve this 2 solution…?

For the first question, take the current records selected and insert it in the same grid datasource.See the example code below.

Void clicked()


InventItemGroup inventItemGroup, inventItemGroup1;

Str itemgroup;

MultiselectionHelper helper = MultiselectionHelper::construct();


inventItemGroup = helper.getFirst();

While (inventItemGroup.Recid! = 0)



//Insert the selected line in the same datasource

inventItemGroup1 = inventItemGroup. ItemgroupId;





inventItemGroup = helper.getNext();



Can you elaborate the second question?

Thanks Anand.

I got result for my first question from your ans.

Second one is
If i click the button, the selected line should be split as two record like 1st Question(Insert a duplicate Record). And Also one more requir. which is That Table has Field “NoPieces” with int DataType.

If this NoPieces = 5 means, automatically Insert a duplicate Record and the First Record NoPieces Value is change to 3 and Duplicate will be 2.

original :

id name NoPieces

101 power 5

if click Button, it converts to

id name NoPieces

101 powder 3

101 powder 2

if NoPieces 9 means

id name NoPieces

101 powder 5

101 powder 4

if NoPieces 1 means, Dont Allow to Split…

How is the splitting of pieces going on?

I mean,will the splitting be done manually or is there any formulae for that?

Thnx Anand
I have done by using dialog box with ur above coding…