Hi Experts,
I have a customized form which has two data sources Header Table and Line Table. When I create a record in my form and select the salesId in a field in the header part it should show the lines associated with the salesId in the bottom (Line table) of the form. I was trying to get it done using below code in the modified method of the field salesId in the datasource. I am not sure if this is the proper way to do it and I have an issue here that if i select the same salesid multiple times before saving the record it will create unnecessary records in the line table since the insert is called each time when the field is modified. what is the best way to achieve it ?
public void modified()
{
SalesTable salesTable;
Salesline salesLine;
super();
select salesTable where salesTable.salesId == MyTable.salesId;
MyTable.salesId = salesTable.salesId
MyTable.CustReference = salesTable.custReference
while select salesLine where salesLine.salesId
{
MyTable.salesId = salesLine .salesId
MyTable.ItemId = salesLine.ItemId
MyTable.insert();
}
}