4 Replies Latest reply on Aug 7, 2014 1:04 PM by philmodjunk

    Related Table not generating many records

    firebase

      Title

      Related Table not generating many records

      Post

           I have one table with products with a smaller that contains prices that change over the time.

           When i update the price it should write a new record in that sub table with the new price and timestampt.

           Everything works so far, but the new value is simply overwriting the old one instead of generating a new one.

           What ever i did it did not changed. So solve this i changed the relation ship so that its not allowed to write new records and told the script to go to the layout, writing a new record plus the data, but now i tought i can do this more elegant.

           Any ideas what could be wrong?

        • 1. Re: Related Table not generating many records
          philmodjunk

               What method are you using to create the new record in your related table?

               Are you using a script?

               A portal where you manually enter this data?

               Or ???

               "allow creation of records via this relationship" makes it possible to create a new related record in certain situations where it would not be possible without enabling this option, but it does not make it an automatic process. You still have to create the new related record.

          • 2. Re: Related Table not generating many records
            firebase

                 I thought i have only to create a new record in the parent table and then to use set field to write in that record into that field.

                 Ok, that actually makes sense so i have to use new record for each new record in that subtable then?

            • 3. Re: Related Table not generating many records
              firebase

                   But to i have to navigate in that srict to that layout to generate a new record or can i do this from the parent table somehow?

                    

              • 4. Re: Related Table not generating many records
                philmodjunk

                     If you have this relationship:

                     Products---<Pricing

                     with "allow creation.." enabled for pricing records, Then this script, when performed on the Products layout:

                     New record/request
                     Set Field [Pricing::Price ; 5 ]

                     Creates one new products record and then the set field step creates one related pricing record with 5 in the Price field.

                     But it can only create the first related record. It can't create any additional pricing records linked to an existing products record

                     In this code:

                     New record/request
                     Set Field [Pricing::Price ; 5 ]
                     Set Field [Pricing::Price ; 6 ]

                     The second set field step will overwrite the 5 with a 6 in the related pricing record.

                     To add an additional related record is typically done with this kind of script:

                     Set Variable [ $ProductID ; value: Products::__pkProductID ]
                     Go to Layout ["Pricing" (Pricing)]
                     New record/Request
                     Set Field [Pricing::_fkProductID ; $ProductID ]

                     This creates a new record in pricing and links it to the current product record.