Reputation: 501
I have a form with HeaderTable and LineTable datasource. HeaderTable contains FromDate and ToDate field and LineTable contains TransactionDate field.
As per the requirement I have to fill the TransactionDate field with 'fromdate' TO 'todate'.
For Example, if HeaderTable contains 1st-Jan & 8th-Jan as fromdate and todate respectively , than in line level it should automatically creates records for 1st to 8th Jan.
I hope it can be done using a button, but not clear. Please suggest with examples.
Thanks. :)
Upvotes: 2
Views: 437
Reputation: 501
Thanks Jan for replying.
This is how I solved this problem:
I created a button, on clicked method of the button I wrote this logic:
FromDate = Header.FromDate;
while (FromDate <= Header.ToDate)
{
Line.InvoiceId = Header.InvoiceId;
Line.TransactionDate = FromDate;
Line.doInsert();
FromDate++;
if (FromDate == Line.TransactionDate)
{
break;
}
}
Line_ds.research(true);
}
Hope this will help someone. Thanks.
Upvotes: 0
Reputation: 18061
Nothing happens automatically, do it your self:
for (transDate = fromDate; transDate <= toDate; transDate++)
{
salesLine.clear()
salesline.TransDate = transDate;
salesLine.initFrom...
salesLine.createLine(...);
}
I am glad I do not have to code the update logic, when the user changes the fromDate
or toDate
!
Upvotes: 1