PowerBuilder Curriculum Part 3
V. System functions
1. Array
(1), lowerbound
Function:
Get the Lower bound Of the nth dimension Of the specified array
Syntax:
LowerBound ( array {, n } )
Parameters:
array: array Name
n : Numeric Type, optional, specifies the Lower bound Of which dimension Of the array To Get, the Default Value Is 1
Return Value:
Return Value: Long
Successful Return: the Lower bound Of the nth dimension Of the array array
Return On failure: -1
Return Null On failure: Null
(2), upperbound
Function:
Get the Upper bound Of the nth dimension Of the specified array
Syntax:
UpperBound( array {, n } )
parameter:
array: array Name
n : Numeric Type, optional, specifies the Upper bound Of which dimension Of the array To Get, the Default Value Is 1
Return Value:
Return Value: Long
Successful Return: the Upper bound Of the nth dimension Of the array array
Return On failure: -1
Return Null On failure: Null
2. BLOB
(1), Blob
Function:
Convert String To Blob Type Data
Syntax:
Blob ( Text )
parameter:
Text: String Type, specify the Data To be converted
Return Value:
Return Value: Blob
Successful Return: converted Blob Type Data
Return Null On failure: NULL
(2), BlobEdit
Function:
Insert any type of data Into the specified position of the Blob type variable
Syntax:
BlobEdit ( blobvariable, n, data )
parameter:
blobvariable: The initialized variable of type Blob will Insert data Into this variable
n: Specifies the insertion position, valid Values are Between 1 And 4,294,967,295
data: The data to be inserted Into the Blob type variable, its data type can be any valid PowerBuilder data type
return value:
Return value: Unsigned long
When the function is successfully executed, it returns the position Where data can be inserted next time
The BlobEdit() function returns Null if there is insufficient space In the blobvariable variable Or if the value of any parameter is Null
(3), BlobMid
Function:
Extract a piece Of Data From the Blob variable. After extraction, the content Of the original Blob variable remains unchanged
Syntax:
BlobMid ( Data, n {, Length } )
parameter:
Data: Data Of Blob Type
n : Specifies the starting Position Of the Data To be extracted, valid Values are Between 1 And 4,294,967,295
Length : Optional, specify the Length Of the Data To be extracted, In bytes, And the valid Value Is Between 1 And 4,294,967,295.
By Default, Extract All Data From the specified Position n To the End
Return Value:
Return Value: Blob
When the Function executes successfully, it returns the specified Number Of bytes Of Data. If the Value Of n Is greater than the Number Of bytes Of Data, the Function returns empty.
If the sum Of n And Length exceeds the Number Of bytes Of Data Data, Then the BlobMid() Function returns the remaining Data, And the Data Length will be less than the parameter
the Value Of Length
If the Value Of Any parameter Is Null, the BlobMid() Function returns Null
(4), Len
Function:
Get the Data Length Of the Blob Type variable In bytes
Syntax:
Len ( Blob )
parameter:
Blob: Blob Type variable
Return Value:
Return Value: Long
Returns the Length Of the Blob variable when the Function executes successfully, And Returns -1 when an Error occurs
If the Value Of Any parameter Is Null, the Len() Function Returns Null
usage:
If a variable Length Is specified when describing a variable Of the Blob Type, Then For the variable, the Len() Function gets the specified Length
If the variable Length Is Not specified In the variable description, Then PowerBuilder adjusts the Length when assigning a Value, And the Length Of the unassigned Blob Type variable Is 0
(5), String
Function:
Convert the Value Of a Blob Type variable To a String Type.
If the Value Of the Blob Type variable Is Not Text Data, the String() Function interprets its Value as a Character
Syntax:
String ( Blob )
parameter:
Blob: the Blob Type variable whose Value Is To be typecast
Return Value:
Return Value: String
the converted Data Is returned when the Function executes successfully, And an empty String ("") Is returned when it fails
If the Data contained In the Blob variable Is Not String Type Data, Then the String() Function interprets the Data as characters as much as possible And returns the Character
String Type Data
If the Value Of the Blob parameter Is Null, the String() Function returns Null
3. Data type checking and conversion
(1), Asc
Function:
Get the ASCII Integer Value Of the First Character Of the String
Syntax:
Asc ( String )
parameter:
String: the String To Get the ASCII Value Of the First Character
Return Value:
Return Value: Integer
When the Function executes successfully, it returns the ASCII Value Of the First Character Of the String parameter
If the Value Of the String parameter Is Null, the Asc() Function returns Null
(2), Char
Function:
Converts the First Character Of a String, the First Value Of a Blob variable, Or an Integer To a Character
Syntax:
Char ( n )
parameter:
n: String, Blob variable Or Integer, Or Any Type variable containing the above types Of Data
Return Value:
Return Value: Char
Returns the First Character Of parameter n
If the Value Of the n parameter Is Null, the Char() Function Returns Null
(3), Dec.
Function:
Converts a String Or Blob Value To a Value Of Type Decimal
Syntax:
Dec (stringorblob)
parameter:
stringorblob: String Type variable Or Blob Type variable. For a Blob Type variable, convert the First Value Of the variable To a Decimal Type Value, And the rest are ignored. the stringorblob parameter can also be an Any Type variable containing the above types Of Data
Return Value:
Return Value: Decimal
When the Function executes successfully, it returns the corresponding Decimal Type Value
the Dec() Function returns 0 If the Value In the stringorblob parameter Is Not a valid PowerScript Number Or has an incompatible Data Type
If the Value Of the stringorblob parameter Is Null, the Dec() Function returns Null
(4), Double
Function:
Converts a String Or Blob Value To a Double Value
Syntax:
Double(stringorblob)
parameter:
stringorblob: String Type variable Or Blob Type variable. For a Blob Type variable, convert the First Value Of the variable To a Double Type Value, And the rest are ignored. the stringorblob parameter can also be an Any Type variable containing the above types Of Data
Return Value:
Return Value: Double
When the Function executes successfully, it returns the corresponding Double Type Value
the Double() Function returns 0 If the Value In the stringorblob parameter Is Not a valid PowerScript Number Or has an incompatible Data Type
If the Value Of the stringorblob parameter Is Null, the Double() Function returns Null
(5), Integer
Function:
Converts a String Or Blob Value To an Integer Value
Syntax:
Integer ( stringorblob )
parameter:
stringorblob: String Type variable Or Blob Type variable. For a Blob Type variable, the First Value Of the variable Is converted To an Integer Type Value, And the rest Is ignored. the stringorblob parameter can also be an Any Type variable containing the above types Of Data
Return Value:
Return Value: Integer
When the Function executes successfully, it returns the corresponding Integer Type Value
the Integer() Function returns 0 If the Value In the stringorblob parameter Is Not a valid PowerScript Number Or If the Data Type Is incompatible
If the Value Of the stringorblob parameter Is Null, the Integer() Function returns Null
(6), Long
Function:
Convert Other types Of Data To Values Of Type Long
Syntax:
Syntax 1. Combining two unsigned integers Into a Long Integer Value Long ( lowword, highword )
Syntax 2. Convert a String Or Blob Value To a Long Type Value Long ( stringorblob )
parameter:
Syntax 1
lowword: UnsignedInteger Type, specifying the low Value In the Long Integer
highword : UnsignedInteger Type, specifying the high Value In the Long Integer
Syntax 2
stringorblob: String Type variable Or Blob Type variable When Blob Type variable, the First Value Of the variable Is converted To a Value Of Long Type, And the rest Is ignored. the stringorblob parameter can also be an Any Type variable containing the above types Of Data
Return Value
Syntax 1
Return valueLong
When the Function executes successfully, it returns the Long Integer Value combined By the low bit Value And the high bit Value
returns -1 On Error
If the Value Of Any parameter Is Null, the Long() Function returns Null
Syntax 2
Return valueLong
When the Function executes successfully, it returns the corresponding Long Type Value
If the Value In the stringorblob parameter Is Not a valid PowerScript Number Or the Data Type Is incompatible, the Long() Function returns 0 If the Value Of the stringorblob parameter Is Null, the Long() Function returns Null
(7), Real
Function:
Converts a String Or Blob Value To a Value Of Type Real
Syntax:
Real (stringorblob)
parameter:
stringorblob: String Type variable Or Blob Type variable, when the parameter Is a Blob Type variable, convert the First Value Of the variable To a Real Type Value, And ignore the rest
the stringorblob parameter can also be an Any Type variable containing the above types Of Data
Return Value:
Return valueReal
when the Function executes successfully, it returns the corresponding Real Type Value
If the Value In the stringorblob parameter Is Not a valid PowerScript Number Or the Data Type Is incompatible, Then the Real() Function returns 0 If stringorblob
(8), Date
Function:
Convert Other types Of Data To Date Type Data
Syntax:
Syntax 1. Convert the DateTime Type Or the Blob Value whose First Value Is DateTime Or Date To a Date Type Value;
Date ( DateTime )
Syntax 2. Convert a String whose Value Is a valid Date Into a Date Type Value;
Date ( String )
Syntax 3. Combine three integers Into a Date.
Date (Year, Month, Day)
parameter:
Syntax 1
DateTime: a Value Of Type DateTime Or a Value Of Type Blob whose First Value Is DateTime Or Date
When the parameter Is a Blob Type variable, Convert the First Value Of the variable To a Date Type Value, And ignore the rest. the DateTime parameter can also be an Any Type variable containing the above types Of Data
Syntax 2
String: String Type, its Value includes a valid Date expressed In String form (such as January 1, 1998 Or 12-31-99)
the String parameter can also be an Any Type variable containing String Type Data
Syntax 3
Year: Integer Type, the Year In the specified Date, represented By four digits, From 0 To 9999
Month: Integer Type, the Month In the specified Date, represented By one Or two digits, From 1 To 12
Day: Integer Type, specify the Number In the Date, represented By one Or two digits, From 1 To 31
Return Value:
Syntax 1
Return Value: Date
When the Function Is successfully executed, the corresponding Date Type Value Is returned
If the Value In the DateTime parameter Is Not a valid PowerScript Date Or the Data Type Is incompatible, the Date() Function returns 1900-01-01
If the Value Of the DateTime parameter Is Null, the Date() Function returns Null
Syntax 2
Return Value: Date
When the Function executes successfully, it returns the corresponding Date Type Value.
If the Value In the String parameter Is Not a valid PowerScript Date Or the Data Type Is incompatible, the Date() Function returns 1900-01-01
If the Value Of the String parameter Is Null, the Date() Function returns Null
Syntax 3
Return Value: Date
When the Function executes successfully, it returns the Date determined By the three parameters Of Year, Month And Day
If an invalid Value Is used For Any Of these three parameters (For example, the Month Is specified as 14), the Date() Function returns 1900-01-01 If Any parameter has a Value Of
(9), DateTime
Function:
Convert Other types Of Data To DateTime Type Data.
Syntax:
Syntax 1. Combining Date And Time Values Into DateTime Type Values
DateTime ( Date {, Time } )
Syntax 2. Convert a Value Of Type Blob To a Value Of Type DateTime
DateTime ( Blob )
parameter:
Syntax 1
Date: Date Value Of Date Type
Time: optional parameter, Time Value Of Time Type
When This parameter Is omitted, PowerBuilder sets the Time To midnight (00:00:00.000000)
When specifying This parameter, you can only specify the Hour Value
Syntax 2
Blob: Blob Type variable, Convert the First Value Of the variable To a DateTime Type Value, And ignore the rest. the Blob parameter can also be an Any Type variable containing Blob Type Data
Return Value:
Syntax 1
Return Value: DateTime
When the Function executes successfully, it returns the Value Of DateTime Type, which Is a combination Of Date And Time. If the Value Of Any parameter Is Null, the DateTime() Function returns Null
Syntax 2
Return Value: DateTime
When the Function executes successfully, it returns the corresponding DateTime Type Value
If the Value Of the Blob parameter Is Null, the DateTime() Function returns Null
(10), IsDate
Function:
Checks If the specified String contains a valid Date
Syntax:
IsDate(datevalue)
parameter:
datevalue: String Type, specify the String To be detected
Return Value:
Return Value: Boolean
If the datevalue contains a valid Date, the IsDate() Function returns True, otherwise it returns False If the Value Of the datevalue parameter Is Null, the IsDate() Function returns Null
(11), IsNull
Function:
Tests whether the Value Of a variable Or expression Is Null
Syntax:
IsNull ( Any )
parameter:
Any: the variable Or expression To test
Return Value:
Return Value: Boolean
If the Value Of Any Is Null, the Function returns True, otherwise the Function returns False
(12), IsNumber
Function:
Tests whether a String Is a valid numeric Value
Syntax:
IsNumber ( String )
parameter:
String: String Type, the String To be tested
Return Value:
Return Value: Boolean
If the Value Of String Is a valid PowerScript Number, the Function returns True, otherwise the Function returns False If
(13), IsTime
Function:
Tests If the Value Of a String Is a valid Time
Syntax:
IsTime ( timevalue )
parameter:
timevalue: String Type, the String To be tested
Return Value:
Return Value: Boolean
If the Value Of timevalue Is a valid Time, the Function returns True, otherwise the Function returns False If the Value Of timevalue parameter Is Null, the IsTime() Function returns Null
(14), String
Function:
Convert Data Into a String according To the specified Format
Syntax:
String() can Convert Data Of Date, DateTime, numeric Type, Time, String Type Into a String Of specified Format String(Data,{Format})
parameter:
Data: Specify the Data To be converted, And its Data Type can be Date, DateTime, numeric Type, Time, String, Or Any Type variable containing the above types Of Data
Format: optional, String Type, its Value specifies the Data Format
If the Type Of the Data parameter Is String, the Format parameter must be specified
Return Value:
Return Value: String
When the Function executes successfully, it returns the specified Data expressed as a String
If the Data Type Of the Data parameter does Not Match the Format specified By the Format parameter, the Format specified By the Format parameter Is invalid, Or the Data parameter Is Not a suitable Data Type mentioned above, the String() Function returns an empty String ("")
usage:
Format Is a String represented By a Mask. For the Case Where the Data parameter Is a numeric Type, the Format Is: positive Number Format;
negative Number Format;
zero display Format
In the empty display Format, except the First part must be provided, Other parts can be omitted
Two Mask characters are used In the numeric display Format: # And 0, Where # represents Any Number Between 0 And 9, And 0 represents that each zero must be displayed. In addition, the currency symbol ($ Or ¥), percent characters such as Sign (%), Decimal point (.), And comma (,) can also appear In the Format String, but except that the Decimal point (.) And comma (,) can appear Between the Format characters # And 0, Other characters can only be placed before Or after the Format String
For example, ###,###$### Is a wrong Format String, ¥###,###,### Is a correct Format String
When the Format parameter Is omitted, the String() Function uses the PowerBuilder Default Format
Note that If the display Format has multiple parts, the semicolon (;
) Between each part cannot be omitted
Other characters can also appear In the display Format String (only at the beginning And End Of the Format String), but they have no special meaning, the System just displays them as they are
For example, When the Value 12 Is formatted With the display Format String "income##", the displayed result Is "income 12"
For the Case Where the Data parameter Is a String (String) Type, the Syntax Format Of the Format parameter Is: normal String Format
When the Value Is empty, the Format Is In the "normal string format", @ represents Any Character In the String, And Any Other characters are displayed as they are
For example, If the following Format Is defined: (@@)@@@@-@@@@, the String 0166767593 Is displayed as: (01) 6676-7593 For the Case Where the Data parameter Is a Date (Date) Type, Format the Syntax Format Of the parameter Is: normal Date Format
Format When the Date Is a Null Value the Format characters In the Date Format have the following meanings:
the Number Of days without 0 at the beginning Of d (such as 8)
Day Number With 0 at the beginning Of dd (such as 08)
English abbreviation Of ddd week (such as Mon, Tue)
dddd full English Name Of the week (such as Monday, Tuesday)
Month without 0 at the beginning Of m (such as 8)
Months With 0 at the beginning Of mm (such as 08)
English abbreviation Of mmm Month (such as Jan, Feb)
mmmm English full Name Of the Month (such as January, February)
yy Two-digit Year (such as 97)
yyyy four-digit Year (such as 1997)
In addition, the following keywords can also be used as the display Format Of the Date:
[General] Short Date Format defined In Windows System
[LongDate] the Long Date Format defined In the Windows System
[ShortDate] the Short Date Format defined In the Windows System
For the Case Where the Data parameter Is Of Type Time (Time), the Syntax Format Is: normal Time Format;
Format When the Time Is Null the Format characters In the Time Format have the following meanings:
Hours without 0 at the beginning Of h (such as 6)
Hours With 0 at the beginning Of hh (such as 06)
Minutes without 0 at the beginning Of m (such as 6)
Minutes With 0 at the beginning Of mm (such as 06)
s For seconds without a leading zero (e.g. 6)
ss seconds With 0 at the beginning (such as 06)
Microseconds without 0 at the beginning Of f, you can Specify 1~6 fs, each f represents a part Of Microseconds
AM/PM Use AM/PM To display the morning And afternoon Time
12-Hour Format AM/PM display the Time Of morning And afternoon With AM/PM
12-Hour Format a/P Use a/P To display morning And afternoon Time
12-Hour Format a/P Use a/P To display morning And afternoon Time
12-Hour System In addition, the keyword [Time] can also be used In the display Format, which means that the Time Is displayed In the Format defined By the current Windows System
For the Case Where the Data parameter Is DateTime (DateTime), the Syntax Format Is:
normal Date Time Format;
the Format When the Date Time Is Null the Mask used By the Date Time Type Is the combination Of the Date Mask And the Time Mask
(15), Time
Function:
Convert Other types Of Data To Values Of Type Time
Syntax:
Syntax 1. Convert the DateTime Type Or the Blob Value whose First Value Is DateTime Or Time To a Time Type Value Syntax Time ( DateTime )
Syntax 2. Convert a String whose Value Is a valid Time To a Value Of Type Time Syntax Time ( String )
Syntax 3. Combining integers representing hours, minutes, seconds, And microseconds Into a Time Value Syntax Time ( Hour, Minute, Second {, microsecond } )
parameter:
Syntax 1
DateTime: a Value Of Type DateTime Or a Value Of Type Blob whose First Value Is DateTime Or Time.
When the parameter Is a Blob Type variable, Convert the First Value Of the variable To a Time Type Value, And ignore the rest.
the DateTime parameter can also be an Any Type variable containing the above types Of Data
Syntax 2
String: String Type, its Value includes a valid Time expressed In String form (such as 9am Or 10:25)
the String parameter can also be an Any Type variable containing Time Type Data
Syntax 3
parameter Hour: Integer Type, the Hour In the specified Time, From 0 To 23
Minute: Integer Type, the Minute In the specified Time, From 0 To 59
Second: Integer Type, the Second In the specified Time, From 0 To 59
microsecond: Integer Type, optional, the microsecond In the specified Time, From 0 To 32767
Return Value:
Syntax 1
Return Value: Time.
When the Function executes successfully, it returns the corresponding Time Type Value.
If the Value In the DateTime parameter Is Not a valid PowerScript Time Or the Data Type Is incompatible, the Time() Function returns 00:00:00.000000.
If the Value Of the DateTime parameter Is Null, the Time() Function returns Null.
Syntax 2
Return Value: Time.
When the Function executes successfully, it returns the corresponding Time Type Value.
If the Value In the String parameter Is Not a valid PowerScript Time Or Is Of an incompatible Data Type, the Time() Function returns 00:00:00.000000.
If the Value Of the String parameter Is Null, the Time() Function returns Null.
Syntax 3
Return Value: Time.
When the Function executes successfully, it returns the Time determined By the four parameters Of Hour, Minute, Second, And microsecond.
If an invalid Value Is used For Any Of these four parameters (For example, the Hour Is specified as 44), the Time() Function returns Null.
4. Numerical calculation
(1), Abs
Function:
Calculates the absolute Value.
Syntax:
Abs ( n )
parameter:
n: the Data Type Of the numeric variable Or expression Return Value whose absolute Value Is To be obtained Is the same as the Data Type Of n
Return Value:
When the Function executes successfully, it returns the absolute Value Of n.
If the Value Of the parameter n Is Null, the Abs() Function returns Null.
(2), Ceiling
Function:
Returns the smallest Integer greater than n.
Syntax:
Ceiling ( n )
parameter:
n: Numeric variable Or expression Return Value the Data Type Of the Return Value Is the same as that Of n.
Return Value:
When the Function executes successfully, it Returns the smallest Integer greater than n.
If the Value Of the parameter n Is Null, the Ceiling() Function Returns Null
(3), Cos
Function:
Computes the cosine, Where the Argument Is In radians.
Syntax:
Cos ( n )
parameter:
n: Numeric variable Or expression
Return Value:
Return Value: Double.
When the Function executes successfully, it returns the cosine Of n.
If the Value Of parameter n Is Null
(4), Exp
Function:
Computes e To the nth power.
Syntax:
Exp ( n )
parameter:
n: specify the power Value
Return Value:
Return Value: Double.
When the Function executes successfully, it returns e (approximately equal To 2.71828) To the nth power.
If the Value Of the parameter n Is Null, the Exp() Function returns Null.
(5), Fact
Function:
Computes the factorial Of n.
Syntax:
Fact ( n )
parameter:
n: Numeric variable Or expression
Return Value:
Return Value: Double.
Returns the factorial Of n when the Function executes successfully.
If the Value Of the parameter n Is Null, the Fact() Function Returns Null.
(6), Int
Function:
Get the largest Integer less than Or equal To n.
Syntax:
Int ( n )
parameter:
n: Numeric variable Or expression
Return Value:
Return Value: Integer.
When the Function executes successfully, it returns the largest Integer less than Or equal To n. If the Value Of n Is too small Or too large To represent an Integer, the Function returns 0.
If the Value Of parameter n Is Null, the Int() Function returns Null.
(7), Log
Function:
Computes the natural logarithm Of n.
Syntax:
Log( n )
parameter:
n: Numeric variable Or expression, its Value must be greater than 0
Return Value:
Return Value: Double.
When the Function executes successfully, it returns the natural logarithm Of n. If n Is less than Or equal To 0, it will cause a runtime Error.
If the Value Of the parameter n Is Null, the Log() Function returns Null.
(8), LogTen
Function:
Calculates the common logarithm (base 10) Of n.
Syntax:
LogTen ( n )
parameter:
n: Numeric variable Or expression, its Value must be greater than 0
Return Value:
Return Value: Double.
Returns the common logarithm Of n when the Function executes successfully. If n Is less than Or equal To 0, it will cause a runtime Error.
If the Value Of the parameter n Is Null, the LogTen() Function Returns Null.
(9), Max
Function:
Find the maximum Of two numbers.
Syntax:
Max ( X, Y )
parameter:
X: Numeric variable Or expression, the First Number To be compared
Y : Numeric variable Or expression, the Second Number To be compared
Return Value:
the Return Value uses the more precise Data Type Of the Data types Of X And Y as the Return Value Data Type Of the Function.
When the Function executes successfully, it returns the greater Of the two numbers compared By the parameters.
If the Value Of Any parameter Is Null, the Max() Function returns Null
(10), Min
Function:
Find the minimum Of two numbers.
Syntax:
Min( X, Y )
parameter:
X: Numeric variable Or expression, the First Number To be compared
Y : Numeric variable Or expression, the Second Number To be compared
Return Value:
the Return Value uses the more precise Data Type Of the Data types Of X And Y as the Return Value Data Type Of the Function.
When the Function executes successfully, it returns the smaller Of the two numbers compared By the parameters.
If the Value Of Any parameter Is
(11), Mod
Function:
Find the remainder.
Syntax:
Mod ( X, Y )
parameter:
X: numeric variable Or expression, dividend
Y : numeric variable Or expression, divisor
Return Value:
the Return Value uses the more precise Data Type Of the Data types Of X And Y as the Return Value Data Type Of the Function.
When the Function executes successfully, it returns the remainder obtained By dividing X By Y.
If the Value Of Any parameter Is Null, the Mod() Function returns Null.
(12), Pi
Function:
Computes the product Of n And Pi(3.14159265358979323…).
Syntax:
Pi ( n )
parameter:
n: Numeric variable Or expression
Return:
Return Value: Double.
When the Function executes successfully, it returns the product Of n And Pi(3.14159265358979323…).
returns -1 On Error. If the Value Of parameter n Is Null, the Pi() Function returns Null.
(13), Rand
Function:
Get a pseudorandom Number Between 1 And n
Syntax:
Rand ( n )
parameter:
n: Numeric variable Or expression, specifying the Upper bound Of the pseudo-random Number To be generated.
Valid Values are Between 1 And 32,767 the Return Value Is the same Data Type as n.
Return:
When the Function executes successfully, it returns a pseudo-random Number Between 1 And n, including 1 And n.
If the Value Of parameter n Is Null, the Rand() Function returns Null.
(14), Randomize
Function:
Initializes the pseudo-random Number generator so that the Application uses a different sequence Of pseudo-random numbers each Time.
Syntax:
Randomize ( n )
parameter:
n: Numerical variable Or expression, which specifies the starting Value used By the pseudo-random Number generator. different starting Values can generate different pseudo-random Number sequences. When the Value Of n Is 0, the Function uses the System clock as the initial Value Of the pseudo-random Number generator, which can generate non-repeatable pseudo-random Number sequences. When the Value Of n Is Not 0, different pseudo-random Number sequences can be generated. However, If the same pseudo-random Number generator starting Value Is used twice, the pseudo-random Number sequences generated twice are the same.
the Value Of n Is Between 0 And 32,767
Return Value:
Return Value: Integer. the Return Value Of This Function Is rarely used.
(15), Round
Function:
Round X To n digits.
Syntax:
Round ( X, n )
parameter:
X: Numeric Data To be rounded
n: Integer Type, specify From which Decimal places To Round X.
Valid Values are Between 0 And 18
Return Value:
Return Value: Decimal.
When the Function executes successfully, it returns the Value Of X rounded To the nth place after the Decimal point. If the Function fails To Execute Or the Value Of Any parameter Is Null, the Round() Function returns Null.
(16), Sign
Function:
Determines whether n Is an Integer, negative Number, Or zero.
Syntax:
Sign ( n )
parameter:
n: Numeric variable Or expression specifying the Value Of the symbol To be tested
Return Value:
the Return Value Is Integer. Returns 1 when n Is greater than 0;
Returns -1 when n Is less than 0;
Returns 0 when n Is equal To 0.
If the Value Of the parameter n Is Null, the Sign() Function Returns Null.
(17), Sin
Function:
Computes the sine, Where the Argument Is In radians.
Syntax:
Sin( n )
parameter:
n: Numeric variable Or expression
Return Value:
Return Value: Double.
Returns the sine Of n when the Function succeeds.
If the Value Of parameter n Is Null, the Sin() Function Returns Null.
(18), Sqrt
Function:
Calculates the square root.
Syntax:
Sqrt ( n )
parameter:
A numeric variable Or expression specifying the Data To calculate the square root Of
Return Value:
Return Value: Double.
When the Function executes successfully, it returns the square root Of n.
If n Is negative, A runtime Error Is raised When the Function Is executed.
If the Value Of parameter n Is Null, the Sqrt() Function returns Null.
(19), Tan
Function:
Computes the tangent, Where the Argument Is In radians.
Syntax:
Tan( n )
parameter:
n: Numeric variable Or expression
Return Value:
Return Value: Double.
When the Function executes successfully, it returns the tangent Of n.
If the Value Of parameter n Is
(20), Truncate
Function:
Truncates a Value To the specified Number Of Decimal places.
Syntax:
Truncate ( X, n )
parameter:
X: Numeric Data To be truncated
n: Integer Type, specify From which Decimal place To Truncate X.
Valid Values are Between 0 And 18
Return Value:
Return Value: Decimal.
When the Function executes successfully, it returns the Value that Truncates X To the nth digit after the Decimal point. If the Function fails To Execute Or the Value Of Any parameter Is Null, the Truncate() Function returns Null.
the so-called truncation Is To discard the Value after the specified bit.
PowerBuilder Manual Book Part 4 ClickHere
Good Luck!