Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
maniram23
Creator II
Creator II

Alt Function

Hi Experts,

I am trying alt function in qvw application. But it is not working

Please give me one example of alt function in qvw application.

with practically .

6 Replies
Chanty4u
MVP
MVP

Hi,

alt(case1[ , case2 , case3 , ...] , else)

The alt function returns the first of the parameters that has a valid number representation. If no such match is found, the last parameter will be returned. Any number of parameters can be used.

Example:

alt( date#( dat , 'YYYY/MM/DD' ),

date#( dat , 'MM/DD/YYYY' ),

date#( dat , 'MM/DD/YY' ),

'No valid date' )

Will test if the field date contains a date according to any of the three specified date formats. If so, it will return the original string and a valid number representation of a date. If no match is found, the text 'No valid date' will be returned (without any valid number representation).

bindu_apte
Creator III
Creator III

Hi Mani,

Hope this threads will help you.

Alt (Conditional) Function

Alt function

thakkarrahul01
Creator
Creator

Also, alt function is often used for checking NULL,

alt(a,b)  AS Field

If 'a' is NULL then Field 'b' will be selected or it will go for 'a'

Hope it helps.

maniram23
Creator II
Creator II
Author

Hi Experts,

Thanks For gave Replay.

Sorry,  I need Example Based on Different Format Dates.

Chanty4u
MVP
MVP

Hi ,

Try below example

[test]:

LOAD * INLINE [

Maand, ID, Date

1, 2, 02/12/14

2, 3,03/01/15

3,4,jan/15,

4,5,2016-jan-02

];

Result:

LOAD *,

alt( date#( Date , 'YY-DD-MM' ),

date#( Date , 'YYYDDMM' ),

date#( Date , 'DD/YYY' ),

'No valid date' )  as altDate

Resident  [test];

alt.PNG