4 Replies Latest reply on Dec 26, 2013 2:57 PM by Rman

    Due Today, Tomorrow

    Rman

      Title

      Due Today, Tomorrow & Next Week calculations

      Post

           Hello!

           I'v been trying so hard NOT to have to post a question for the last three weeks. But, for the life of me, I can't figure this one out.

           In a Table called "Manufacturing Orders" I have a Field named "Order Due Date." (It's a drop-down calendar field.)

           Then, assigned to a pop-up menu button, I have a Values List that contains:  Due Today, Due Tomorrow, Due Next week, Order Due Date, Order Entry Date & PO#. 

           When the a value is selected, an "OnObjectModify" script is triggered to sort the order of the records that contain that data. I'v been able to write the scrips needed to sort and display basic field data, but I'm having the hardest time trying to write a script that will return a calculation that shows me records where "Order Due Date" is = to Today. Or, where "Order Due Date" is = to Today + 1 day. Or, lastly, where "Order Due Date" is = to Today + 7 days.

           The calculation should return a calendar date.

           Any help or tips would be greatly appreciated.

           Ryan

            

            

        • 1. Re: Due Today, Tomorrow & Next Week calculations
          philmodjunk

               Get ( CurrentDate )

               Get ( CurrentDate ) + 1

               Get ( CurrentDate ) + 7

          • 2. Re: Due Today, Tomorrow & Next Week calculations
            Rman

                 Ah! Thank you.

                 Here's my new issue.... 

                  

                 Using a Trigger to run the script:

                  

                 If [Stock Transactions::Sort Selection = "Due Today"]

                     Find Matching Records [Replace; Stock Transactions::Orders_Today]

                 End If

                 Go to Record/Request/Page [First] 

                  

                 Where "Orders_Today" is an indexed calculation field with the statement: Get (CurrentDate) = OrderDate

                  

                 When I ran this script for the first time, it worked. Awesome! The script returned all the records that matched "Orders_Today." Just as if I had typed todays date and searched via the toolbar. Lets just say it showed the 2 records of 200 that fit the argument.

                 Every time after that, I get the exact opposite. The script returns 198 records and leaves out the 2 matching ones.

                 Any ideas?

                  

                 Thank you again.

                  

                  

            • 3. Re: Due Today, Tomorrow & Next Week calculations
              philmodjunk

                   Calculation fields that use a Get function must be unstored and by definition, these are not indexed. Otherwise, they will not correctly update when the date returned by your system clock changes.

                   I'd use one of the scripted find examples found Here:  Scripted Find Examples

                   To find all records with Today's, Next week's, etc dates.

              • 4. Re: Due Today, Tomorrow & Next Week calculations
                Rman

                     Thank you so much...again.

                     I look forward to repaying the help to someone else in the future.

                     With some tweaking of the scripts in the link you posted, I got exactly what I was looking for. Thank you again, for you help and tips.

                     Ryan