11 Replies Latest reply on Jul 26, 2010 3:16 PM by philmodjunk

    Posting/Sending Messages

    jeffd

      Title

      Posting/Sending Messages

      Post

      I'm a FM Pro 10 on XP user.

      I have been asked by several of our users at remote locations if we could have the ability to either broadcast

      a message to the others users or possibly come up with a way to post a message within a file.

      Let me know if any one has ideas how this could be done.

       

      Thanks

        • 1. Re: Posting/Sending Messages
          philmodjunk

          In general terms, you can set up a table for messages with additional fields to identify the originator and the designated recipients for each message record. A related recipients table can be used to track who has and hasn't read each message.

           

          You'll then need to decide on a notification method to let people know that they've recieved a message.

          A script that searches this file for unread messages could be set in file options to run when a specific database file is opened.

           

          You could also use an Install OnTimer script to check for such new messages periodically.

           

          However, keep in mind that most email software have the built in capability to do all of the above and filemaker can also send emails so you may find that there's a much simpler way than doing this all in filemaker.

          • 2. Re: Posting/Sending Messages
            jeffd

            I finally finished up with my "Message" file. Within the message file I created a "Post Message" script that does certain things such as set fields. However, I need to expand this "Post Message" script to include a notification method that would change a button in another file called "Quoter" to read  "A New Message has been Posted". When pressed, this button will take the user to the message file index. Of course, when the user selects this new message button, the button goes back to a "normal" status until another message is created.

            So any advice will be greatly appreciated.

            • 3. Re: Posting/Sending Messages
              philmodjunk

              You can either set up a conditional format to change the button's text color or group the button with a global text field and use a script to change the text in the field for a user.

              How often do you need the system to check for new messages? Once every time the file is opened or on a shorter interval?

              • 4. Re: Posting/Sending Messages
                jeffd

                I would like to set up a conditional format to change a button(I can also set up the global text) located in my "Quoter" file that would be generated anytime a user runs the "Post Message" script located in the "Message" file. So it's not really an install timer script but only when the post message script is engaged. I need help with the script step that would engage the conditional formatting within the post message script. Also, when a user selects the button to view the new message can we get back to normal until another new message is generated?

                Thanks

                • 5. Re: Posting/Sending Messages
                  philmodjunk

                  Here's a script for controlling conditional formatting. I've generalized it as you can apply it in quite a few different situations.

                  To turn the format on:

                  Set Field [Yourtable::gFormatOn ; True ] // You can use 1 instead of True if you want

                  To turn it off:

                  Set Field [Yourtable::gFormatOn ; False ] // You can use 0 instead of False

                  You can add these steps where needed to your existing scripts to change the button's appearance.

                  Your conditional format expression then becomes

                  Yourtable::gFormatOn // Use the formula option when entering this expression

                  gFormatOn would be defined as a global number field so that each user sees a different value for the global field. Don't use a global field if one user is changing this value and other users need to see the change.

                  You can change the value of a global text field to display different text in the same manner.

                  • 6. Re: Posting/Sending Messages
                    jeffd

                    Thanks again for the help, this works really well.

                    I do now how one more question. I realized (like you suggested earlier) that I will need to add a step in my opening script for the quoter file to check for any new messages that were posted since the user was last logged on. How would this be accomplished?

                    Thanks.

                    • 7. Re: Posting/Sending Messages
                      philmodjunk

                      I can only give you the bare outline. You'll have to adapt the technique to your system:

                      In File Options, you can specify that a script run each time the file is opened. Write a script that performs a find to search for any new message records. You can use Set Error Capture [on] to suppress Filemaker's "No records found" dialog that otherwise will interrupt your script and confuse your users. Get ( FoundCount ) will tell you how many records were found. If more than 0 are found do what you need to notify the user that new messages are pending.

                      • 8. Re: Posting/Sending Messages
                        jeffd

                        Mr. PhilModJunk,

                        I just discovered that the script for controlling that conditional formatting with field "gFormatOn" doesn't work like I was expecting to. Here's why (I think); I set this field gFormatOn in my messagesfile as a global number field. I incorporated the follwing into my "postMessage" script in the messages file; Set Field [Messages::gFormatOn; True]. Then I set up a conditional text field in the Quoter file with the formula as; Messages::gFormatOn = True to change the text to Red. But since the gFormatOn is a global number field the conditional formatting works only for the user who posted the message. The conditional formatting does not do anything for all other users.

                        What are your thoughts and what am I doing wrong.

                        Thanks.

                         

                         

                        • 9. Re: Posting/Sending Messages
                          philmodjunk

                          Well, that's why I stated: "gFormatOn would be defined as a global number field so that each user sees a different value for the global field. Don't use a global field if one user is changing this value and other users need to see the change."

                          Instead, you need to set a value in a field that all users can see. One way is to define a utility table with one record where you store this value. You then link it to all tables where this value needs to be accesible with the X operator instead of = in the relationship.

                          • 10. Re: Posting/Sending Messages
                            jeffd

                            Ok, finally back on this project.

                            I set up a field called "MessageFormatOn" as a number (not global storage) in the "Notification" table in my Messages file. The messages and notification tables are linked by the X operator. I also set up a relationship the same way with my Quoter table which is in the Quoter file. Keep in mind that when a new message is posted I want to notify all users currently using the Quoter table that a "New Message has Been Posted"(in Red text) message; the MessageFormatOn field does this. However, I ultimately want a conditional text field set up as a global field so that when a user clicks on this button it will hide or change this notification message back to normal and not change all. How would this be accomplished?

                             

                            Thanks again.

                            • 11. Re: Posting/Sending Messages
                              philmodjunk

                              One option would be to go back to the global field approach so that a user can modify the global field with their actions and thus "turn off" the format only for themselves and not other users. You could use a script that updates the value of this field when the file is first opened. If you need the value to update more frequently, you could use a number of different scripted stategies that check for new messages and then update the global field accordingly.