5 Replies Latest reply: May 15, 2014 9:57 AM by Data Kruncher RSS

    select only Q4 months in detail trap

    DJ, CISA

      I'm a new-bie.

       

      I have a report listing many transactions by date for the whole year.  For example,

       

      03/13/06 product-name code quantity

      10/04/06 product-name code quantity

      11/05/06 product-name code quantity

      12/06/06 product-name code quantity

       

      I want to define one detail trap to capture all the transactions dated in the month of October, November, and Decmeber.

       

      My first attempt at this, lead me to create multiple detail traps for each month.  One detail trap captured October, and then I created another model with a detail trap for November, and then another model with a detail trap for December.  In effect this worked, but I thought there had to be a better way.

       

      My second attempt at this, was that my detail trap captured all the transactions of the year, and then I used the Filter from the Table panel, to get just the October, November, and December transaction.  This was a better solution.

       

      Is there a better solution to this problem?  Can a single detail trap identify October, November, and December? 

       

      I tried to find a posting about this already, but I could not find one, and nothing the tutorial seemed to match what I need.

        • select only Q4 months in detail trap
          Kevin Whipp

          Why don't you just trap them all then apply a date filter.

          • select only Q4 months in detail trap
            Grant Perkins

            DJ,

             

            Kevin has it right confirming what you have already tried. It is by far the most flexible approach since I would guess at some point you will need other months in combination. A series of filters (individual or compound filters to choice) would make a common trap usable for all quarters.

             

            For the Oct/Nov/Dec example I guess you might be able to trap on the "1" of the month number in combination with whatever else you need. But it would not work for months 01-09 and so would be much less flexible than making the trap work for all available records and then filtering as required.

             

            If you have a very, very large input report  - several million records - there might just be a case for seeking a trapped solution but that would be a rare situation and I am guessing that it probably does not apply for your requirement.

             

            HTH.

             

             

            Grant

            • select only Q4 months in detail trap
              Data Kruncher

              Hi DJ,

               

              Just to continue with the good input you've already received, you might be interested in a sample formula for the filter you'd likely want to build.

               

              In the Table window, create a new filter named "Q4 Transactions", and give it the following formula:

              [font="courier"]Month()>=10  .And. Month()<=12  /font[/quote]This will limit the records displayed to those occurring in October, November or December.

               

              You could build similar Q1, Q2, and Q3 filters easily for later use.

               

              HTH,

              Data Kruncher

              • select only Q4 months in detail trap
                Nick Osdale-Popa

                Just to add my 2c worth, the filter can be even more simplified to:

                [font="courier"]Qtr()=4[/font][/quote]From the Functions Ref Guide:

                   Qtr(date)

                Returns the quarter of the year (1-4)

                within which a date falls: 1=January-

                March, 2=April-June, 3=July-September

                and 4=October-December.[/quote]You could even replace the "4" with a runtime parameter for the Quarter you seek!

                 

                 

                Edit: as a side note to the Datawatch developers... how about making a qualifier parameter to the QTR() function to work with Fiscal Years, thus one could use QTR(,6) would mean that Q1 = June - Aug continuing on to Q4 = Mar - May.

                • select only Q4 months in detail trap
                  Data Kruncher

                  Yes, the fiscal year problem is exactly why I overlooked the Qtr function. Our fiscal year starts in October, and as such the Qtr function does me no good, so I always forget about it!

                   

                  Thanks for pointing it out Nick.