Hi Marcos Create an index on the part number and the reverse of the date or invoice number (ie it needs a dummy field with the formula -PxFx) on the Purchase Panel. Create a Panel link linking from the inventory panel to the purchase panel using the reversed date/invoicenum index. This will mean if you traversed a panel link from the Inventory to the Purchase panel then the most recent item would be the first related record in the purchase panel. Panel links are used for 1 to many relationship, so using this link for a calculation in a calculated field is usually not useful, however in this case a calculation through this panel link will give the last record, so you can use its date, invoice number, customer etc.
Regards Brian -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Marcos Favero Florence de Barros Sent: Tuesday, 12 October 2010 5:27 AM To: DataPerfect Users Discussion Group Subject: [Dataperf] Using Keep A Total to Update Records in Foreign Panels Hi, Although I read the "Using Keep A Total to Update Records in Foreign Panels" section in Ralph Alvy's book, I'm not sure about how to handle the following situation. In the Inventory Control section of a database, there is: (1) an 'Inventory' panel with: Item name _______________ Quantity now in stock _____ units Cost of most recent purchase $ _____ (2) a 'Purchases' panel with: Date of purchase __/__/____ Item name _______________ Quantity purchased _____ units Purchase cost $ _____ The 'quantity purchased' field of the second panel is used to update the 'quantity now in stock' field of the first panel via a keep-a-total, as usual. Now, I would like to have another automatic update here, namely copying 'Purchase cost' of the second panel into 'Cost of most recent purchase' of the first panel. This would be similar to keep-a-total except that the number should not be added or subtracted, but just copied. Is that possible? (An accounting note: We need the cost of the *most recent* purchase because we are going by the so-called LIFO, or Last In First Out, criterion for the cost of merchandise sold.) Here is another way to frame the same question. Suppose we have a window in the first panel, with a single line, displaying records of the second panel in reverse order (i.e., just the last record appears), and showing just one field: 'purchase cost'. This is exactly the information I want to be in the first panel -- only, not in a window, but in a real field. Thanks, Marcos _______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/mailman/listinfo/dataperf _______________________________________________ Dataperf mailing list [email protected] http://lists.dataperfect.nl/mailman/listinfo/dataperf
