8 Replies Latest reply on Mar 18, 2010 4:37 PM by firth5

    PORTAL -- Replace field contents

    firth5

      Title

      PORTAL -- Replace field contents

      Post

      We're adding portals to an established database.

       

      The main database is centered around SCENES in a film.

      I've added a portal to record VERSION numbers, and specific information about each version, including "artist" , "start date," "end date," and "notes."

      The versions start at 101 and sequence up from there.  

       

      I want to be able to find a batch of scenes, and assign them all to one artist.  When I do a REPLACE FIELD CONTENTS within the portal, it does not perform the action.  (The pinwheel spins for a while, but no new data is created.)  What am I doing wrong?  Is it because there are no new VERSION records yet created in the version table for those scenes?

       

      is there a simpler way around this?  If I have to click on every record within the portal to make batch data entry, we'll lose hours of time for simple data entry.....

       

      Thanks in advance!

      eric

        • 1. Re: PORTAL -- Replace field contents
          mrvodka

          A replace field contents will not create child child records that have allow creation on. A Set Field [ ] will though.

           

          See here.

           

          http://forum-en.filemaker.com/t5/Report-a-bug/Replace-Field-Contents-will-not-create-child-records-with-Allow/m-p/43250

          • 2. Re: PORTAL -- Replace field contents
            firth5

            Mr. Vodka, thanks for the response.

             

            Ok, so I've written the following script... but it's not working quite right.  Here's the situation:

             

            Found Set:  SCENES 1-10

            On the Child Table, it is sorted by the VERSION field, in descending order, so that the highest version is always at the top of the display.  (I am presuming this means the highest version # will  be the "first" portal row.)

             

            Run this SCRIPT:

            ------------

            Go to Record [first]

            LOOP

            Go to Portal Row [first]

            Go to field [CHILD TABLE::Version]

            Set Variable [$Version; Value: Get(activeFieldContents)]

            Go to Portal Row [next]

            Set Field [Version; $Version +1]

            Go to Record [Next; exit after last]

            END LOOP

            ------------

             

            Result:

            The script will go into each of the 10 "Scene" records and go to the highest version #.  It will then assign that # to a variable.  It goes to the next portal row and inserts the variable +1.  Then moves to the next Scene record and repeats.

             

            This is all fine and good.  But what I'm trying to do is CREATE A NEW CHILD RECORD and insert the variable.  

            "Go to Portal Row [next]" is not correct, right?  What do I want instead?!?

             

            Thanks in advance.

            • 3. Re: PORTAL -- Replace field contents
              carolynhaywood

              You need to have a new record request in there like : set variable ,Go to child layout, new record request, set field, go to parent layout ...

               

              I'm just a beginner so I hope this helps.

               

              Carolyn Haywood

              • 4. Re: PORTAL -- Replace field contents
                mrvodka

                I dont quite understand what you are trying to do or your structure that well. What is the purpose of this version number relative to the found set of scenes? Something does sound right.

                • 5. Re: PORTAL -- Replace field contents
                  firth5

                  Mr. V:  I hope the following answers your question.

                   

                  Each scene record (parent table) will go through several versions (child table).  We want to keep a record of when each version started, finished, and what notes accompanied each version.

                   

                  For Example:

                   

                  sc. 1

                        v101 -- Artist:  Sally, start 3/3, end 3/4, with notes "draw the glass of vodka larger."

                        v102 -- Artist:  Sally, start 3/4, end 3/5, with notes "accepted"

                   

                  sc. 2

                        v101 -- Artist:  Sally, start 3/3, end 3/4, with notes "scene should be a closeup."

                        v102 -- Artist:  Sally, start 3/4, end 3/5, with notes "closer still."

                        v103 -- Artist:  Sally, start 3/5, end 3/6, with notes "accepted."

                   

                   

                  My purpose in writing the above script would be two fold:

                  1) create a new child record

                  2) "version up"  (in other words, add +1 to the previous version.)  

                   

                   

                  eventually I'll add a script step that will:

                  a) if there is no previous version record, the first record will start at 101.

                  b) ask the user to type in the name of the artist (once) and then will use SET FIELD to put that name in ARTIST field within the child table for each record.

                  c) use SET FIELD to also put in the START DATE for each record.

                   

                   

                  The end result would be that the user could do a find for a given set of scenes, and the script would:

                  1) create a new portal record

                  2) version up the version # in the child table::VERSION fields

                  3) insert the same name in all the child table::ARTIST fields

                  4) insert the same date in all the child table::START DATE fields

                  • 6. Re: PORTAL -- Replace field contents
                    mrvodka

                    Well the first question's answer is you use a Max ( Child::Version ) + 1

                     

                     


                    firth5 wrote:

                    The end result would be that the user could do a find for a given set of scenes, and the script would:

                    1) create a new portal record

                    2) version up the version # in the child table::VERSION fields

                    3) insert the same name in all the child table::ARTIST fields

                    4) insert the same date in all the child table::START DATE fields


                    This part I still dont understand. Why are you adding Artist and StartDate as a child record for EACH of your found scene records?

                    • 7. Re: PORTAL -- Replace field contents
                      firth5

                      I'll look into the MAX function.  thanks.  Will this create the new child record within the portal?

                       

                      -------------------------------------------

                                     This part I still dont understand. Why are you adding Artist and StartDate as a child record for EACH of your found scene records?

                      -------------------------------------------

                       

                      The child record is the version, with additional fields ARTIST and STARTDATE.

                      each version needs a separate artist and date field, because they might be different than the previous version

                      Example:

                      sc. 1

                            v101 -- Artist:  Sally, start 3/3,

                            v102 -- Artist:  Sally, start 3/4, 

                       

                      sc. 2

                            v101 -- Artist:  Sally, start 3/3, 

                            v102 -- Artist:  Peter, start 3/4,

                            v103 -- Artist:  Peter, start 3/5, 

                       

                      • 8. Re: PORTAL -- Replace field contents
                        firth5

                        I think I found the error within my original script, posted above.   In order to create the new child record, "Go to Portal Row [next]" should have been: "Go to Portal Row [Last]."

                         

                        This seems to be working correctly now, (and using the MAX function)

                        1) creates a new child record and

                        2) versions up.   

                         

                        So far so good.

                         

                        (Personally, I don't really grasp the First / Next / Last directions within Portals quite yet.  It is not obvious to me.  How can "Last" be a record that doesn't exist yet?!?  But then again, the portal itself always shows an empty record for the last row.  So I tried "Last" and now it's working.....  All's well that ends well.)