# QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Contributor

## Today Date and Week Days

Good Day,

I want to do the following in a loader script.

If "Today" (16-05-2017) = Weekday (Tuesday) then populate Tuesday Weekday with 16-05-2017

If "Today" (16-05-2017) = Weekday (Tuesday) then populate Wednesday Weekday with 17-05-2017

If "Today" (16-05-2017) = Weekday (Tuesday) then populate Thursday Weekday with 18-05-2017

If "Today" (16-05-2017) = Weekday (Tuesday) then populate Friday Weekday with 19-05-2017

If "Today" (16-05-2017) = Weekday (Tuesday) then populate Monday Weekday with 22-05-2017

Will this be possible?

Thank You

1 Solution

Accepted Solutions
Contributor

## Re: Today Date and Week Days

Sibusiso,

I have used your and Andrey Khoronenko methodologies combined to make my own working script!! - Thank you all for the input!

For those who want to do a similar exercise, please find the script below:

"Data":

LOAD Customer,

[Calling Day],

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Wed', date(today()+5)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Wed', date(today()+6)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Wed', date(today())),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Wed', date(today()+1)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Wed', date(today()+2)),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Wed', date(today()+3)),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Mon', date(today())),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Mon', date(today()+1)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Mon', date(today()+2)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Mon', date(today()+3)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Mon', date(today())+4),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Mon', date(today())+5),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Tue', date(today()+6)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Tue', date(today())),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Tue', date(today()+1)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Tue', date(today()+2)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Tue', date(today())+3),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Tue', date(today())+4),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Thu', date(today()+4)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Thu', date(today()+5)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Thu', date(today()+6)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Thu', date(today())),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Thu', date(today())+1),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Thu', date(today())+2),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Fri', date(today()+3)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Fri', date(today()+4)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Fri', date(today()+5)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Fri', date(today()+6)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Fri', date(today())),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Fri', date(today())+1),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Sat', date(today()+2)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Sat', date(today()+3)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Sat', date(today()+4)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Sat', date(today()+5)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Sat', date(today())+6),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Sat', date(today())+6))))))))))))))))))))))))))))))))))))) as callDate,

//completed

date(today()) as [Today],

WeekDay(Today()) as [WDay],

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Wed', date(today()+6)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Wed', date(today()+7)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Wed', date(today()+1)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Wed', date(today()+2)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Wed', date(today()+5)),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Wed', date(today()+5)),

//Completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Mon', date(today()+1)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Mon', date(today()+2)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Mon', date(today()+3)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Mon', date(today()+4)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Mon', date(today())+7),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Mon', date(today())+7),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Tue', date(today()+7)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Tue', date(today()+1)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Tue', date(today()+2)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Tue', date(today()+3)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Tue', date(today())+6),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Tue', date(today())+6),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Thu', date(today()+5)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Thu', date(today()+6)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Thu', date(today()+7)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Thu', date(today()+1)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Thu', date(today())+4),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Thu', date(today())+4),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Fri', date(today()+4)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Fri', date(today()+5)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Fri', date(today()+6)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Fri', date(today()+7)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Fri', date(today())+3),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Fri', date(today())+3),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Sat', date(today()+3)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Sat', date(today()+4)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Sat', date(today()+5)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Sat', date(today()+6)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Sat', date(today())+9),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Sat', date(today())+9))))))))))))))))))))))))))))))))))))) as deliveryDate

Thank You!

7 Replies
Contributor

## Re: Today Date and Week Days

This is how I need the outcome:

Contributor II

## Re: Today Date and Week Days

can you explain a little about what your calculation means? Once I understand it I can give you the correct syntax

Thanks

Honored Contributor

## Re: Today Date and Week Days

Hi Jan,

May be like this

If (Num(WeekDay(Today()))= 2, Date(Today()),

If (Num(WeekDay(Today()))= 3, Date(Today()+1),

If (Num(WeekDay(Today()))= 4, Date(Today()+2),

If (Num(WeekDay(Today()))= 5, Date(Today()+3),

If (Num(WeekDay(Today()))= 6, Date(Today()+6)

)))))

Regards,

Andrey

Honored Contributor

## Re: Today Date and Week Days

This is subject to the beginning of the week on Sunday - 0, Tuesday - 2, Wednesday - 3, etc.

Highlighted
Contributor II

## Re: Today Date and Week Days

=if(WeekDay(Today())='Mon', date(today()),

if(WeekDay(Today())='Tue', date(today()),

if(WeekDay(Today())='Wed', date(today()),

if(WeekDay(Today())='Thu', date(today()),

if(WeekDay(Today())='Fri', date(today())

))))) as date

=if(WeekDay(Today())='Mon', 'Monday',

if(WeekDay(Today())='Tue', 'Tuesday',

if(WeekDay(Today())='Wed', 'Wednesday',

if(WeekDay(Today())='Thu', 'Thursday',

if(WeekDay(Today())='Fri', 'Friday'

))))) as Weekday

This will look at the day and see if it is monday then give you todays date and also give you the Day name.

You will do a nested if statement for the all the days.

## Re: Today Date and Week Days

Could be pretty simple with a calculation, weekday deduction from this calculation and a table that reduces the number of rows to five (working days).

But we need to know how you plan to list your customers. I guess it's not ok that Cust1 is at the front of your table again tomorrow???

Contributor

## Re: Today Date and Week Days

Sibusiso,

I have used your and Andrey Khoronenko methodologies combined to make my own working script!! - Thank you all for the input!

For those who want to do a similar exercise, please find the script below:

"Data":

LOAD Customer,

[Calling Day],

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Wed', date(today()+5)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Wed', date(today()+6)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Wed', date(today())),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Wed', date(today()+1)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Wed', date(today()+2)),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Wed', date(today()+3)),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Mon', date(today())),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Mon', date(today()+1)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Mon', date(today()+2)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Mon', date(today()+3)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Mon', date(today())+4),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Mon', date(today())+5),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Tue', date(today()+6)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Tue', date(today())),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Tue', date(today()+1)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Tue', date(today()+2)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Tue', date(today())+3),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Tue', date(today())+4),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Thu', date(today()+4)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Thu', date(today()+5)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Thu', date(today()+6)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Thu', date(today())),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Thu', date(today())+1),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Thu', date(today())+2),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Fri', date(today()+3)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Fri', date(today()+4)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Fri', date(today()+5)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Fri', date(today()+6)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Fri', date(today())),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Fri', date(today())+1),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Sat', date(today()+2)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Sat', date(today()+3)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Sat', date(today()+4)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Sat', date(today()+5)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Sat', date(today())+6),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Sat', date(today())+6))))))))))))))))))))))))))))))))))))) as callDate,

//completed

date(today()) as [Today],

WeekDay(Today()) as [WDay],

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Wed', date(today()+6)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Wed', date(today()+7)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Wed', date(today()+1)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Wed', date(today()+2)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Wed', date(today()+5)),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Wed', date(today()+5)),

//Completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Mon', date(today()+1)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Mon', date(today()+2)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Mon', date(today()+3)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Mon', date(today()+4)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Mon', date(today())+7),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Mon', date(today())+7),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Tue', date(today()+7)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Tue', date(today()+1)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Tue', date(today()+2)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Tue', date(today()+3)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Tue', date(today())+6),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Tue', date(today())+6),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Thu', date(today()+5)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Thu', date(today()+6)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Thu', date(today()+7)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Thu', date(today()+1)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Thu', date(today())+4),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Thu', date(today())+4),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Fri', date(today()+4)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Fri', date(today()+5)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Fri', date(today()+6)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Fri', date(today()+7)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Fri', date(today())+3),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Fri', date(today())+3),

//completed

if([Calling Day] = 'Monday' ,if(WeekDay(Today())='Sat', date(today()+3)),

if([Calling Day] = 'Tuesday' ,if(WeekDay(Today())='Sat', date(today()+4)),

if([Calling Day] = 'Wednesday' ,if(WeekDay(Today())='Sat', date(today()+5)),

if([Calling Day] = 'Thursday' ,if(WeekDay(Today())='Sat', date(today()+6)),

if([Calling Day] = 'Friday' ,if(WeekDay(Today())='Sat', date(today())+9),

if([Calling Day] = 'Saturday' ,if(WeekDay(Today())='Sat', date(today())+9))))))))))))))))))))))))))))))))))))) as deliveryDate

Thank You!