5 Replies Latest reply on Jan 2, 2013 12:03 PM by Mark Bingham

    Custom tabcmd Refresh

    Mark Bingham

      Hi, I believe this question has not been addressed elsewhere, and may be more straightforward than I think (as I have basically no experience with tabcmd). 

       

      Anyway, here it is:  I am looking to schedule a full extract refresh on a highly customized date logic.  The refresh will need to take place 10 days after the last Sunday of the month. 

       

      This, of course, always falls on a Friday, but it is not necessarily always the first Friday of the month.  I would like to know if there is any guidance available on creating this command in tabcmd and what the date logic might look like?

        • 1. Re: Custom tabcmd Refresh
          Toby Erkson

          10 days after the last Sunday would be a Wednesday...

          • 2. Re: Custom tabcmd Refresh
            Mark Bingham

            Excuse me - 10 business days (or weekdays).

            • 3. Re: Custom tabcmd Refresh
              Joshua Milligan

              Hi Mark!

               

              I'm sure the date logic could be written in a batch script.  But it might be easier, in the script that calls tabcmd, to have a list (or separate file) of dates and check to see if the current date is contained in that list and use that as a condition of whether or not to execute the refresh.  You should be able to find examples of that kind of batch logic online.

               

              I found a SQL script and modified it, so that it generates a list of dates that fits your logic.  I've attached the resulting dates.  You might double check my results.  Here's the SQL script:

               

              SELECT CAST(DATEADD(DAY, 10, (DATEADD(day, DATEDIFF(day,'19000107', DATEADD(month, DATEDIFF(MONTH,0,First_Day_Of_Month), 30))/7*7,'19000107'))) AS DATE)

              FROM

                        (

                                  SELECT '01/01/2013' AS month_date

                                  UNION ALL

                                  SELECT '02/01/2013' AS month_date

                                  UNION ALL     

                                  SELECT '02/01/2013' AS month_date

                                  UNION ALL

               

                                  ...     

               

                        ) m

               

              Message was edited by: Joshua Milligan I realized you said last Sunday, not Saturday.  I've attached a different file and updated the script inline.

              • 4. Re: Custom tabcmd Refresh
                Joshua Milligan

                I just noticed you added "business days".  That would change the above a little.

                • 5. Re: Custom tabcmd Refresh
                  Mark Bingham

                  Thanks Joshua!  Although that wasn't the specific command I was loooking for, I think it is the most straightforward solution to my problem.  Thanks for helping me think outside the box!