I've changed relation fields into function, eg. products->ProdName to function call:
FieldFromDataBase('Products', 'ProdName', 'ProdID')
where this function is defined as:
Code: Select all
function FieldFromDataBase(xArea, xField, cIndexKey)
(xArea)->(DBSeek(cKIndexKey))
return (xArea)->(&xField)
there was relation from invoice to invoice items to synchronize data:
Code: Select all
select('Invoices')
set relation to InvoiceID into InvoiceItems additive
select('InvoiceItems')
set filter to InvoiceItems->InvoiceID == Invoices->InvoiceID
It worked OK on standalone computer, even with hundred of thousands records, but, it almost halted the system in network environment.
So, I've decided to change browse control displaying invoice items to grid control displaying array of invoice items.
This array is refreshed always when pointer in browse of invoices is moved.:
Code: Select all
InvoiceItems->(DBSeek(Invoices->InvoiceID))
aItems := {}
FRM_InvoiceRegister.GRID_InvoiceItems.DeleteAllItems()
n := len(aInvoiceItemsFields)
do while InvoiceItems->InvoiceID == Invoices->InvoiceID .and. !InvoiceItems->(eof())
aTemp := {}
for i := 1 to n
aAdd(aTemp, &(aInvoiceItemsFields[i]))
next i
FRM_InvoiceRegister.GRID_InvoiceItems.AddItem(aTemp)
InvoiceItems->(DBSkip())
aAdd(aItems, aTemp)
enddo
FRM_InvoiceRegister.GRID_InvoiceItems.Refresh // this line is not necessary, I think...
Actually, the table aItems is not necessary here, it's used for other applications.
Wow, this post is terribly theoretical so I want to apologize for the boring
Best regards, Marek