Consultor Eletrônico



Kbase 20648: CorVu - Functions and Formulas Explained
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   10/16/2008
Status: Verified

GOAL:

CorVu - Functions and Formulas Explained

FACT(s) (Environment):

CorVu

FIX:

Function       Purpose                       Example
----------     ----------------------------  -----------------------
abs(x)         Returns the absolute value
              of x.                           abs(-1) returns 1
acos(x)        Return the angle (in radians)
              whose cosine is x.              acos(1.0) returns 0
asc(x)         Returns the character whose
              ascii value is (x).             asc(65) returns "A"
asin(x)        Returns the angle (in radians)
              whose sine is x.                asin(1.) returns 1.57
atan(x)        Returns the angle (in radians)
              whose tangent is x.             atan(1.0) returns 0.785
binary(x)      Returns the binary
              representation of the number x. binary(5) returns "101"
calendar(...)  Converts a date column to
              another date format.  
char(x)
to_char(x)     Converts the value x to a
              character value. If x is a
              real number, the value has 6
              decimal places.                char(1.2) returns "1.200000"

chcount        Returns the length or a
              character value.                                                               
column()       Returns the column ID of the
              current column. The column
              ID is used internally by the
              CorVu to identify the column.
cos(x)         Returns the cosine of the
              angle x, that is expressed in
              radians.                       cos(0) returns 1

display(...)   Displays arguments in a debug
              window.
format(...)    (Please refer to the Format
              Function section beneath this
              table for more information
              on the format(...) function.
              Returns the number as a
              character value, formatted
              according to the width, optional
              precision, and format. The
              Number Form format is as follows:
                   format(number, width[,precision[, format]]])
                   format(1234.5678, null(int), 2, 13) returns
                   ($1,234.57)

Getprompt(x)   Where x is a string (in double
              quote characters), this returns
              the value entered for the same
              prompt string in the query.

hex(x)         Returns the hexadecimal value
              of the number x.              hex(29) returns "1D"

ichar(x)       Converts the number x to a
              character with no decimal
              places.                       ichar(1.2) returns 1

left(a, x)     Returns the leftmost x
              characters from the string a. left("Value", 3) returns
                                            "Val"

like(x,y[, y ...] Returns true (1) if x
              matches any of the patterns
              represented by y. The pattern
              y can contain the wild cards
              '%', '_' and '?'. ('%' matches
              0 or more characters and '?'
              and '_' match exactly one
              character.)

ln(x)          Return the natural (base e)
              logarithm of x.               ln(10) returns 2.3

log(x)         Returns the decimal (base 10)
              logarithm of x.               log(10) returns 1

mid(a, x, y)   Returns y characters from
              the string a starting at
              position x. The first
              character in a string is at
              position 0. mid("Value", 2, 2)
              returns "lu" substring(a, x, y)
              Returns y characters from the
              string a starting at p.osition x.
              The first character in a string
              is at position 0.

newline( )     Moves output to a new line in
              the debug window used by
              display ( ).

now( )         Returns the current date and
              time.

null([type])   Returns a null value, if type
              is specified it can be one of
              int, char, real and date to
              return a null value of that type,
              otherwise it returns a "typeless"
              null.                            null(int) returns a
                                               null integer.

nulltozero(x)  Returns 0 if the value of x
              is null, or the value x if it
              is not null.                     nulltozero(null(int))
                                               returns 0

isnull(x)      Returns 1(true) if the value
              of x is null, or zero (false)
              if it is not null.               isnull(null(int))
                                               returns 1

ord(x)         Returns the ASCII value of the
              first character of x.

pc_depth       Used in parent-child groupings
              within  the Report Writer to
              return the depth within the
              parent-child structure.           pc_depth(0)

right(a,x)     Returns the rightmost x characters
              from the string a. right("Value", 3)   Returns "lue"

row()         Returns the current row number.

round(x[,y])   Returns the number x, rounded
              to y decimal places. If y is
              omitted, the number is rounded
              to the nearest integer
              (0 decimal places).             round(5.26, 1) returns 5.3

sin(x)         Returns the sine of the
              angle x (expressed in
              radians).                       sin(1.57) returns 1
sqrt(x)        Returns the square root of
              the number x.                   sqrt(9) returns 1

tan(x)         Returns the tangent of the
              angle x (expressed in radians). tan(0.785) returns 1

to_date(x[,y]) Returns the date represented
              by the input x. If y is given,
              it is a date format string that
              specifies the format of the
              input x.

to_integer(x)  Returns the input value
              converted to the integer

to_number(x)   Returns the input value
              converted to a real number.

today( )       Returns the current date
              without the time. (Time is
              00:00:00)

trunc(x[,y])   Returns the number x, truncated
              to y decimal places. If y is
              omitted, x is truncated to 0
              decimal places, note that this
              differs from the round
              function in that decimal places
              are simply dropped-no rounding
              takes place.                      trunc(5.26) returns 5.2

xsum(x)        Calculates the crosstab sum
              of column x.                      xsum([Cost of Sales])

The format function:

    The Format Function has two forms; number form and Date form.

    The Number Form:

         The number form of the CorVy format function returns the
         number as a character value, formatted according to the
         width, optional precision, and format. The format for the
         function is as follows:

              format(number, width[, precision[, format]]))
          
         For example, the function format(1234.5678, null(int),
         2,. 13) returns ($1,234.57)

         The parameters for the number form are as follows:

              Number          A number to be formatted.
              Width           Specifies a number of characters to
                              format for. (Generally use null(int)
                              for this.)
              Precision       Number of decimal places.
              Format          A format between 0 and 15 inclusive.

         The format numbers are as follows:

              0 No formatting
              1 Currency
              2 Percentage
              3 Scientific Notation
              4 Thousands Separators
              5 Currency with thousands separators
              6 Percentage with thousands separators
              7 Scientific Notation
              8 Accounting Format Negative Numbers (AFNN)
              9 Currency with AFNN
             10 Percentage with AFNN
             11 Scientific notation with AFNN
             12 Thousands separators with AFNN
             13 Currency, thousands seps and AFNN
             14 Percentage, thousands seps and AFNN
             15 Scientific Notation with AFNN

    Date Form:

         The date form of the format function formats the date value
         as a character using the format string. The function format
         is as follows:

              format(date, fmt)

         The parameters of the date form are:

              Date           A date value.
              Fmt A          (string) format specifier.

         The format string can include the following:

              MM 2 digit month
              MONTH Month name, upper case
              Month Month name, mixed case
              month Month name, lower case
              MON Month abbreviation, upper case
              Mon Month abbreviation, mixed case
              mon Month abbreviation, lower case
              M 1 or 2 digit month
              WEEKDAY Day of week, upper case
              Weekday Day of week, mixed case
              weekday Day of week, lower case
              WEEK DOW Abbreviation, upper case
              Week DOW Abbreviation, mixed case
              week DOW Abbreviation, lower case
              W DOW Number (0=Sunday)
              DD 2 digit day of month
              D 1 or 2 digit day of month
              YYYY 4 digit year
              YY 2 digit year
              Y 1 or 2 digit year
              HH24 2 digit Hour 00-23
              H24 1 or 2 digit hour 0-23
              HH 2 digit hour 01-12
              H 1 or 2 digit hour
              1-    12mm 2 digit minute
              2-    m 1 or 2 digit minute
              ss 2 digit second
              s one or 2 digit second
              P 'P' for PM, 'A' for AM
              p 'p' for PM, 'a' for AM
              J The Julian date
              ddd0 Day of year, 3 digits (0=1 Jan)
              ddd Day of year, 3 digits (1=1 Jan)
              d0 Day of year, 1-3 digits (0=1 Jan)
              d Day of year, 1-3 digits (1=1 Jan)

    Julian Dates

         The Julian format (J) can be followed by additional format
         information as follows:

              J[[:]x].[y]

                   - x is the minimum size. If the colon is included,
                     pad with spaces, otherwise pad with zeroes.

                   - y is the number of days that day 0 is after
                     Julian day 0.

         Operators:

              +             Addition
              -             Subtraction
              *           .  Multiplication
              /             Division
              ~             Bitwise Not
              &             Bitwise And
              |             Bitwise Or
              !             Boolean Not
              &&            Boolean Or
              | |           Boolean Or
              > =           Greater than or equal to
              >             Greater than
              < =           Less than or equal to
              <             Less than
              = =           Equal to
              < >           Not equal to
              ;             Statement separator
              ??::          Switch operator
              ?:            Conditional operator
              ?*            "While" looping operator
              ?+            "Until" looping operator
              %             Modulo operator
              ^             "Raise to the power of" operator
              !=            "Not equal to" operator


Reference to Written Documentation:
Progress Solution 20604, "CorVu ABA Server Login".
Progress Solution 20643, "CorVu. ABA Server Installation Explained".
Progress Solution 20645, "CorVu: Installing the ABA Server on Windows NT Explained".
Progress Solution 20646, "Changing the CorVu.ini File Explained".
Progress Solution 20647, "CorVu File Types Explained".
Progress Solution 20649, "CorVu: The ABA Server Explained"..