IBM Sterling Transformation Extender

Sterling Transformation Extender

Come for answers, stay for best practices. All we're missing is you.


#Sterling
#Supplychain
 View Only
  • 1.  ADDDAYS

    Posted 08/18/09 11:49 AM

    Originally posted by: SystemAdmin


    Hello,

    Is there a way to add just business days? (i.e. exclude weekends and holidays from ADDDAYS). Thank you.

    -Rich
    #IBM-Websphere-Transformation-Extender
    #DataExchange
    #IBMSterlingTransformationExtender


  • 2.  Re: ADDDAYS

    Posted 08/19/09 12:16 PM

    Originally posted by: phil2030


    You would probably need to write something in SQL (if you have a DB available), C or Java. Either way, you would probably need some sort of configurable resource (be it a table or flat file) to denote non-business days.
    #DataExchange
    #IBMSterlingTransformationExtender
    #IBM-Websphere-Transformation-Extender


  • 3.  Re: ADDDAYS

    Posted 08/19/09 06:05 PM

    Originally posted by: repanzer


    I don't know about holidays, but maybe if you do;

    FROMDATETIME(CURRENTDATETIME(),"DAY") will return the name of the day, i.e. Monday.

    So, you could do something like "IF( FROMDATETIME(CURRENTDATETIME(),"DAY")=MONDAY, ADDDAYS(number of weeks times 7 - number of weeks times 2).

    Number of weeks times 7 is the total days, and number of weeks times seven minus two gives you the number of saturdays and sundays.
    or MAYBE, and this is a strong maybe, and also strongly dependent on what you're trying to achieve, you can add logic like;
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "SATURDAY", then put in logic to deal with Saturday and Sunday.

    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "SATURDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "SUNDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "MONDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "TUESDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "WENDSDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "THURSDAY", then do this
    IF( FROMDATETIME(ADDDAYS(CURRENTDATETIME(), 10), {DAY}) = "FRIDAY", then do this

    Basically, you have the tools to let the system know what day of the week it is, and also what day of the week it is if you take a date and add any number of days. So something like the logic above could work for certain, specific circumstances, like if your add days lands on a Saturday, the add two more days.

    Holidays would be rough, but not impossible. The system will need to know what day is a holiday, and you can put them all in a cross reference, like;

    11/27, THANKSGIVING
    12/25, Christmas

    Then, IF(PRESENT(LOOKUP(DATE_in_CrossRefernce, where FROMDATETIME(CURRENTDATE(), "MM/DD") = FirstField in Cross reference)). If it's present, that day is a holiday.

    good luck
    #DataExchange
    #IBM-Websphere-Transformation-Extender
    #IBMSterlingTransformationExtender