Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Surely this is a simple fix...

...I just can't seem to figure it out!

I have two fields, BeautyParadeDate and SiteVisitDate.

I'd like to do the following;

If both fields are blank then state "Tender", else, state BeautyParade or SiteVisit dependant on which date is greater.

For some reason I cannot get this to work

Can anyone help please?

1 Solution

Accepted Solutions
Not applicable
Author

Nothing seemed to work with this so I had to build a separate indicator field for each status and work it out from there. Thanks anyway people

View solution in original post

8 Replies
marcarreras
Specialist
Specialist

Samuel,

Is this an script issue or are you stacked building an expression? Please post sample as well.

Marc.

Not applicable
Author

I'm trying to achieve it within the script, I've literally got one line of data at the moment with two fields!

Beauty Parade Date Site Visit Date
03/02/2015

If they are both blank then "Tender" else state the one with the max date. The result of the above should say "Site Visit"

sunny_talwar

Maybe this:

Alt(If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate), 'Tender') as SiteVisit

or

If(IsNull(BeautyParadeDate) and IsNull(SiteVisitDate), 'Tender', If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate)) as SiteVisit

HTH

Best,

S

sunny_talwar

Tested the following code with some dummy data and it seems to work just as you wanted:

Table:

LOAD * INLINE [

    BeautyParadeDate, SiteVisitDate

    01/01/2015, 12/31/2014

    ,

    03/15/2013, 06/15/2013

];

Table2:

LOAD *,

  Alt(If(BeautyParadeDate > SiteVisitDate, BeautyParadeDate, SiteVisitDate), 'Tender') as SiteVisit

Resident Table;

Best,

S

Not applicable
Author

Must be something odd going on then as I tried these solutions before and all I get is Tender, for some reason the dates are being ignored

sunny_talwar

May be the dates you are using are picked up by QlikView as text instead of date. You might want to use Date# function if that is the case.

Best,

S

manojkulkarni
Partner
Partner

As suggested by sunindia, it is working. Please could you add sample code here which you are using .

Not applicable
Author

Nothing seemed to work with this so I had to build a separate indicator field for each status and work it out from there. Thanks anyway people