7 Replies Latest reply: Mar 23, 2012 4:01 AM by k_l_a RSS

wrong week() format

k_l_a

Hi,
also If I use
date#(week( posting, 'DD/MM/YYYY')) as posting

the result is this:

 

posting

weekly

03/01/2010

 

 

53

02/01/2010

 

 

53

01/01/2010

 

 

53

01/01/2012

 

 

52

02/01/2011

 

 

52

01/01/2011

 

 

52

 

 

 

the week are wrong.. some help?
Many thanks.
Regards.

  • Re: wrong week() format
    Sivaraj Seeman

    Hi,

     

    Check the date format which you are using

    and try with some other dates bcoz 1st week of the year may fall in pevious year week

     

    Sivaraj S

  • Re: wrong week() format
    Sem Art

    Right. Number of some <7 first days are in last week. Try to use expression like:

     

    IF ( DayNumberOfYear(posting) < 7 and week(posting) > 2,

         1,

         date#(week( posting, 'DD/MM/YYYY'))

    )

     

    if ( MyEnglish == Bad ) {

         Sorry;

    }

    • Re: wrong week() format
      k_l_a

      To force in this way is a solution???

      But, dos this problem is a a QV  bug?

      For the future week() statement I will put always the forced value?

      • Re: wrong week() format
        Sem Art

        Sivaraj Seeman:

        Why u use WeekStart(Posting) ?

        Dnt see a reson for it.

         

        k_l_a:

        To force in this way is a solution???

        But, dos this problem is a a QV  bug?

        For the future week() statement I will put always the forced value?

         

        Its a solution for your request. U will force only week number of first 7 days, when they are in last week of previous year, if you dnt like normal state. When 1st junary at last week of previous year its normal state. dnt confuse with it. ))

         

        IF ( DayNumberOfYear(posting) < 7 and week(posting) > 2,

             1,

             date#(week( posting, 'DD/MM/YYYY'))

        )

        • Re: wrong week() format
          k_l_a

          Correct:

           

          IF (

                  (DayNumberOfYear(posting)) < 7

                   and week(posting) > 2

                  , 1 ,    

                   week(date#( posting, 'DD/MM/YYYY')))  as weekly ,

    • Re: wrong week() format
      k_l_a

      I have to put the script in  script editor of QV.. are sure it works?

      Many rhanks.

      K.