Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
QlikWorld, June 24-25, 2020. Free virtual event for DI and DA gurus. Register Today
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Creator
Creator

Multiple IF Statement

Hi,

In my scenerio i want to fatch the next extract date according to my selection and values .

in below code $(vDate ) is date selection from calendar.......

issue is in my code if calendar date is today but my code will give the future next date instead of today date.

i want a mechanism that if i select today's date in $(vDate) than it should show today's date ...else future date as per below code.......

if(RowNo()=1,date(Weekstart($(vDate),1),'DD-MMM-YY'),

if(RowNo()=2,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

if(RowNo()=3,date(weekstart($(vDate),1),'DD-MMM-YY'),

if(RowNo()=4,date(weekstart($(vDate),1,1),'DD-MMM-YY'),

if(RowNo()=5,date(weekstart($(vDate),1,2),'DD-MMM-YY'),

if(RowNo()=6,date(weekstart($(vDate),1,3),'DD-MMM-YY'),

if(RowNo()=7,date(weekstart($(vDate),1,2),'DD-MMM-YY'),

if(RowNo()=8,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

if(RowNo()=9,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'))))))))))

Tags (1)
4 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Multiple IF Statement

Something like this maybe:

If(num(today())=num($(vDate)),today(),

pick(match(RowNo(),1,2,3,4,5,6,7,8,9),

date(Weekstart($(vDate),1),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

date(weekstart($(vDate),1),'DD-MMM-YY'),

date(weekstart($(vDate),1,1),'DD-MMM-YY'),

date(weekstart($(vDate),1,2),'DD-MMM-YY'),

date(weekstart($(vDate),1,3),'DD-MMM-YY'),

date(weekstart($(vDate),1,2),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY')))


talk is cheap, supply exceeds demand
Highlighted
Creator
Creator

Re: Multiple IF Statement

I have to clear my requirement.....there are column called Next Extract Date....As per Code it's showing future date ....but if for example for week 26 column i am selecting date 17th august ...it will show me the value 24th august ......but i want if i am selecting today's date it should show Next Extract date as today's date else future date .........same for all the values kindly suggest,.

if(RowNo()=1,date(Weekstart($(vDate),1),'DD-MMM-YY'),

if(RowNo()=2,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

if(RowNo()=3,date(weekstart($(vDate),1),'DD-MMM-YY'),

if(RowNo()=4,date(weekstart($(vDate),1,1),'DD-MMM-YY'),

if(RowNo()=5,date(weekstart($(vDate),1,2),'DD-MMM-YY'),

if(RowNo()=6,date(weekstart($(vDate),1,3),'DD-MMM-YY'),

if(RowNo()=7,date(weekstart($(vDate),1,2),'DD-MMM-YY'),

if(RowNo()=8,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

if(RowNo()=9,date(Weekstart($(vDate),0,-3),'DD-MMM-YY'))))))))))

Screenshot given below for req....

issue1234.png

Highlighted

Re: Multiple IF Statement

You mean that if field "Extract Day" which probably represents some data in your document equals the weekday of today() (e.g. Friday), then "Next Extract Date" should be set to the value of today()? Then how about this minor modification of Gysbert's code?

If([extract Day]=date(today(), 'WWWW'),today(),

pick(match(RowNo(),1,2,3,4,5,6,7,8,9),

date(Weekstart($(vDate),1),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

date(weekstart($(vDate),1),'DD-MMM-YY'),

date(weekstart($(vDate),1,1),'DD-MMM-YY'),

date(weekstart($(vDate),1,2),'DD-MMM-YY'),

date(weekstart($(vDate),1,3),'DD-MMM-YY'),

date(weekstart($(vDate),1,2),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY'),

date(Weekstart($(vDate),0,-3),'DD-MMM-YY')))

Peter

Highlighted
Creator
Creator

Re: Multiple IF Statement

there are some more refine output i want .....

issue234555.png

As given in the above image .......i have a calendar and $(vDate) is the value of the calendar......

Extract day is set by business ......now i want that for example :-

(1) for extract day "Monday"    I will select in Calendar "17th Aug2015" than my Next Extract date should be 17th only ......but in current scenerio it will show me the next week 24th august 2015.......

as per requirement first the day when the extract should happen ....to complete after that the next extract date should show future date.......

(2) as per scenerio our 17th august 2015 is selected ...so the my table should show next extract date 17th 2015 .....if i will select 18th august in calendar than .....next extract date should be 24th august 2015....

I think my requirement is clear for every one........