6 Replies Latest reply on Sep 10, 2013 10:45 AM by philmodjunk

    New record in related table and portal entries refresh

    AlinBadila

      Title

      New record in related table and portal entries refresh

      Post

           Hello!

           I'm new to FM but I like it very much so far. I want to make an app to ease my work and I'm stuck at a point. I have the tables related as in the attachment.  As you can see, for one PVC entry I can have more records in the tables in right. The layout in the attachment has tab entries and if I click on "new record" it creates a new record in the PVC table. The tab shown in the attachment has entries from "ConstatariOrganizatorice" table. Every other tab has entries from the tables related to PVC. 

           I don't know how to add a new entry in "ConstatariOrganizatorice" when I press the "Ok" button and also the entries added to be shown in the portal below. I tried with a script from the forum but I don't have the result I want. All it does is to create a new entry in "ConstatariOrganizatorice" with "_PvcIDFk" field completed and rest of them empty. Also, it adds an empty row in the portal.

            

           Thank you.

            

           PS: sorry for my english. I'm not a native english speaker.

      Screen_Shot_2013-09-09_at_8.27.01_PM.png

        • 1. Re: New record in related table and portal entries refresh
          AlinBadila

               and the second attachment..

                

          • 2. Re: New record in related table and portal entries refresh
            AlinBadila

                 and the third attachment. I don't know how to put all images in one post.

            • 3. Re: New record in related table and portal entries refresh
              SteveMartino

                   Hard for me to quite figure out your question, but what happens if you put a 'Commit Record' Script step after your 'Set Field...' Script Step?  And you may need a 'Refresh Window' Script Step after "Go to Layout'.

              • 4. Re: New record in related table and portal entries refresh
                philmodjunk
                     

                          I tried with a script from the forum but I don't have the result I want. All it does is to create a new entry in "ConstatariOrganizatorice" with "_PvcIDFk" field completed and rest of them empty.

                     The script is doing exactly what it was written to do: Creates a new record in the portal row linked to the current record in the Layout's table. What else do you need it to do?

                     Also, it adds an empty row in the portal.

                     It looks like you enabled the "allow creation of record via this relationship" for the portal's Tutorial: What are Table Occurrences?. This causes a special, empty appearing, "add row" to appear below that last actual record shown in the portal. If you click or tab into this portal row, a new record is automatically created and the "_PvcIDFk" field in this table will automatically get a matching value to link it to the current record in the layout's table.

                     You really don't need both the script and this "allow creation feature". Usually, you use one or the other to create a new related record.

                • 5. Re: New record in related table and portal entries refresh
                  AlinBadila

                       Sorry if I didn't make myself understood. The layout in 1st attach is based on PVC table. The "Organizatorice" tab contains fields coresponding to "ConstatariOrganizatorice" table. Also, the portal in the bottom of the layout shows record from the same table. When typing in every field, after pressing tab key, the portal record updates, and I don't want this. When "Ok" button is pressed I want to:

                       1. all the fields to complete the record in "ConstatriOrganizatorice" table

                       2. the record to be shown in the portal

                       3. a new empty record to be created in "ConstatariOrganizatorice" table

                       4. all the field in "Organizatorice" tab to be empty, ready for editing.

                  • 6. Re: New record in related table and portal entries refresh
                    philmodjunk

                         Then the fields in the upper part of the tab panel should not be the exact same fields shown in the portal. Define a set of fields for use in the upper part with global storage. Add set field steps to your script to copy the data from the global fields into the fields of the new record created in your portal. And additional set field steps can clear fields by setting them to "" so you can clear the global fields after creating the new portal record.