13 Replies Latest reply on Jan 15, 2009 2:40 AM by Jens Teich

    Is it just me????

    jfilar3

      Title

      Is it just me????

      Post

      Hi, all. I'm stuck on a script step (this is a DB I've inherited and I'm trying to maintain for several users).

       

      I have a table (Details) that stores the current case status '(Details::Case Status)' and the date that case status became active '(Details::Case status date)'. If a case is closed for more than 90 days, the record can be purged. I have a button that runs the PURGE script. The first line of that script is:

       

      'If [(Details::Case Status = "Closed" ) and ((Details::Case Status Date + 90 )  > Get ( CurrentDate ))]'

       

      with the idea being that the script checks to see if the case is both CLOSED and the status date (the date it closed) + 90 is beyond the current date. Here are the next few steps:

       

            'Freeze Window

            Set Field [Details::Case Status; "Purged"]

            Set Field [Case Status Date; Get ( CurrentDate )]

            Refresh Window

      Else If [(Details::Case Status Date + 90 ) < Get ( CurrentDate )]'

       

      And it goes on from there with custom dialog that addresses situations where the user cannot purge a record.

       

      Here is the problem - ALL of the Else If statements work just fine. However, the FIRST line (the If statement) only seems to check that '(Details::Case Status = "Closed" )' and seems to ignore the AND part '(Details::Case Status Date + 90 )  > Get ( CurrentDate )'. In other words, as long as the Case Status is showing closed, it purges the record. Am I missing something in the AND statement? I'm guessing it's something obvious and I'm just too absorbed in this to see it......

       

      Thanks in advance!:manvery-happy:

        • 1. Re: Is it just me????
          ninja
            

          Howdy jfilar3,

          Thanks for the post.

           

          I don't have a direct answer for your question, perhaps another will chime in with one.

           

          I, personally, never use "AND" in an If statement.  I use two nested If's instead.

           

          If this=that

                If other=otherthing

                      Do this

                EndIf

          Else If

           

          and so forth.....

          It seems that this would work in your case also without the headache and/or risk of getting records purged when they shouldn't be.

           

          Sorry for the non-answer, but hopefully the fix will get you up and good. 

           

          • 2. Re: Is it just me????
            Jens Teich
               > ((Details::Case Status Date + 90 ) > Get ( CurrentDate ))

            hast to be

            ((Details::Case Status Date + 90 ) < Get ( CurrentDate ))



            Jens



            • 3. Re: Is it just me????
              jfilar3
                

              Ninja and Jens - Thanks for your replies. However, I wonder if this may be the problem?

               

              The field 'Case status date' is set to display the date in the format MM/DD/YY (window size constraints!); whereas the function 'Get (CurrentDate)' displays in the format Day of week, Month DD, YYYY.

               

              I've tried your suggestions but it doesn't seem to recognize the date calculation, whether using nested If functions or using the And function.

               

              So, maybe I should start with what I need it to do......

               

              When the user presses the "Purge Record" button, I need it to check two fields. It needs to check first to see if the 'case status' field is showing "Closed". If it is closed, then it needs to compare the field 'case status date' with the current date. If the current date is more than 90 days past the 'case status date', the record can be purged, which means the case status field changes to "Purged" and the case status date field changes to the current date. (No worries about the purge - it doesn't actually delete the record, only stores it in the user's Purge list!)

               

              If it IS closed, but the current date is less than 90 days after the case status date, then it displays an error message saying the case can't be purged and leaves the case status and date as they are (i.e. no changes made).

               

              Now, if the case status is "open" or "purged" , it displays appropriate error messages and no changes occur (this part is working just fine).

               

              Any ideas? Thanks again!

              • 4. Re: Is it just me????
                raybaudi
                  

                Hi jfilar3

                 

                > Any ideas?

                 

                1) Is the 'Case status date' really a date field ?

                 

                2) Which is the result of a calculation field, result date, and calc:
                  
                Details::Case Status Date + 90

                 

                3) the If [ ] script step must contain:

                 

                Details::Case status = "Closed" and Details::Case status date + 90 < Get ( CurrentDate )

                • 5. Re: Is it just me????
                  jfilar3
                    

                  Hi, Danielle. Yes, Details::Case Status Date is showing as Type "Date". The date is entered as a result of various scripts that enter the date into the field, and in layout, the field's "Date Format" is set as MM/DD/YY.

                   

                  Side note - I discovered that there is a field (not one that is displayed on this same layout) set up called Details:: Purge Date Calc which is a Calculation field with the following:

                   

                  If (Case Status = "Closed"; Case Status Date + 90; "" )

                   

                  When I display the result for that, it also appears to show as a date. I even tried using 'Purge Date Calc' in place of 'Case Status Date + 90', but to no avail.....  :-(

                   

                  • 6. Re: Is it just me????
                    raybaudi
                       Read my 3 rd point !
                    • 7. Re: Is it just me????
                      jfilar3
                        

                      Look back to my original posting. The original script DID have the 'case status date + 90 > Get (CurrentDate)'  but did not work properly. {and I do want it '>' current date because it's only supposed to purge the record if it's both closed AND 90 days past the case status date; using a '<' current date would mean case status date + 90 days hadn't yet passed}

                       

                      Thanks!

                      • 8. Re: Is it just me????
                        raybaudi
                          

                        I don't think so...

                         

                        You said:

                         

                        > If the current date is more than 90 days past the 'case status date', the record can be purged

                         

                        this is the same as writing: Get( CurrentDate) > case status date + 90 or:

                         

                        case status date + 90 <  Get( CurrentDate)

                        • 9. Re: Is it just me????
                          jfilar3
                            

                          Sorry to confuse you, you are right that I misspoke later on down the thread.

                           

                          Example: Let's say the case closed 1/12/09 (January 12 2009). When the script runs, if 1/12/09 + 90 hasn't arrived yet (i.e. CurrentDate > 1/12/09 + 90), the script initiates the error message that says the case hasn't been closed for 90 days yet.

                           

                          Again, my apologies for stating that backwards in the previous post.

                          • 10. Re: Is it just me????
                            raybaudi
                              

                            Jfilar3, I do not understand what you want...

                             

                            If the script must initiate an error message that says the case hasn't been closed for 90 days yet, you have to write:

                             

                            ToDay is past 'case closed' + 90

                             

                            Isnt so ?

                             

                            BTW: what's the problem to try the < symbol ?

                             

                            or to change the formula to.

                             

                            Details::Case status = "Closed" and Get ( CurrentDate ) > Details::Case status date + 90

                            • 11. Re: Is it just me????
                              jfilar3
                                 Absolutely nothing. It works perfectly now! Ok, I am just a complete IDIOT as I got my logic all twisted around. Thank you for helping me clear that up!!!!!
                              • 12. Re: Is it just me????
                                raybaudi
                                  

                                I'm glad for you !

                                 

                                incidentally Jens says the same thing on his first post.

                                • 13. Re: Is it just me????
                                  Jens Teich
                                     > incidentally Jens says the same thing on his first post.

                                  My original post swallowed the "<", I corrected this yesterday.