Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
satishkurra
Specialist II
Specialist II

Working day Flag in Script

Hi

I'm using the below expression in script to get the working days as 8 for weekdays and for weekends as 0.

If(Match(WeekDay(Date(Date#("DATE",'YYYYMMDD'),'M/D/YYYY'),0),'Sat','Sun'), 0,8) as WorkDayFlag,

This is working fine for me in desktop.

But if i run the same using QMC, the task fails and throws the below error.

Can someone help me with the same?

Thanks

Satish

1 Solution

Accepted Solutions
its_anandrjs
Champion III
Champion III

Try

LOAD

If(Match(WeekDay(Date(Date#("DATE",'YYYYMMDD'),'M/D/YYYY')),'Sat','Sun'),0,8) as WorkDayFlag

From Source;

Why you use 0 in statement

If(Match(WeekDay(Date(Date#("DATE",'YYYYMMDD'),'M/D/YYYY'),0),'Sat','Sun'), 0,8) as WorkDayFlag,

Regards

Anand

View solution in original post

4 Replies
MK_QSL
MVP
MVP

Try...

If(Match(WeekDay(Date#(DATE,'YYYYMMDD')),'Sat','Sun'),0,8) as WorkDayFlag

its_anandrjs
Champion III
Champion III

Try

LOAD

If(Match(WeekDay(Date(Date#("DATE",'YYYYMMDD'),'M/D/YYYY')),'Sat','Sun'),0,8) as WorkDayFlag

From Source;

Why you use 0 in statement

If(Match(WeekDay(Date(Date#("DATE",'YYYYMMDD'),'M/D/YYYY'),0),'Sat','Sun'), 0,8) as WorkDayFlag,

Regards

Anand

satishkurra
Specialist II
Specialist II
Author

Hi Manish

This is working.

How come it is not throwing any error if i perform the reload in desktop and throwing error if we execute task from QMC?

Also why the expression i mentioned is not working

Thanks

Satish

satishkurra
Specialist II
Specialist II
Author

I'm trying to force the first day as Monday. Hence used 0