UNI

Summary


uni is used to verify if there are duplicated values in a series of variable or numeric expressions, alphanumeric expressions or dates.

Syntax

   uni( list_exprg )

Parameters

Element

Description

Remarks

list_exprg

List of generalised expressions separated by the character ','.

The expressions must be of the same type.

Examples

   # Are there duplicated values ? This programme displays 3
    Infbox num$( uni(24, 15, 24, 1, 2, 3, 4, 5))

   # Entry of a scrolling grid in which the first column must
   # not contain duplicated values; the variable at the base of the
   # grid is VARBAS
   I = uni([M]COLUMN1(0..[M]VARBAS-1))     :# Duplicated value?
        If I <> 0
           Errbox "Duplicated value !"
Endif

Description and comments

uni is used to verify if there are or not duplicate values in a series of numeric, alphanumeric or dates variables. uni returns the rank of the first value equal to a previous value from the list, that is to say :

- if the first and the second are identical, uni returns 2

- if the first and the third (or the second and the third) are identical, uni returns 3.

...

- if no value is duplicated, uni returns 0.

For a numeric "uni" is it acceptable to mix the label, decimal, integer, floating and double precision variables.

If one of the arguments for the function is a dimensioned variable without specifying an index or index interval, all the elements of the variable are used. The specifying of an index or index interval determines the elements to be taken into account.

If an index interval is given so that there is no element , for example uni(VALUES(1..0)), the result returned is 0.

Note :

Irrespective of the arguments, uni returns an integer. It should be noted that the uni function never returns 1.

Associated errors

Error

Description

ERMODE (10)

The given indexes are not numeric.

ERINDI ( 8)

Error in the index ranges.

ERDOM (50)

The arguments are not of the same type.

ERDIM (55)

Too many dimensions given.

Associated keywords

FIND - MAX - MIN - SUM - PRD - AVG - VAR


SUMMARY


Copyright © Sage 1999 - 2007