Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi i am fully confused with
can any one explain me with simple examples and
in how many ways we will use alt function?
alt( case1 [ , case2 , case3 , ...] , otherwise )
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 variable dat 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
HI,
Example:
Alt('ABC',12,13,'jkl')
Here it will return 12,
Alt() function returns first numeric value.... If you don't have any numeric value,
it will return last parameter (Means last string)
Example:
Alt('ABC', 'KL', 'NM', 'Comm')
returns Comm
Here, we don't have any numeric value, that's why return last parameter...
Hope it Helps...
One of the critical use is, when you are not sure your expression may or may not result NULL value, and you want to avoid null and consider 0 for such unavoidable cases. So we use Alt(<expression>,0). In normal cases expression results numeric value and that will be the output of alt function but due to any unavoidable reasons(like divide by zero etc) if expression results null then 0 will be the output.
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).
please check below post: