7 Replies Latest reply on Oct 24, 2012 9:52 AM by heath

    Reporting Scipt Problem...

    heath

      Title

      Reporting Scipt Problem...

      Post

           Hello,

           The following is a script I use to generate a report of test that are do on todays date.  Everything works great, it finds all records with matching dates. 

             
      •           Show/Hide Toolbars [Show]
      •      
      •           Enter Find Mode [Restore]
      •      
      •           Set Field (Cyllinders:C_Date; Get (CurrentDate)]
      •      
      •           New Record/Request
      •      
      •           Set Error Capture [On]
      •      
      •           Perform Find []
      •      
      •           Enter Preview Mode []

           However, I also need it to find dates that are past due.  So I have added some other parameters to tell it to find not only records =< todays date, but that have a blank results field "CYCLINDERS::Crush Result".  This is to avoid all dates previous to today from being found, rather all fields less than or equal to today that have no data in the afformentioned field.  My script looks as follows

            

             
      •           Show/Hide Toolbars [Show]
      •      
      •           Enter Find Mode [Restore]
      •      
      •           Set Field (Cyllinders:C_Date; Get (CurrentDate) and CYCLINDERS 3::Crush Result = ""]
      •      
      •           New Record/Request
      •      
      •           Set Error Capture [On]
      •      
      •           Perform Find []
      •      
      •           Enter Preview Mode []

           This script does no work.  I have tried every combo I know and can't seem to make it work.  Any suggestions,

           Greg

            

        • 1. Re: Reporting Scipt Problem...
          philmodjunk

               Get (CurrentDate) and CYCLINDERS 3::Crush Result = ""

               Is a logical expression. It will evaluate to one of two values: 1 for True or 0 for False. It thus will put either a 1 or a 0 into the C_Date field so that your scritp then searches for a record where C_Date has the date 1/1/0001 (A value of 1 will evaluate as that date) and this is not likely to find any records.wink

               It will evaluate as true, BTW, because all fields that don't have global storage specified will be empty when you are in Find Mode.

               What you need is:

                 
          •           Show/Hide Toolbars [Show]
          •      
          •           Enter Find Mode [Restore]--->careful with this step, stored criteria can be easy to miss when you review this script at a later date
          •      
          •           Set Field [Cyllinders:C_Date; Get (CurrentDate)]
          •      
          •           Set Field [CYCLINDERS 3::Crush Result ; "=" ]
          •      
          •           New Record/Request
          •      
          •           Set Error Capture [On]
          •      
          •           Perform Find []
          •      
          •           Enter Preview Mode []
          • 2. Re: Reporting Scipt Problem...
            heath

                 That works with one exception.  I Still need to find past due records, thus not matching todays date, but have no results in "Crush Result".  So therefore I would assume I need to add a <= to the date.  How and where do I ad that?

                  

                 Thanks again,

                  

                 Greg

                  

            • 3. Re: Reporting Scipt Problem...
              philmodjunk

                   I'm not clear whether your find logic is Inclusive (or) or exclusive (and).

                   Do you want to find all records with today's date in C_date AND an empty Crush Result field?

                   Do you want to find all records with today's date in C_date OR an empty Crush Result field?

              • 4. Re: Reporting Scipt Problem...
                heath

                     Sorry, stupid question, just figured it out. 

                      

                     Thanks for all your help...THE BEST!!!

                      

                • 5. Re: Reporting Scipt Problem...
                  heath

                       Ok Phil-

                       I thought I had it but not so much after a day of testing.  I need all records with "today's date in C_date OR an empty Crush Result field" (only if it's date is less than or equall to, as all future dated records waiting on test results will have an empty Crush Result field and would not be considered "Past Due").

                       Thanks again,

                       Greg

                        

                  • 6. Re: Reporting Scipt Problem...
                    philmodjunk

                         The trick is to use two find requests in one find operation to specify an "OR" type find:

                           
                    •           Show/Hide Toolbars [Show]
                    •      
                    •           Enter Find Mode [Restore]--->careful with this step, stored criteria can be easy to miss when you review this script at a later date
                    •      
                    •           Set Field [Cyllinders:C_Date; Get (CurrentDate)]
                    •      
                    •           New Record/Request
                    •      
                    •           Set Field [Cyllinders:C_Date; "<" & Get (CurrentDate)]
                    •      
                    •           Set Field [CYCLINDERS 3::Crush Result ; "=" ]
                    •      
                    •           New Record/Request
                    •      
                    •           Set Error Capture [On]
                    •      
                    •           Perform Find []
                    •      
                    •           Enter Preview Mode []
                    • 7. Re: Reporting Scipt Problem...
                      heath

                           That works perfect.  I was close, just a little order change and away we go.

                           Thanks so much for your help Phil

                           I was just curious by your comment "careful with this step, stored criteria can be easy to miss when you review this script at a later date".  What do you mean by this exactly (if you have a spare minute, if not no worrys).

                           Greg