3 Replies Latest reply on Feb 13, 2009 3:37 AM by Orlando

    Scripting for confused.

    elfin

      Title

      Scripting for confused.

      Post

      Good morning,

       

      I have a table 1 with layout to add to data to individual tables a-w

      A relation is set up from the table field ID (not serial) to individual tables a-w with calculation to 'serialIncrement ("A000";ID)' in each table.

       

      I have scripts:

      If [ProductBlank::ID = "A"]

      Perform Script [NewRecord_A] 'sends to layout of table'

      Else if [ProductBlank::ID = "B"]

      End

       

      My Perform Script for New Record I can send it to the layout, but I want it to add the product details in one table as well as add it to each individual table, so as an invoice can have a sub summary just from one table with all product info and their own ref. 

       

      Any guidance please, bible sending me to reference madness. 

       

      May inspiration be part of our day. 

        • 1. Re: Scripting for confused.
          Orlando
            

          Hi elfin

           

          Is the Product Detail set in the ProductBlank Table before the script is run?

           

          If so you could set the Product Detail field in your separate tables to be Lookup's based on a relationship between you ProductBlank table and your individual tables by the ID

           

          To setup your field to be a lookup you need to select the field in the Manage Database dialog, and click on the Options for the field.

           

          Now under the  Auto-Enter tab click on the option for 'Specify...' next to 'Looked up value' and another dialog will pop-up.

           

          In the 'Lookup for Field...' dialog you specify the Starting Table, the current table you are in, and then the 'Lookup from related table:' is the table you are getting the value from, so in this case the Table Occurrence of ProductBlank that is related to the table you are working in that is related by the ID, I hope this makes sense.

           

          So now when you set the related ID in the individual table it will look through the relationship and set that field to the value from ProductBlank.

           

          I hope this is what you are looking for, but if not let me know and we will see what we can come up with.

          • 2. Re: Scripting for confused.
            elfin
              

            Hi Orlando, Apologies filling in wong boxes for reply to this message, tagged lots of words.

            Thank you for your help, it is not quite what my end goal is, but knowledge gained. I will post when I have a solution. I know it can be done.

             

            Thank you

            elfin 

            • 3. Re: Scripting for confused.
              Orlando
                

              HI elfin

               

              If you can give more info on what you need to accomplish maybe there is an alternative to using lookups.

               

              Another option is to set a Variable, or pass the required value in a Script Parameter. and then in your Sub-script set the field directly.

               

              Also do you use a separate tables for each category? there may be a better solution for this if to make it easier to manage.