2 Replies Latest reply: Nov 1, 2013 1:13 PM by Niranjan k

# Condition Fuctions

Hi All,

Today i got one interview call in that he is asking me

What are the Condition functions in Script side?

Could some one help me

Thanks in Avance

Niranjan

• ###### Re: Condition Fuctions

Conditional Functions

if(condition , then , else)

The three parameters condition, then and else are all expressions. The first one, condition, is interpreted logically.

The two other ones, then and else, can be of any type. They should preferably be of the same type. If

condition is true, the function returns the value of the expression then. If condition is false, the function

returns the value of the expression else.

Example:

if( Amount>= 0, 'OK', 'Alarm' )

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

pick(n, expr1[ , expr2,...exprN])

Returns the n:th expression in the list. n is an integer between 1 and N.

Example:

pick( N'A''B'4, , , )

returns 'B' if N = 2

returns 4 if N = 3

match( str, expr1 [ , expr2,...exprN ] )

The match function performs a case sensitive comparison.

Example:

match( M, 'Jan','Feb','Mar')

returns 2 if M = Feb

returns 0 if M = Apr or jan

mixmatch( str, expr1 [ , expr2,...exprN ] )

The mixmatch function performs a case insensitive comparison.

Example:

mixmatch( M, 'Jan','Feb','Mar')

returns 1 if M = jan

wildmatch( str, expr1 [ , expr2,...exprN ] )

The wildmatch function performs a case insensitive comparison and permits the use of wildcard characters (

* and ?) in the comparison strings.

Example:

wildmatch( M, 'ja*','fe?','mar')

returns 1 if M = January

returns 2 if M = fex

class(expression, interval [ , label [ , offset ]])

Creates a classification of expressions. The bin width is determined by the number set as interval. The result

is shown as a<=x<b, where a and b are the upper and lower limits of the bin. The x can be replaced by an

arbitrary string stated in label. 0 is normally the default starting point of the classification. This can be

Examples:

class( var,10 ) with var = 23 returns '20<=x<30'

class( var,5,'value' ) with var = 23 returns '20<= value <25'

class( var,10,'x',5 ) with var = 23 returns '15<=x<25'

Back to Other Functions.

• ###### Re: Condition Fuctions

Hi Clever,

Thanks for giving valuable information