4 Replies Latest reply on Aug 18, 2009 8:14 AM by philmodjunk

    Need Help...



      Need Help...


      I am running on Windows and have FM Pro 10 Advanced. 


      I have 2 databases... Database A & Database B.


      In Database A, I am acquiring data and storing it in Database B through scripts and Copy & Paste Commands.  This is working well.  My problem is, that I need to find out how many records occur during a certain time frame (lets say the last hour and the hour before that), and bring the total for each hour back into Database A for display purpose.  This also needs to be updating every hour.


      Any suggestions, would be greatly appreciated.

        • 1. Re: Need Help...

          First to answer your question:


          In database B, Define a Time Stamp field and set the auto-enter option to enter Creation Time Stamp.


          Now you can perform a find for all records in a certain date, time range and the expression get (foundcount) will return the number of records created in that time. You could also set up a summary report that groups all records created within a certain time interval and displays the count.


          Now a basic comment:


          Don't use copy and paste to move data from one table (or file) to another!


          Reason #1: If your users are using the clipboard for their own purposes while also using your database, copy will replace the copied data with the data your script copies to the clip board.


          Reason #2: Copy and Paste do not work correctly, (and don't tell you that they didn't work), if the referenced fields arent' present on the current layout. Everything might work perfectly now, but a future layout modification could cause your script to silently fail (no error message, script doesn't halt) with unpleasant results for you when it happens.


          Simply use Set Field and/or Set Variable to move your data.

          • 2. Re: Need Help...

            Thanks for the suggestion as well as the basic comment...I have started using the Set Field a lot more, and will not use the copy and paste in the future.  I've been using an older software that I created with FM Pro 5 and used a lot of Copy & Paste, and surprisingly have not had any issues.  But thanks for the heads up.


            I'll give your suggestion a try. 


            Thanks :)

            • 3. Re: Need Help...
                 Using the Get(foundcount) worked well.  The only problem I have is that if there is no matching criteria for the time frame that I'm looking for, I get the message saying that there is no matching criteria.  Is there any way to get this NOT to pop up and just show the result as 0?
              • 4. Re: Need Help...

                There's a script step to suppress error messages:


                Set Error capture [on]

                Perform Find[]

                Set Error capture [off]