You are on page 1of 75

Appendex I.

Report Designer Summary Function

1. Report Designer Summary


Report Designer Summary is used to apply the value of converted data or calculation, as
the result data are not applied directly. Also, the summary is used for functions in which it is
required to make an input according to data conversion condition, subpage print condition,
etc... Summary statement should be made up of one sentence as data to be converted
cannot have 2 or more return values.

1.1.1. Arithmetic operator


Arithmetic operator is used for numeral value operation(plus,minus,multiply,divide). As for
priority order, operator*,/ is lower than operator+,-.

+ Plus or Positive mark

Minus or Negative mark

* Multiply

/ Divide

1.1.2. Relational operator

<=
It is true if the left operand is smaller than or equal to the right operand. If the right side is
smaller than the left side, it is false.

<
It is true when the left operand is smaller than right operand. If the right side is smaller than
left side, it is false.

>=
It is true if the left operand is larger than or equal to right operand. If the right is larger than
left side, it is false.

>

81

Appendex I. Report Designer Summary Function

It is true" if the left operand is larger than right operand. If the right side is larger or equal to
left side, it is false.

==
It is true if the both of operands are equal. If the both of operands are unequal, it is false.

!=
It is true if the both of operands are unequal. If the both of operands are equal, it is false.

1.1.3. Logical operator

AND, &&
If all the operands at both sides are true, the results will be true. If only one side is
false, the results will be false.

OR, ||
If one of the operands on both sides is true, the results will be true. If both sides are false
then the results will be false.

1.1.4. String operator

&
This connects one string to the other string. As for a function, it plays the same part as
strcat()function.

1.1.5. Operator priority order


etc.
Operators are ( ), !, +(positive number mark), -(negative number mark), *, /, %, +, -, > , >=, <,

82

Appendex I. Report Designer Summary Function

<=, ==, != , AND, &&, OR, and || , etc.


Priority in operators is as follows.
Operator
()

Priority
High

+ (Positive Sign), - (Negative Mark)


*, /, %, &
+, >, >=, <, <=, ==, !=
AND, &&, OR, ||

Low

83

Appendex I. Report Designer Summary Function

Summary Function includes an argument within brackets. The arguments vary depending on
each function and they are separated by a comma(,). As for Summary Function, like the
internal functions of a script, a function can be used for a argument of another function as it
can be used repeatedly.

84

Appendex I. Report Designer Summary Function

1.2.1. ALIGNSTR()
Syntax
ALIGNSTR(str, num, type)

Argument
str
The strings or string variable string variables which are aligned in blank.

num
The number of blanks.
type
A number showing a location in which strings are displayed in blank.

0 : align in the left


1 : align in the right
2 : align in the center

Description
A string of str will be aligned to be fit for a type within blank strings as many as num.

Example
alignstr(teststring, 15, 1)
=> The result is as shown below.

85

Appendex I. Report Designer Summary Function

1.2.2. ALLDATASUM()
Syntax
ALLDATASUM(fieldname, opt)

Argument
fieldname
A numeral variable to sum up
opt
A number to distinguish the fieldname of main data from the fieldname of subpage data
0 : main data
1 : subpage data

Description
This is a function to sum up fieldname values. It is main data value if opt is 0, and it is
subpage data value if opt is 1.
Even if it is similar to sum() function, the values of sum() functions are calculated and
accumulated whenever summary statement is executed. But, alldatasum() function is calculated
when the first summary statement is executed.

Example
alldatasum(unitprice, 0)

Reference
SUM(), SUBALLDATASUM()

86

Appendex I. Report Designer Summary Function

1.2.3. ATOI()
Syntax
ATOI(str)

Argument
str
A string or a string variable to be converted into the number

Description
Convert string of str into the number. Even the floating decimal is converted ,unlike general
C-Language.

Example
atoi(unitprice) * 0.1

Reference
VAL(), ITOA()

87

Appendex I. Report Designer Summary Function

1.2.4. AVG()
Syntax
AVG(fieldname)

Argument
fieldname
A numeral variable to get the mean value.get the mean value

Description
Get the mean valueGet the mean value of fieldnames. It is gotten by dividing the total of
fieldnames by the number of records. Normally, it is applied and used in a summary section
of a table to show a total or a subtotal.

Example
avg(salary)

Reference
AVGEX()

88

Appendex I. Report Designer Summary Function

1.2.5. AVGEX()
Syntax
AVGEX(fieldname)

Argument
fieldname
A numeral variable to get the mean value.

Description
Get the mean value in the same manner as AVG( ) function. But, a calculation is made only in case a
value is included in the field of a record. The mean value is gotten by dividing the total by the number of
records. In case no value is included, it is not included in the number of records. And, a calculation is
made only in case a value exists.

Example
avgex(salary)

89

Appendex I. Report Designer Summary Function

1.2.6. CHANGEATTR()
Syntax
CHANGEATTR(fieldname, code, value)

Argument
fieldname
Data or variable to be applied. No relation to the variables type
code
A string to show the code to change properties
value
A property string to show the execution value corresponding to the code to change
properties.

Description
This is a function used to change character property or text frame property etc. when printing
the data of corresponding field name. The value corresponding to the execution code is
applied for the character property. It is used, along with iif() function, to change the character
property in case of satisfying a condition.
In case of two or more execution codes, properties by using @ as a delimiter, connect codes each
other. Also, the same goes for the execution value. The execution codes and values are as follows.

90

Appendex I. Report Designer Summary Function

Example
changeattr(strname, "FC@FA", "255,0,0@B")
=> As a result, the value of strname is applied to an object and the font color is made into red as the
font attribute is made into bold.

Reference
CHANGEROWATTR(), CHANGETEXTATTR()

91

Appendex I. Report Designer Summary Function

1.2.7. CHANGEROWATTR()
Syntax
CHANGEROWATTR(fieldname, code, value)

Argument
fieldname
Data or variable to be applied. No relation to the variables type
code
A property string showing the code to change properties
value
A property string to show the execution value corresponding to the code to change
properties

Description
This is a function used to change character property or text frame property etc. in every row
of a table. The value corresponding to the execution code is applied for the character
property. It is used, along with iif() function, to change the character property in case of
satisfying a condition. changeattr() function is used to change the attribution of a cell, and
changerowattr() function is used to change row of a table.

As for properties, the entire row is changed. But, fieldname value is displayed only on the
cell in which a summary function is used as it is not displayed on the entire row.

In case of two or more execution codes, by using @ as a delimiter, connect codes each
other. Also, the same goes for the execution value. Refer to CHANGEATTR() function for the
execution codes and values.

Example
changerowattr(customer.custid, "FS@FA@BC", "12@B@0,0,255")
=> In the entire row, a font size is made into 12 points, a character property is made into thicker and a
background color is made into blue. And, display data of customer.custid in the cell in which this
summary function is displayed.

Reference
CHANGEATTR(), CHANGETEXTATTR()

92

Appendex I. Report Designer Summary Function

1.2.8.
1.2.8. CHANGETEXTATTR()
Syntax
CHANGETEXTATTR(fieldname, str, code, value)

Argument
fieldname
A string or a string variable to be applied
str
A string or a string variable to be searched in fieldname string.
code
A string to show the code to change properties.
value
A string to show the execution value corresponding to the code to change properties.

Description
This is a function in which str string will be searched in fieldname string and only the
properties of searched string will be changed. As for a usage, it is almost the same as
changeattr function as only the string to be searched is added to it. If (empty string) is
given to str value, the properties of entire string will be changed.
To connect with several strings and give different character property, use the function to
connect strings in use of several changetextattr() functions as it is showed in the example. In
case of two or more execution codes, properties by using @ as a delimiter, connect codes
each other. Also, the same goes for the execution value. The execution codes and values
are as follows.

93

Appendex I. Report Designer Summary Function

Example
changetextattr(CustomerID, "ATR", "FA", "B" ) &
changetextattr(OrderID, "", "FA", "R") &
changetextattr(CustomerID, "", "FA", "I" )
=> String in which a connection is made between CustomerID string as it is bold only in ATR,
OrderID string as its entirety is reversed, and CurstomerID string as its entirety is slant.

Reference
CHANGEATTR(), CHANGEROWATTR()

94

Appendex I. Report Designer Summary Function

1.2.9. CONVDATE()
Syntax
CONVDATE(arg)

Argument
arg
A number or string and string variable to be converted into DATE type.

Description
Convert the argument with a number or word type into DATE type.
To apply a format, in Report Designer, data should be fit for a type satisfying the
corresponding format. In case the data is made of a number or string, it should be expressed
in data type to be capable of applying DATE type.

Example
convdate(19990418)
convdate(1999/04/18)

Reference
ATOI(), ITOA()

95

Appendex I. Report Designer Summary Function

1.2.10. COS()
Syntax
COS(arg)

Argument
arg
A radian type number or number type variable

Description
This is a function used to get a trigonometrically cosine value

Example
cos(3.141592/2)

SIN( ), TAN( )

96

Appendex I. Report Designer Summary Function

1.2.11. COUNT()
Syntax
COUNT(fieldname)

Argument
fieldname
A variable for calculating the number of times. No relation to the variables type

Description
Argument gets the number of repeated record times. A number will increase by ones when
this function is used in repeated section of a table. If it is used in the last summary section
end of, it shows the total number of records.
If it is applied a summary section be displayed in the middle that shows a sub total etc.., the
value is reset without any other operation whenever the corresponding summary section
comes.

Example
count(order)

Reference
CURRECINDEX(), DISTINCT()

97

Appendex I. Report Designer Summary Function

1.2.12. CURRECINDEX()
Syntax
CURRECINDEX(opt)

Argument
opt
A number to distinguish main data from subpage data.
0 : main data
1 : subpage data

Description
It is used to find a location of record index for main data or subpage data.

Example
currecindex(0)
currecindex(1)

Reference
COUNT()

98

Appendex I. Report Designer Summary Function

1.2.13. DATE()
Syntax
DATE( )

Argument
Nonexistence

Description
Get the current date. This is a function to return a set date for a computer executing a report
currently.

Example
date( )

Reference
TIME()

99

Appendex I. Report Designer Summary Function

1.2.14. DELTECOLUMN()
Syntax
DELETECOLUMN(opt)

Argument
opt
A number to decide the yes or no of extending the width of a table after deleting a
column.
0 : delete the corresponding column only
1 : delete the corresponding column and widen a table as much as the deleted size.

Description
Delete the column of a table. If opt is 0, just delete the corresponding column only. And, if opt
is 1, extend a table as much as the width of a deleted column. Normally, it is used with iif()
function as it is performed according to a specific condition.

Example
iif(flag == 1, deletecolumn(0), coldata1)
=>delete only the corresponding column of a table if flag value is 1. If not, apply a value of coldata1
to the corresponding cell.

Reference
DELETEROW()

100

Appendex I. Report Designer Summary Function

1.2.15. DELETEROW()
Syntax
DELETEROW( )

Argument
Nonexistence

Description
Delete the row of a table including a cell to be applied. Normally, it is used with iif() function
as it is performed according to a specific condition.

Example
iif(flag == 1, deleterow( ), data)
=> delete the column of a table if flag value is 1. If not, apply the value of data to the corresponding
cell.

Reference
DELETECOLUMN()

101

Appendex I. Report Designer Summary Function

1.2.16. DISTINCT()
Syntax
DISTINCT(fieldname)

Argument
fieldname
A variable to calculate the number of times. No relation to the variables type

Description
Calculate the number of times for the record with a repeated argument. But, it is not included
in the number of times in case it has the same value, and take count of it only in case an
argument has a different value. As for COUNT() function, the number of times is calculated
regardless of an argument value. But, as for distinct() function, it does not be included in the
number of times in case the same value is continuous.
If it is applied a summary section be displayed in the middle that shows a sub total etc., the
value is reset without any other operation whenever the corresponding summary section
comes.

Example
distinct(dept)

Reference
COUNT()

102

Appendex I. Report Designer Summary Function

1.2.17. DIV()
Syntax
DIV(fieldname1, fieldname2)

Argument
fieldname1
A number or a numeral variable
fieldname2
A number or a numeral variable

Description
Divide fieldname1 by fieldname2. Fetch the field data value and divide it before applying its
return value. It is distinguished from an operator Operator /because of rounding down it and
applying the quotient for a return value only.

Example
div(totalprice, unitprice)

Reference
Operator /

103

Appendex I. Report Designer Summary Function

1.2.18. ENTITYTOSTR()
Syntax
ENTITYTOSTR(fieldname)

Argument
fieldname
A string or a string variable including character entity

Description
If string has character entity expressed in HTML, convert it into character.

Example
entitytostr("&#60;webmaster@m2soft.co.kr&#62;")
=> Return value as a result of executing a function: <webmaster@m2soft.co.kr>

Reference
HEXSTR()

104

Appendex I. Report Designer Summary Function

1.2.19. EXEC()
Syntax
EXEC(fieldname, code, value)

Argument
fieldname
Data or variable to be applied. No relation to the variables type
code
A property string showing the code to change properties
value
A property string to show the execution value corresponding to the code to change
properties

Description
This is a function used to change character property or text frame property etc. when printing
the data of corresponding field name. The value corresponding to the execution code is
applied for the character property. It is used, along with iif() function, to change the character
property in case of satisfying a condition.
In case of two or more execution codes, properties by using @ as a delimiter, connect
codes each other. Also, the same goes for the execution value. The execution codes and
values are as follows.

105

Appendex I. Report Designer Summary Function

Example
exec(strname, "FC@FA", "255,0,0@B")
=> As a result, properties the value of strname is applied to an object and the font color is made into
red as the font attribute is made into bold.

Reference
CHANGEATTR( ), CHANGEROWATTR()

106

Appendex I. Report Designer Summary Function

1.2.20. FINDSTR()
Syntax
FINDSTR(fieldname, str, pos)

Argument
fieldname
A string or a string variable
str
A string or a string variable to be found
pos
A number to show a start point for finding str string in fieldname string
in case it is 1, make a search from the start of a string.

Description
Find the location of a specific string in string. Return value corresponds the location of a
string which has been found. And, return 0 if a string to find does not exist.
Caution) The location of a character is related to the number of characters in Unicode
version, and it is related to the number of bites in general version.

Example
findstr("abcdefgh", "cd", 1)
return value :3
findstr("abcdefgh", "cd", 4)
return value: 0
findstr("SeoulKoreaSeoul", 1)
return value of Unicode version: 6
return value of general version: 10

Reference
SUBSTR()

107

Appendex I. Report Designer Summary Function

1.2.21. FORMAT()
Syntax
format(fieldname, str, opt)

Argument
fieldname
A variable to be changed into a specific form string(but, variable type is set in the same
manner as a form to be changed)
str
A string to show a form
opt
A number to show to the yes or no of displaying a meaningless number
0 : display meaningless number. Example) 2005-12-04
1 : do not display meaningless number. Example) 2005-12- 04

Description
This is a function to change variable value into a formatted string. Returned value is a string
converted into a formatted string. Usually you can set a desired format by using Align a
format dialog box. If you want to put one of system format string and another data into a
place at the same time, this function will be useful. After changing a format into a string, you
can connect the string with other data with inserting & operator between both.
Ineffective number of opt means that, for example, returned date format 2005-09-10
shows 2005- 9-10. In case of number format, 0 of the last number below decimal power is
removed.
In case fieldname is number format, only string formats of Align a format dialog box
are available for string format str.

Example
format(dateval, yyyy-mm-dd, 0)
If date format data, dateval is Jan. 30, 2006, the return value is 2006-1-30
format(numval, #,###.###, 1)
If number format data numval is 1234.56, the return value is 1,234.560
format(timeval, hh:mm:ss, 1)
If time format data timeval is 12 oclock in the afternoon, the return value is 12:00:00

108

Appendex I. Report Designer Summary Function

1.2.22. GETFIELD
Syntax
GETFIELD(fieldname, delimiter, pos)

Argument
fieldname
A string or a string variable including a delimiter
delimiter
A string to show a delimiter
pos
A number showing an ordinal location on the basis of a delimiter
in case of 1, bringing a head string

Description
Get a string of a specific location in the stings divided by a delimiter. In case data can be
separated by a delimiter in one data string as data contents of Excel CSV file, be able to get
data as substr() function is not used.

Example
getfield("aaa||bbb||ccc", "||", 2)
=> return value: bbb
getfield("aaa||bbb||ccc", "||", 3)
=> return value: ccc

Reference
SUBSTR()

109

Appendex I. Report Designer Summary Function

1.2.23. GETGLOBAL()
Syntax
GETGLOBAL(varname)

Argument
varname
A string to show a global variable name

Description
This is used to bring a value set for a global variable. Use setglobal() summary function to
set a global variable value.
Setglobal() and getlglobal() functions are used for other party to give another expression by
using the result to be gotten through the summary function of a specific text frame. For
example, in case several subpages exist, this is a general example that it corresponds to
using the sum total, calculated in the previous subpage, in the following subpage.

Example
getglobal("myTempValue")
=>Bringing the global variable value of myTempValue

Reference
SETGLOBAL()

110

Appendex I. Report Designer Summary Function

1.2.24. GETPARAM()
Syntax
GETPARAM(arg)

Argument
arg
A string to show variable name inputted by parameter

Description
This is a function to bring the value inputted by /rp or /rv parameter. But, as for the parameter
inputted by /rv, a use may be made of getparam() function.

Example
getparam($1)
=> By / rp option, fetch the value applicable to $1 from inputted values.
getparam(custid)
=> By /rv option, get the value corresponding to custid from input values. But, simply just use as
custid can bring comes under value to custid.

111

Appendex I. Report Designer Summary Function

1.2.25. GETVALUE()
Syntax
GETVALUE (colname, pos)

Argument
colname
A string to show a column name

Description
This is used to bring the value of a specific column of a record that is as far as pos from
current record location. In the time of reporting, it is used in case it is required to refer to the
previous or the next data other than current record data.
Caution) As for colname showing a column name, the string tied by should be inputted.

Example
getvalue(EmployeeName, -1)
=> the previous data of column name, EmployeeName
etvalue(CustomerId, 1)
=>the next data of column name, CustomerId

112

Appendex I. Report Designer Summary Function

1.2.26. GMTIME()
Syntax
GMTIME(fieldname)

Argument
fieldname
A number or a numeral variable to show UTC
A number to which 1 is added in each second as o is set for January 1, 1970.

Description
This is a function to convert UTC value by the number into date/hour type. Normally, UTC
value corresponds to the value of Date/Hour that is saved in PC etc. and this function is used
to convert it for convenience sake. And, Localtime() performs a similar function. However, as
for localtime(), it is converted into the standard time set currently as gmtime() is displayed by
GMT time.

Example
gmtime(393455871)
=> Return value: 1982-06-20 21:17:51

Reference
LOCALTIME()

113

Appendex I. Report Designer Summary Function

1.2.27. GRPCOUNT()
Syntax
GRPCOUNT(fieldname)

Argument
fieldname
A variable to calculate the number of times. No relation to the variables type

Description
Group-count the variables groups to come in the argument. Count only in case variable
value is continuously the same, and if a variable value is changed, it is initialized. But, as for
distinct() function, it does not be included in the number of times in case the same value is
continuous.
etc.
If it is applied a summary section be displayed in the middle that shows a sub total etc., the
value is reset without any other operation whenever the corresponding summary section
comes.

Example
grpcount(year)
=> In case the value of a field name, year is the same continuously, increase the number of times.
And, in case it is different, count again after the initialization.

Reference
COUNT(), DISTINCT()

114

Appendex I. Report Designer Summary Function

1.2.28. HEXSTR()
Syntax
HEXTSTR(str)

Argument
str
A string or a string variable to include hexadecimal code value
sting being made up of the number such as 0~9 and the character such as A~F

Description
After converting a hexadecimal value into a string, return the converted value.

Example
hexstr("0D0A")
=> carriage return string

Reference
ENTITYTOSTR()

115

Appendex I. Report Designer Summary Function

1.2.29. IIF()
Syntax
IIF(condition, op1, op2)

Argument
condition
A conditional expression
op1
An operational expression to be executed when a conditional expression is true
op2
An operational expression to be executed when a conditional expression is false

Description
Execute different operational expressions according to a specific condition. Execute an
operational expression, op1 when a conditional expression is true, and execute an
operational expression, op2 when a conditional expression is false. In an operational
expression, iif() function can be used recursively again.
Caution) A summary statement is executed in each record, but iif() function executes either
an operational expression, op1 or an operational expression, op2 according to a condition. If
you use a function such as sum(), count(), grpcount() and distinct() etc.., a wrong return
value mat be gotten. To prevent it, use a function such as alldatasum() and suballdatasum()
etc.. or use a function, iif() for an argument of a function such as sum().count(),grpcount()
and distinct() etc.., like the below example.

Example
iif(fieldname == code11, count(fieldname), 0)
=>In case of fieldname variable is string code11 that is summary for the count, but if fieldname
value of the last record is not code11, output of final value is 0. accordingly should be used with an
example as below.
sum(iif(fieldname ==code11, 1, 0))
=> Modify a summary to count only in case of fieldname variable is string, code11.

Reference
SUM(), COUNT(), ALLDATASUM(), SUBALLDATASUM()

116

Appendex I. Report Designer Summary Function

1.2.30. ISLASTRECORD()
Syntax
ISLASTRECORD(opt)

Argument
opt
A number to distinguish main data from subpage data.
0 : main data
1 : subpage data

Description
It is showed whether a record being processed currently may be the final record or not. If it is
the final record, return 1. If not, return 0.

Example
iif(islastrecord(0), deleterow(), strvalue)
=>If it is the final record, delete the row of a table including an applied cell. If not, apply strvalue
value to a cell.

Reference
CURRECINDEX( ), LASTRECINDEX()

117

Appendex I. Report Designer Summary Function

1.2.31. ITOA()
Syntax
ITOA(fieldname)

Argument
fieldname
A number or a numeral variable to convert to string

Description
Convert a number type into a character type. But, truncate less places than a decimal point.

Example
itoa(1234.56)
Convert number, 1234.56 into string, 1234

Reference
ATOI( )

118

Appendex I. Report Designer Summary Function

1.2.32. JULIANTODATE()
Syntax
JULIANTODATE(julian)

Argument
julian
A number or a numeral variable to show Julian value

Description
Convert Julian numeral data into date data. In case Julian value is 0, a conversion is made
into date data to express December 30, 1899. in case Julian value is 1, the number
following it, a conversion is made into date data to express December 31, 1899.
Convdate() function can convert numeral data as well, but the numeral value of convdata() is
used for the number with the same type as 19990101.

Example
juliantodate(34157)
=> Return data value, 1993-07-07

Reference
CONVDATE()

119

Appendex I. Report Designer Summary Function

1.2.33. LASTRECINDEX()
Syntax
LASTRECINDEX(opt)

Argument
opt

A number to distinguish main data from subpage data.


0 : main data
1 : subpage data

Description
Return the final index value in the result records of corresponding query. It is used to get the
number of records.

Example
iif(currecindex() == (lastrecindex()-1), deleterow(), strvalue)
=>If the location of a record being processed currently corresponds to a record just before a final
record, delete the row of a table cell. If not, apply strvalue to a cell.

Reference
CURRECINDEX(), ISLASTRECORD()

120

Appendex I. Report Designer Summary Function

1.2.34. LOADIMAGE()
Syntax
LOADIMAGE(path)

Argument
path
A string or a sting variable to show the path for an image file.
being able to set local PC path, HTTP URL path and relative path etc.

Description
This is a function displaying an image file as it is used principally when the location of an
image file is saved as a type of data. After reading an image file in a path, display it in the
object to which this summary function was applied.

Example
loadimage(employee.imagepath)
loadimage(http://www.m2soft.co.kr/testimage.jpg)

121

Appendex I. Report Designer Summary Function

1.2.35. LOCALTIME()
Syntax
LOCALTIME(fieldname)

Argument
fieldname

A number or a numeral variable to show UTC


A number to which 1 is added in each second as o is set for January 1, 1970.

Description

This is a function to convert UTC value by the number into date/hour type. Normally, UTC
value corresponds to the value of Date/Hour that is saved in PC etc. and this function is used
to convert it for convenience sake. The function Localtime() performs a similar function.
However, as for localtime(), it is converted into the standard time set currently as gmtime() is
displayed by GMT time.

Example
localtime(393455871)
=> In case of Korea/Japan(GTM+09:00), return value : 1982-06-21 06:17:51

Reference
GMTIME()

122

Appendex I. Report Designer Summary Function

1.2.36. LOG()
Syntax
LOG(num)

Argument
num
A number or a numeral variable get a natural logarithmic value
not available on 0

Description
This is used to get a natural logarithmic value as it is used for the mathematical statistics or
numerical operation rather than a general use.

Example
log(2.717)

Reference
LOG10()

123

Appendex I. Report Designer Summary Function

1.2.37. LOG10()
Syntax
LOG10(num)

Argument
num
A number or a numeral variable to get a logarithmic value whose base is 10
Not available on 0

Description
This is used to get a value of logarithmic function whose base is 10. And, it is used for the
mathematical statistics or numerical operation rather than a general use.

Example
log10(b/3.14)

Reference
LOG()

124

Appendex I. Report Designer Summary Function

1.2.38. MAX()
Syntax
MAX(fieldname)

Argument
fieldname
A numeral variable to get the maximum value

Description
Calculate the maximum value in the fieldname arguments. It is used to get the maximum
value in the repeated variable values.

Example
max(salary)

Reference
MIN(), AVG(), AVGEX()

125

Appendex I. Report Designer Summary Function

1.2.39. MIN()
Syntax
MIN(fieldname)

Argument
fieldname
A numeral variable to get the minimum value

Description

Calculate the minimum value in the fieldname arguments. It is used to get the minimum
value in the repeated variable values.

Example
min(salary)

Reference
MAX(), AVG(), AVGEX()

126

Appendex I. Report Designer Summary Function

1.2.40. MOD()
Syntax
MOD(val1, val2)

Argument
val1
A value to be divided by val2
val2
A value to divide val1

Description
Calculate the remainder resulting from dividing val1 by val2.

Example
mod(numdata/2)

Reference
DIV()

127

Appendex I. Report Designer Summary Function

1.2.41. NUMTOKOR()
Syntax
NUMTOKOR(num)

Argument
num
A number or a numeral variable to be converted into Korean string

Description
Convert a number into Korean string. As for, the number is used for an argument, do not
dispose of a decimal point or less.

Example
numtokor(1501)
=> return value :

128

Appendex I. Report Designer Summary Function

1.2.42. PAGE()
Syntax
PAGE()

Argument
Nonexistence

Description
This is a function to show a page number.
This is a function to show a page number in the time of creating a report. In case of showing
a page number in general, set and use the page object of a text frames this summary
function is nor used. This function is applied to a text frame in general. And, in case it is used
in a repeated section or a summary section of a table, a value for it may not be correct
according to the time of disposing of a summary function.

Example
PAGE()

129

Appendex I. Report Designer Summary Function

1.2.43. PERIOD()
Syntax
PERIOD(sdate, edate, opt)

Argument
sdate
A date or a date type variable to display a starting date.A string to display a date is
available.
edate
A date or a date type variable to display a finishing date. A string to display a date is
available.
opt
A number or a string about the way of string to express a result value
0 : returning return value asyyyy/mm/dd type
1 : returning return value as mm/dd type- All Years are converted to Months
2 : returning return value as dd type - Both Years and Months are all converted to Days
string : include string such as yyyy, yy, mm, dd etc.

Description
This is used to calculate the time period between two specific dates. The date type constant
and variable as well as the character string can be used for Start or End date. 19980514,
or 1998/05/14 is the available format. Option can be a numeric or a character string, which
may show the string type of PERIOD to be returned.

Example
period(1997/5/14, 1998/5/18, 0)
=> return value: 0001/00/04
period (1997/5/14, 1998/5/18, 1)
=> return value: 12/04
period (1997/5/14, 1998/5/18, 2)
=> return value: 369
period (1997/5/14, 1998/5/18, yyyy years mm months)
=> return value: 1year 0 month
period (1997/5/14, 1998/5/18, yy years old)
=> return value: 1 year old
period (1997/5/14, 1998/5/18, mm months)
=> return value: 0 month

130

Appendex I. Report Designer Summary Function

=> It is considered that the value for a year is not reflected in the calculation if mm only is applied to a
string.
period (1997/5/14, 1998/5/18, dd day)
=> return value: 4 days
=> It is considered that the values for a year and a month are not reflected in the calculation if dd only
is applied to a string.

131

Appendex I. Report Designer Summary Function

1.2.44. POW()
Syntax
POW(num, exp)

Argument
num
A number or a numeral variable to display base when exponential value is calculated
exp
A number or a numeral variable to display exponent when exponential value is
calculated

Description
This is a function to calculate an exponential value as it is used when calculating a
numerical value such as 102. A base is num as an exponent is exp. A negative value cannot
be used for exp if num is 0.

Example
pow(3,5), pow(b/3, a/4)

Reference
SQRT()

132

Appendex I. Report Designer Summary Function

1.2.45. RANK()
Syntax
RANK(fieldname)

Argument
fieldname
A numeral variable used to get a rank

Description
It is used to get a rank. The records should be aligned in order of applied fields. If records
are not aligned or require the functions such as the rank by a group and the rank in a
summary section, it is required to use rankex() function.

Example
rank(salary)

Reference
RANKEX()

133

Appendex I. Report Designer Summary Function

1.2.46. RANKEX()
Syntax
RANKEX(fieldname, reference, opt)

Argument
fieldname
A numeral variable to get a rank
reference
The variable of data, to be referred to, that will be used in case of applying a rank by a
group. In case of not applying a rank by a group, it is desirable to give (null space)
opt
A number to display main data/sub data, ascending order/descending order, usage in
summary section etc..
1 main data & ascending
2 main data & descending
3 subdata & ascending
4 subdata & descending
11 summary section & main data & ascending
12 summary section & main data & descending
13 summary section & sub data & ascending
14 summary section & sub data & descending

Description
This is used to calculate a rank. Execute function bringing the rank even if the data comes
without aligning. It is possible to decide the ranking independently by each group and to
process even a function for deciding the ranking between the summary sections the opt
argument. opt value should be between 11~14 to get a rank in the summary section.

Example
rankex(salary, dept, 1)
=> Salary is the employees pay and dept means a department name as this function display the rank
of employees pay in each department by ascending

Reference
RANK()

134

Appendex I. Report Designer Summary Function

1.2.47. REPLACESTR()
Syntax
REPLACESTR(fieldname, str1, str2)

Argument
fieldname
An original string or a string variable
str1
A string to find
str2
A string to replace a found string

Description
Find str1 string in fieldname string and replace str1 string by str2 string.

Example
replacestr(Seoul, Korea, Seoul, Busan)
=> Return value : Busan, Korea

135

Appendex I. Report Designer Summary Function

1.2.48. ROUND()
Syntax
ROUND(num, pos)

Argument
num
A number or a numeral variable to round
pos
A number showing a location to round( -9 ~ 9 )
-1 : Round off to ten place
0 : Round off to a decimal point
1 : Round off to one decimal place

Description
Round a value up or down, corresponding to num argument to specific decimal places. The
decimal places are valid from 9 to 9.

Example
In case i value is 765.267;
round(i, 0)
=> return value 765 (Round off to a decimal point)
round(i, 2)
=> return value 765.27 (Round off to two decimal places)
round(i,-1)
=> return value 770 (Round off to ten place.)

Reference
TRUNC()

136

Appendex I. Report Designer Summary Function

1.2.49. SETGLOBAL()
Syntax
SETGLOBAL(varname, value)

Argument
varname
A string to show a global variable name
value
A value to be saved

Description
This is a function to save a value into a global variable. Use getglobal() function to bring a
saved global variable value.

Setglobal() and getlglobal() functions are used for other party to give another expression by
using the result to be gotten through the summary function of a specific text frame. For
example, in case several subpages exist, this is a general example that it corresponds to
using the sum total, calculated in the previous subpage, in the following subpage.

Example
setglobal("myTempValue", "m2soft")
=> m2soft is set for a global variable value of myTempValue.

137

Appendex I. Report Designer Summary Function

1.2.50. SIN()
Syntax
SIN(arg)

Argument
arg
A number or a numeral variable of radian type

Description
This is a function used to calculate a sine value of a trigonometrically function.

Example
sin(3.141592/2)

Reference
COS( ), TAN( )

138

Appendex I. Report Designer Summary Function

1.2.51. SQRT()
Syntax
SQRT(num)

Argument
num
A number or a numeral variable to calculate a square root
num more than or equal to 0

Description
This is a function used to calculate a square root of a number. num should not be a negative
number.

Example
sqrt(2.4)
sqrt(sum(val))

Reference
POW( )

139

Appendex I. Report Designer Summary Function

1.2.52. STRCAT()
Syntax
STRCAT(str1, str2)

Argument
str1
A string or a string variable to be displayed in the front of continuous string
str2
A string or a string variable to be displayed in the end of continuous string

Description
This is a function used to join two strings into one string. Perform the same function as
operator & . If several strings are connected at once, using operator & is more
convenient than using strcat() function.

Example
strcat("abc", b)
strcat ("m2soft ", "Report Designer")
strcat ("m2soft", strcat (b, strcat (c, "Report Designer")))

Reference
operator &

140

Appendex I. Report Designer Summary Function

1.2.53. STRLEN()
Syntax
STRLEN(str)

Argument
str
A string or a string variable to get length

Description
This is a function used to calculate the length of a character string.
Caution) In Unicode version, get the length of a string by the number of characters. In
general version, get the length of a string by the number of string bites. Even the same string
can get a different length. It depends on a type of version(Unicode version or not)..

Example
strlen("ABCDEFGHIKL")
=> return value : 11
strlen("Korea")
=>return value of Unicode version : 2
=> return value of General version : 4

141

Appendex I. Report Designer Summary Function

1.2.54. STRMASK()
Syntax
STRMASK(str, mask)

Argument
str
An original string or a string variable to be changed
mask
A string to show how to convert

Description
This is a function used to convert str string into another string by covering it with a mask. It
can reduce inconvenience of usage in which of the functions such as substr() and strcat()
etc. should be combined together.
As for mask, character x is included in string as each character, x corresponds to one
character in an original string and replaces the corresponding part. The below example is
useful.

Example
strmask("123456", "xxx-xxx")
=> return value: "123-456"
strmask("123456", "xxx-xxx-x-")
=> return value: "123-456- -"
strmask("123456", "xx-xx")
=> return value: "12-34"

Reference
SUBSTR(), STRCAT()

142

Appendex I. Report Designer Summary Function

1.2.55. SUBALLDATASUM()
Syntax
SUBALLDATASUM(fieldname, reference, opt)

Argument
fieldname
A numeral variable to get the subtotal
reference
Data variable for reference to be used to get the subtotal by each group.
opt
A number to distinguish the main data from the sub data.
0 : main data
1 : subpage data

Description
This is a function used to calculate the subtotal. Calculate the total sum of fieldname values
till the reference value is changed.
Caution) It cannot be used in a report TO which Crosstab is applied.

Example
suballdatasum(unitprice, categoryid, 0)

Reference
ALLDATASUM(), SUM()

143

Appendex I. Report Designer Summary Function

1.2.56. SUBSTR()
Syntax
SUBSTR(str, pos, num)

Argument
str
An original string or a string variable from which to extract a part of string
pos
A number to show a location in an original string
the first location starting from 1
num
A number to show the length of an extracted string

Description
This function is used to get extracts a part of a string in specific position from the string.
Extract as many as the number of num from pos position of str string.
Caution) As for Unicode version, both the length and the location of characters are related to
the number of characters and, as for General version, they are related to the number of
corresponding bites. In case of one character in Korean, its length is 1 in Unicode version
but it is 2 in general version.

Example
substr("BlueSky",5,3)
=> Return value : "Sky"
substr("SeoulKorea",5,2)
=> Return value of Unicode version: ""
=> Return value of general version: ""

144

Appendex I. Report Designer Summary Function

1.2.57. SUM()
Syntax
SUM(fieldname)

Argument
fieldname
A number or a numeral variable to get the total sum

Description
This function makes summation of repeated variables. If you use this function in a repetition
section of a table, you can see the accumulated values for corresponding variables in every
repetition section. Also, if it is used in summary section in the last page, you can get the
total amount.
In case it is applied to a summary section in the middle of a page, whenever the summary
section appears, the value will be reset.
There is a difference between alldatasum() and suballdatasum(). In case of alldatasum(),
even if allowdatasun() is used in repetition section, the summation is not accumulated but
shows final amount or final sub total.

Example
sum(salary)
sum(iif(deptcode == AA01, 1, 0))
=>You can count the specific group by using it with iif() function together.

Reference
ALLDATASUM(), SUBALLDATASUM()

145

Appendex I. Report Designer Summary Function

1.2.58. SYSFORMAT()
Syntax
SYSFORMAT(fieldname, type, nooverride, opt)

Argument
fieldname
A variable for specific formats string. Set the variables type according to a required
format.
type
Showing a format to be changed
1 : Number
2 : Currency
3 : Date
4 : Time
nooverride
Showing that users can not change the format
0 : Users can change the format.
1 : Users can not change the format.
opt
Available if type is Date(3) or Time(4).
In case of type 3, Date
0 : short date format
1 : long date format
In case of type 4, Time. (It consists of 4 numbers, each number as a flag means as
below)
Unit place of one(1): No minutes or seconds
Unit place of ten(10): No seconds
Unit place of hundred(100): No time maker
Unit place of thousand(1000): 24-hour format

Description
This function changes variable to default system format string. Returned value is one
string that you select from system format string by assigning as type. Usually you can set
a format what you want by using Align format dialog box. If you want to put one of system
format string and another data into a place at the same time, this function will be useful.
After changing a format into a string, you can connect the string with other data with inserting
& operator between both.
For example, in case of number format, , is inserted every three digits and . is used as
decimal fraction point. However it depends on country or local. In this case, this function,
sysformat() is so useful.

146

Appendex I. Report Designer Summary Function

The function, format() supports other formats not system format.

Example
In case your system is set as Korea from Country & Language option dialog box of windows
sysformat(numval, 1, 1, 1)
=> If number data numval is 1234.567 then the return value is 1,234.57
sysformat(numval, 2, 1, 1)
=> If number data numval is 1234.56 then the return value is \1,235
sysformat(dateval, 3, 0, 0)
=> If datival is January 30, 2006 then the return value is 2006-01-30
sysformat(dateval, 3, 0, 1)
=> If datival is January 30, 2006 then the return value is Jan. 30, 2006. Mon.
sysformat(timeval, 4, 0)
=> If Time format, timeval is 13:13:13 then the return value is P.M 1:13:13
sysformat(timeval, 4, 1)
=> If Time format, timeval is 13:13:13 then the return value is P.M 1
sysformat(timeval, 4, 10)
=> If Time format, timeval is 13:13:13 then the return value is P.M 1:13
sysformat(timeval, 4, 101)
=> If Time format, timeval is 13:13:13 then the return value is 1

sysformat(timeval, 4, 1010)
=> If Time format, timeval is 13:13:13 then the return value is P.M 13:3

Reference
FORMAT()

147

Appendex I. Report Designer Summary Function

1.2.59. TAN()
Syntax
TAN(arg)

Argument
arg
A number or a numeral variable with radian type

Description
This is a function to get a trigonometrically tangent value

Example
tan(3.141592/2)

Reference
SIN( ), COS( )

148

Appendex I. Report Designer Summary Function

1.2.60. TIME()
Syntax
TIME()

Argument
Nonexistence

Description
Get the set time of a computer executing a report currently.
Generally, it is more convenient to use the time object of text frame property than to use this
function.

Example
time()

Reference
DATE()

149

Appendex I. Report Designer Summary Function

1.2.61. TRIM()
Syntax
TRIM(str)

Argument
str
A string or a string variable to delete both of the left blank and the right blank

Description
Delete both of the left blank and the right blank in a character string.

Example
trim(" test string ")
=> Return value: "test string"

Reference
TRIMLEFT(), TRIMRIGHT()

150

Appendex I. Report Designer Summary Function

1.2.62. TRIMLEFT()
Syntax
TRIMLEFT(str)

Argument
str
A string or a string variable to delete the left blank

Description
Delete the left blank in a character string.

Example
trimleft(" test string ")
=> Return value: "test string "

Reference
TRIM(), TRIMRIGHT()

151

Appendex I. Report Designer Summary Function

1.2.63. TRIMRIGHT()
Syntax
TRIMRIGHT(str)

Argument
str
A string or a string variable to delete the right blank

Description
Delete the right blank in a character string.

Example
trimright(" test string ")
=> Return value: " test string"

Reference
TRIM(), TRIMLEFT()

152

Appendex I. Report Designer Summary Function

1.2.64. TRUNC()
Syntax
TRUNC(num, pos)

Argument
num
A number or a numeral variable to be truncated
pos
A number to show a location of truncation( -9 ~9 )
-1 : Truncate less places than ten place
0 : Truncate less places than a decimal point
1 : Truncate less places than one decimal place

Description
Truncate the value corresponding to num argument according to the specific decimal places.
The places are valid from 9 to 9.

Example
In case i value is 765.267;
round(i, 0)
=> return value 765 (Round off to a decimal point)
round(i, 2)
=> return value 765.27 (Round off to two decimal places)
round(i,-1)
=> return value 770 (Round off to ten place.)

Reference
ROUND()

153

Appendex I. Report Designer Summary Function

1.2.65. VAL()
Syntax
VAL(arg)

Argument
arg
A string or a string variable to be converted into a number type

Description
Convert a string into a number type. It is the same as atoi() function.

Example
val(1234.56)

Reference
ATOI(), ITOA()

154

Appendex I. Report Designer Summary Function

1.2.66. XSUM()
Syntax
XSUM(fieldname1, fieldname2)

Argument
fieldname1
A number or a numeral variable to get the total sum
fieldname2
the total sum

Description
Compare a previous field value with a current field value and sum up fieldname1 values. If
either fieldname1 or fieldname2 has the same value as a previous record, the corresponding
fieldname1 value will be excepted from the total sum.

Example
xsum(salary, code)
=Add salary value only in case neither salary value nor code value is the same as a previous record
value.

Reference
SUM(), ALLDATASUM()

155

You might also like