5 Replies Latest reply on Jan 14, 2010 2:18 PM by StellaLuna

    wrong script output!! Finfing specific data within a month!

    penhaifai

      Title

      wrong script output!! Finfing specific data within a month!

      Post

      I have this script that a friend of mine did; i don't want to get credit for what i didn't do! it has a nice feature of searching within specific dates for data. but it is still doesn't matching the same results as i can get it when i run the regular "find" methode. In fact, it comes up with less of what the "find" can come up with!! what is missing in this script?!!

       

      Show All Records
      Go to Record/Request/Page
      [ First ]
      Loop
      If [ (Client Databse V9::NineMO_Due_Month = Client Databse V9::NineMO_Report_Month_Select and Client Databse
      V9::NineMO_Due_Year = Client Databse V9::NineMO_Report_Year_Select) ]
      Omit Record
      End If
      Go to Record/Request/Page
      [ Next; Exit after last ]
      End Loop
      Show Omitted Only
      Go to Layout [ “Report-9mo_Reviews_Due” ]

       

       the layout is as following;

       

       

       the "find due" is a trigger to the script...

       

      I tried to improve and correct the script and came up with this one but still same incorrect results!

       

      Show All Records
      Go to Record/Request/Page
      [ First ]
      Go to Layout [ “Report-9mo_Reviews_Due” ]
      Loop
      If [ Client Databse V9::Info_Active="Open" ]
      If [ (Client Databse V9::NineMO_Report_Year_Select = Client Databse V9::NineMO_Due_Year) ]
      If [ (Client Databse V9::NineMO_Due_Month = Client Databse V9::NineMO_Report_Month_Select) ]
      Omit Record
      End If
      End If
      End If
      Go to Record/Request/Page
      [ Next; Exit after last ]
      End Loop
      Show Omitted Only
      Go to Layout [ “Report-9mo_Reviews_Due Copy” ]


       

       

      Thank you in advance

       

       














        • 1. Re: wrong script output!! Finfing specific data within a month!
          philmodjunk
            

          Well the obvious answer is that something is different between performing the find by hand and this script but that doesn't help you.

           

          Probably one of the fields referenced in your if statments has an issue. It may return a value with more characters than are visible. There might be a space returned in the month name calculation for one example. You might have a calculation with a return type of number instead of text.

           

          You could insert a pause/resume step inside your loop and check values on the current record by clicking into the fields at each pass through the loop to see where things go wrong.

           

          In any case, I don't see why such a complex script is needed.

           

          Why not create a script that simply enters find mode and uses a series of set field steps to set up the find criteria exactly like you would when performing this find "by hand"?

          • 2. Re: wrong script output!! Finfing specific data within a month!
            comment_1
              

            Doing a find would be indeed simpler - and faster, too.

             

             

            To satisfy your curiosity: after you omit a record, you are already in the next record. But your scripts moves to the next record anyway - so that the record immediately after the one that has been omitted is never checked.

            • 3. Re: wrong script output!! Finfing specific data within a month!
              penhaifai
                

              Thank you both for your time and effort. I may try your solution and see how can i manage that.

               

              Your hint; Comment; about omitting record will take mae right away to the next record w/o any need to do a go to the next record or it'll skip one record.I tried to replace that command with something else to end the loop when all records already done but i couldn't find any. any idea? or is there a way to end the loop when it reaches last record and done from it?

               

               

              thank you

              • 4. Re: wrong script output!! Finfing specific data within a month!
                comment_1
                  

                Try it this way:

                 

                Show All Records

                Go to Record/Request/Page [ First ]
                Loop
                If [ <test> ]
                Omit Record
                Else
                Go to Record/Request/Page [ Next; Exit after last ]
                End If
                End Loop



                • 5. Re: wrong script output!! Finfing specific data within a month!
                  StellaLuna
                    

                  Another thing which might make your script simpler, you have:

                  Loop
                  If [ Client Databse V9::Info_Active="Open" ]
                  If [ (Client Databse V9::NineMO_Report_Year_Select = Client Databse V9::NineMO_Due_Year) ]
                  If [ (Client Databse V9::NineMO_Due_Month = Client Databse V9::NineMO_Report_Month_Select) ]
                  Omit Record
                  End If
                  End If
                  End If

                   

                  You can combine all three If[] tests into one calculation dialog as:

                   

                  If [

                  Client Databse V9::Info_Active="Open"

                  AND

                  Client Databse V9::NineMO_Report_Year_Select = Client Databse V9::NineMO_Due_Year

                  AND

                  Client Databse V9::NineMO_Due_Month = Client Databse V9::NineMO_Report_Month_Select) ]

                  Omit Record

                  End If
                  :womanvery-happy: