3 Replies Latest reply on Jul 12, 2012 7:26 AM by davidanders

    Would like help creating an "add a note" script (I think)

    KenForrester

      Title

      Would like help creating an "add a note" script (I think)

      Post

      I just purchased Filemaker Pro 11.  I am trying to learn how to use it.  I have begun customizing my own database.  I would like to include an "Add a Note" function/field? in the database (similar to the one in the Contact Management database).  I think I probably have to create a script to do this.  However, I may be totally mistaken.

      I apologize if this seems very basic to others, but I really would appreciate some help on how to proceed.

      Thank you.

        • 1. Re: Would like help creating an "add a note" script (I think)
          GuyStevens

          You might or might not need a script.

          Actually this can be created in a very simple way.

          Depending on how you want to display your notes.

          If your notes can be displayed in a portal it would be sufficient to create a new table "Notes"

          I don't know anything abou your current setup so I'll be a assuming you have a "Contacts" table and that that table had a field "ID" which is a Number field with auto enter serial number.

          In your "Notes" table you need following fields:

          Id  -  A number field with auto enter serial number.
          ContactIdFk  -  A number field (FK stands for foreign key, here we will store the ID of the contact thatn this note is linked to)
          Note - A text field.
          Date - a Date field  -  This is optional, but it might be handy to know when a note was created. You can set this to auto enter Date on creation.

          Then in the relationships view "File" - "Manage" - "Database" - "Relationships"

          Create a relationship (drag one field to the other) between:

          Contacts::Id-------[=]------Notes::ContactIdFk

          Now double click the [=] sign to edit the relationship and check the boxes on the Notes side of the relationship for "Allow creation of records..." and "Delete related records when...."

          Not on a layout based on your contacts table create a portal that's based on the notes table. Add the fields Note (first) and Date (second)

          In the portal add a Delete button that performs as it's button action a "Delete portal row" step. To delete notes.

          • 2. Re: Would like help creating an "add a note" script (I think)
            MikeTrotter_1

            I have a text field on a layout that I use to keep notes about a case. This script will move to the notes field and insert a timestamp and username and then move the cursor to allow the user to enter the text. It adds new notes to the same field above previous notes.

             

            • 3. Re: Would like help creating an "add a note" script (I think)
              davidanders

              Very simple old school.

              Two Text Fields - "NoteNew" and "Notes"

              Two Buttons - "New Note" and "Add To Notes"

              New Note Button Script

              Set Field [Table::NoteNew; GetAsText(Get(CurrentDate)) & ", " & Hour(Get(CurrentTime)) & ":" & If(Minute(Get(CurrentTime)) < 10; "0" & Minute(Get(CurrentTime)); Minute(Get(CurrentTime))) & " - "]
              Go To Field [Table::NoteNew]

              Add To Notes Button Script

              Set Field [Table::Notes; Table::NoteNew & "¶" &  "_______________" &  "¶¶" & Table::Notes]
              Set Field [Table::NoteNew; ""]

              Notes Displayed in one large long note, newest to oldest.