1 Reply Latest reply on Jun 8, 2010 12:50 PM by fitch

    converting 4D database

    x4der

      Title

      converting 4D database

      Post

      Hello,

       

      I am converting my 4D database to Filemaker and most things have gone smoothly, but I am having trouble converting this 4D method to a Filemaker script. Here it is in 4D:

       

        ` will update production schedule for inventory file
      DEFAULT TABLE([Product_List])  `reset all product needs in inventory file
      ALL RECORDS([Product_List])
      For ($i;1;Records in selection([Product_List]))  `this loops until it reaches the last record
          MESSAGE("Resetting the production schedule.")
          [Product_List]Needs_In_1:=0
          [Product_List]Needs_In_2:=0
          [Product_List]Needs_In_3:=0
          [Product_List]Needs_In_4:=0
          [Product_List]Needs_In_5:=0
          [Product_List]Needs_In_6:=0
          [Product_List]Needs_In_7:=0
          [Product_List]Needs_In_8:=0
          [Product_List]Needs_In_9:=0
          [Product_List]Needs_In_10:=0
          [Product_List]Needs_In_11:=0
          [Product_List]Needs_In_12:=0
          [Product_List]Needs_In_12_Plus:=0
          SAVE RECORD([Product_List])
          NEXT RECORD([Product_List])
      End for
      QUERY([Invoices];[Invoices]Shipped=False)
      For ($j;1;Records in selection([Invoices]))    `this loops until it reaches the last record
          MESSAGE("Please wait. The production schedule is being updated.")
          QUERY([Line_Items];[Line_Items]Work_Order_Number=[Invoices]Work_Order_Number)
          For ($k;1;Records in selection([Line_Items]))
              QUERY([Product_List];[Product_List]Item_Number=[Line_Items]Item_Number)
              Case of
                  : (([Invoices]Needs_By_Date)-Current date<=7)
                      [Product_List]Needs_In_1:=[Product_List]Needs_In_1+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=14)
                      [Product_List]Needs_In_2:=[Product_List]Needs_In_2+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=21)
                      [Product_List]Needs_In_3:=[Product_List]Needs_In_3+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=28)
                      [Product_List]Needs_In_4:=[Product_List]Needs_In_4+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=35)
                      [Product_List]Needs_In_5:=[Product_List]Needs_In_5+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=42)
                      [Product_List]Needs_In_6:=[Product_List]Needs_In_6+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=49)
                      [Product_List]Needs_In_7:=[Product_List]Needs_In_7+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=56)
                      [Product_List]Needs_In_8:=[Product_List]Needs_In_8+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=63)
                      [Product_List]Needs_In_9:=[Product_List]Needs_In_9+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=70)
                      [Product_List]Needs_In_10:=[Product_List]Needs_In_10+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=77)
                      [Product_List]Needs_In_11:=[Product_List]Needs_In_11+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date<=84)
                      [Product_List]Needs_In_12:=[Product_List]Needs_In_12+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
                  : (([Invoices]Needs_By_Date)-Current date>84)
                      [Product_List]Needs_In_12_Plus:=[Product_List]Needs_In_12_Plus+[Line_Items]Quantity_Ordered
                      SAVE RECORD([Product_List])
              End case   `else will fall out of loop
              NEXT RECORD([Line_Items])
          End for
          NEXT RECORD([Invoices])
      End for

       

      This method lists all of our products in a spreadsheet like form and gives our product needs for the next 12 weeks and everything beyond 12 weeks.

      How do I attack this in a Filemaker script?