11 Replies Latest reply on Jun 17, 2011 8:47 AM by philmodjunk

    Add new note button - how to adapt to my own layout?

    brianbotkiller

      Title

      Add new note button - how to adapt to my own layout?

      Post

      Hi everyone, 

      I need to duplicate the "add new note" button that is in the contact management template that comes with FMP.  I simply have a text section in my layout in which I need to make a new note box to enter archive notes copied (manually) from another notes section in the layout. However, I'm a little confused about how to use the parameters of the button in the contact management template in my new layout.  

      I understand that if I want to keep track of username/etc. when the new note is created, I need to create a table entry wherein each note will be its own new record in the table as they are created, allowing for searching/sorting/etc.  I believe this is what I need to do.  However looking at the script from the add note script which comes with FMP, I'm a little confused about how to adapt this to my needs.  

      The notes section in the layout is simply notes on a project, which are the current status notes of the project.  However the old notes need to be copied into the archive notes section to be able to look at the history of notes enered.  

      So, I have a table created in the database called "archive notes".  I have a new tab in the layout named archive notes.  In it I want to craete a button for "add new note", which when clicked, will track the username/date/etc., and create a text entry box in which the user can paste the data from the "current status" notes section, which is defined simply as "notes" in the database. 

      I just want to make sure I do this right, I know it requires some scripting, but it seems like there should be a way to use the script from the FMP solution in some way, since it's exactly what I need, but copying it, well, doesn't work. 

      If anyone has thoughts, I would be very grateful.  Thank you!

        • 1. Re: Add new note button - how to adapt to my own layout?
          philmodjunk

          You can use the import scripts button in the script manager to import a script from one file to another but you'll then need to edit the imported script to work correctly within your new file as it refers to tables and fields in the contact managment file that likely have different names in your file.

          The script that you refer to is pretty simple. It just stores the ID number of the current contact in a variable, switches to a layout based on the notes table, creates a new notes record and uses set field to add the ID number of the current content from the variable into the new record.

          There are no script paramters specified for the Add Note button.

          to "track the username/date/etc", add fields for this information in your notes table and set auto enter field options to enter the creation date, user (or account) name, etc each time a new record is created.

          • 2. Re: Add new note button - how to adapt to my own layout?
            brianbotkiller

            Hi Phil, thank you so much for getting back to me. I was actually reading another thread where you were conversing with someone who wanted to do about what I want to do, but the import script seems like the way to go, for sure.  The client says he doesn't really need to track the notes and their changes in a table in the database, so I'm wondering if I should use the easier method which DavidAnders had suggested, which went like thsi: 

            If you have two TEXT Fields - NewNote and Notes

            A Button above NewNote says "NewNote" the script attached to "NewNote"

            SCRIPT for "NewNote"

            Get ( CurrentDate ) &"  " &  Get ( CurrentTime )  & " - "

            SCRIPT FOR "AppendNewNote"

            NewNote &

            "¶" &

            "_______________" &

            "¶¶" &

            This seems like a good approach, since it will track date/time, and create the note field.  However I don't want to go for simplicity and find out later that it would have been better to do something more rubust, so perhaps I should go with the first script option. Mine is very simple since the oly field needed in it is the "archive notes" field - no need for much beyond that. 

            Thanks for your thoughts.  

            • 3. Re: Add new note button - how to adapt to my own layout?
              philmodjunk

              I seel little benefit to that approach. It works, but doesn't really strike me as all that much "simpler" and you give up flexibility you may regret if your needs change in the future.

              • 4. Re: Add new note button - how to adapt to my own layout?
                brianbotkiller

                That's what I thought.  Ok, so I'll try using the add new note script/button and editing to match the table in my database.  The contact management template has a layout called "notes_utility", which basically shows the data that is being called from the new note.  Do I need to replicate that, or can I skip that part? 

                • 5. Re: Add new note button - how to adapt to my own layout?
                  philmodjunk

                  You don't need to replicate the layouts, but you do need to look at the tables and how they are related to make sure that you use a similar set up in your file.

                  • 6. Re: Add new note button - how to adapt to my own layout?
                    brianbotkiller

                    Ok.  I'll do all I can do set the tables up correctly in the database and re-link everything.  THanks for your input - it means a lot. 

                    • 7. Re: Add new note button - how to adapt to my own layout?
                      brianbotkiller

                      Ok, forgive me, This isn't working. 

                      I've tried getting this to work and it just won't work, the add notes button started creating new records in the primary layout, the text field I put an auto calculate into gave me a message about the table being unrelated, and I guess I have my fields setup wrong between the "archive notes" table and the Primary table, which hosts client data.

                      I really just need to hit "add note", and get a text box which can have data pasted into it, with this kind of data auto-filled into it: 

                      #Date# #Time# #UserName#
                      Status note here.....

                      I think I'd better go with the easier solution here, if there is one. 

                      Can you give me some insight on how I can use this option: 

                      If you have two TEXT Fields - NewNote and Notes

                      A Button above NewNote says "NewNote" the script attached to "NewNote"

                      SCRIPT for "NewNote"

                      Get ( CurrentDate ) &"  " &  Get ( CurrentTime )  & " - "

                      SCRIPT FOR "AppendNewNote"

                      NewNote &

                      "¶" &

                      "_______________" &

                      "¶¶" &

                      to acheive this?  

                      Do I place the script for, let's say, "new notes", into the auto enter calculation section of a text field?  

                      Is there a way I can do this without all this tabling and relationship editing?  I realize I'm asking for the dumbed down version here, but I really need to just clear this thing down and be done with it at this point.  

                      Many thanks. 

                      • 8. Re: Add new note button - how to adapt to my own layout?
                        brianbotkiller

                        Ok, now I'm confused.  

                        I copied everything as best as I believe I could.  It now works.  When I click "add note", it creates a new text field inside of a portal, and migrates that data into a layout called "archvie notes", simimlar to the "notes_utility" that is found in the filemaker solution. 

                        Ok, great - so it all works - but only in NEW records.  If I go back to an old record that was in the database before I did this, and I hit "add note", it jumps over to the first tab, which is "status notes", and doesn't create the text field in the "archive notes" tab.  It creates a record in the "archive notes" layout.  However, nothing shows up in the tab.  

                        So, uh, ok.  I'm very confused, now.  Any input would be appreciated.  

                        This is my script: 

                        Add a Note 

                        Set Variable [ $ID_Contact; Value:Issues Tracking::k_ID_Contact ] 

                        Freeze Window 

                        Go to Layout [ “Archive Notes” (Archive Notes) ] 

                        New Record/Request 

                        Set Field [ Archive Notes::kf_ID_Contact; $ID_Contact ] 

                        Commit Records/Requests 

                        [ Skip data entry validation; No dialog ] 

                        Go to Layout [original layout] 

                        Go to Field [ Archive Notes::Text ] 

                        Below is an image of how my relationships are setup in the database - this is the SAME as how the FMP solution has it setup: 

                        relationship graph

                         I just don't understand what is going on.  I'm so close, yet so far... if you have a thought, I'd love it.  Thank you. 

                        • 9. Re: Add new note button - how to adapt to my own layout?
                          philmodjunk

                          Do all your contacts have ID numbers in issues tracking::K_ID_Contact?

                          If you imported your contacts into the database from another file, these imported records may not have been assigned a serial number in this field during import. (It depends on the options you selected.)

                          If that sounds like a possible explanation, see this thread for ways to fix the problem: 

                          Help importing Excel data into a Filemaker Starter solution

                          • 10. Re: Add new note button - how to adapt to my own layout?
                            brianbotkiller

                            Ok, I think that makes sense.  Since the Contact_ID is a new field I created for this add note thing, then I would guess that that would mean that old records wouldn't be able to access the function.  

                            I'll try it and report back - thanks for the input, as always. 

                            • 11. Re: Add new note button - how to adapt to my own layout?
                              philmodjunk

                              The replace fields "fix" described in the other thread will work for you here.