1 Reply Latest reply on Apr 4, 2011 9:42 AM by philmodjunk

    Updating inventory prices from invoices for current values

    KevinSalisbury

      Title

      Updating inventory prices from invoices for current values

      Post

      Hi,

      I'm relatively new to filemaker and am having trouble figuring this one out! I have a parent table called "INVENTORY" that serves as a reference to "INVOICE ITEMS" and are related by a common "product ID". As a user enters products in an Invoice, related values (prices, product weight, qty's, etc) are lookedup and are stored in the "INVOICE ITEMS" table. The problem I'm having is creating a script or relationship that will update information in the INVENTORY table, so that it reflects current product prices. I've tried adding a sort to their relationship and making "price" in the INVENTORY table with a calculated value "Last ( INVOICE ITEMS::price) but it doesn't seem to work. I really appreciate your help!

        • 1. Re: Updating inventory prices from invoices for current values
          philmodjunk

          It seems unusual that you would use data in the InvoiceItems table to update prices in the inventory table, but it can be done.

          From the Invoice Items portal this script will take the price entered in it and update the matching Inventory record:

          Set Field [Inventory::Price ; InvoiceItems::Price ]

          I'd put a button in the InvoiceItems portal row and write the script like this:

          Show Custom Dialog ["Update inventory price for this item"]
          If [Get (LastMessageChoice ) = 1 /* User clicked OK */]
             Set Field [Inventory::Price ; InvoiceItems::Price ]
          End IF

          A variation of this script could loop through all the items in the portal to update their matching inventory prices.