Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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 .
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).
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.
Hi Experts,
Thanks For gave Replay.
Sorry, I need Example Based on Different Format Dates.
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];