Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

can anyone tell me the use of alt() in Qlikview

can anyone explain use of alt() function with example

3 Replies
prajapatiamar38
Creator II
Creator II

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).

d_koti24
Creator II
Creator II

Not applicable
Author

Hi,

If you have mixed date format in one field or you have data from different sources using

different formats, you can use the Alt() function to define several possible date formats:

Alt( Timestamp#(MixDate,'M/D/YYYY h:mm tt'),

Date#(MixDate,'M/D/YYYY'),

Date#(MixDate,'D/M/YYYY'),

Date#(MixDate,'YYYYMMDD'),

Date#(MixDate,'DD.MM.YYYY'),

Date#(MixDate'YYYY-MM-DD')

) as MixDate

The order of the interpretation functions also defines the priority when several formats are

possible for one specific field value, e.g. 8/4/2012, which in the United States means 4th of

August, but in the United Kingdom means 8th of April.