4 Replies Latest reply on Mar 17, 2015 8:49 AM by philmodjunk

    How to make an "update notes" script?



      How to make an "update notes" script?


      I am very new to Filemaker and am trying to develop a script that will essentially "replace field contents" in a portal for me. 


      Background on my database: 
      Within my database individual records are houses. I have a weekly notes tab that allows staff members to add information about those houses at various points throughout the construction process. Many of these notes are applicable to multiple houses in a development, and so my end goal is to develop an "update notes" button that will duplicate the note for each house in that development. On my layout, the "weekly notes" table is viewed through a portal and each row is made up of the following fields: "Notes" "date and time" "user" "communication style"

      I already have an "update notes" button that is linked to the script, I just need help to actually get the script to work. 

      Right now it says:

      Find Matching Records [Replace, Filemaker Data::Development]

      Go to Portal Row [Select; Previous]

      Replace Field Contents [Weekly Notes::Note].


      Right now what it is actually doing- 

      It does narrow down the records to find only the ones in that development (success!!) but then it will simply duplicate the note onto multiple rows of the portal on the original record. So it doesn't update the other records in the found set, and I don't want it to replace multiple rows on one record, I want it to add a new row to the other records. 
      I am assuming that after I correctly write the steps to update the "notes" field, I would duplicate those steps for the other fields in that portal row. 

      I hope my question made sense! Thank you for any assistance you can provide. 

        • 1. Re: How to make an "update notes" script?

          It's probably best to not try to do this on the portal.  You should get you found set, go to the layout the found set is based on and do a Replace Field Contents.

          • 2. Re: How to make an "update notes" script?

            And I would guess that your script would need to create a number of new related records to populate with this note. A loop could take one record of this table and duplicate it, updating the match field to related it to different houses in the development.

            But another option would be to change your relationship design so that instead of making duplicate copies of a note, you simply link that one note to all applicable records in your table so that it becomes visible from the context of any one of those records.

            • 3. Re: How to make an "update notes" script?

              Hey guys,

              Thank you both for your responses. I have tried to do this via the "Notes" layout instead of the portal. Right now it seems like I can duplicate the first note in that layout, but I cannot seem to get it to show up in the portal for the other address. 

              I really like the idea of linking the records-but I am not sure how to do that. Since it is a database of houses, it would be nice to link all the houses within one development. Can you point me in the direction of how to do that? 

              Here is a link to a simplified version of my database. I pre-apologize because I'm sure some of my relationships are crazy or I may have skipped some steps. You should be able to use the guest account. 

              • 4. Re: How to make an "update notes" script?

                When you duplicate the record, you then have to update the match field in the newly created record in order for it to link to a record for a different house.

                If you want a note to apply to all houses in a development, perhaps you need an additional notes table that links to a table of development records.

                DevelopmentNotes>----Developments-----<Houses-----<HouseNotes   (----< means "one to many" )