AlterNate Items in form

Hi,

In sales Order->Lines->Item

if I click Button I need get alterNate ItemId for perticular selected SalesLineItemID

How can i Do this…

I have passed selected record to form.

In Form->DS-InventTable I Have Taken.

I wrote code in ExecuteQuery:

public void executeQuery()

{

super();

//______________________________

_SalesLine = element.args().record();

//info(_SalesLine.ItemId);

// Sun

select Inv where Inv.ItemId == _SalesLine.ItemId;

// Inv = InventTable::find(“cab01”,false);

counts = 1;

if(Inv.AltItemId)

{

ItemId1 = Inv.AltItemId;

//ItemId3 = ItemId1;

do

{

while select InventTable where InventTable.ItemId == ItemId1

{

//counts++;

itemId[i] = InventTable.AltItemId;

ItemId2 = InventTable.AltItemId;

ItemId1 = ItemId2;

i++;

Info(InventTable.ItemId);

// counter++;

//print(InventTable.ItemId);

}

}while(InventTable.AltItemId);

}

IN the Form-> I am getting selected record.

In execute query I am doing this code but not getting alterNate all record. I am getting only one record.

Thanks in adv.