Supported
Appeon supports all standard PowerBuilder data types as outlined in the table below:
Table 203.
Blob |
Boolean |
Byte |
Char or character |
Date |
DateTime |
Decimal or Dec* |
Double |
Integer or Int |
Long |
Real |
String |
Time |
UnsignedInteger, UnsignedInt, or Uint |
UnsignedLong or ULong |
Limitations
-
In operations that do not contain calculations of precision, values/variables of number data type are handled as values/variables of Decimal data type in Appeon.
-
In operations that contain calculations of precision, values/variables of number data type (such as Decimal, Real, Double) are handled as values/variables of Double data type in Appeon, while they are handled as values/variables of Decimal data type in PowerBuilder. The reason for handling in this way is Appeon takes advantage of JavaScript to calculate the numbers, and JavaScript has only one number data type which is Double. The following table lists the major differences between Decimal and Double.
Range Bytes Occupied Valid Digits Precision Decimal
1E-28~7.9228 x 10^28
-1E-28~-7.9228 x 10^28
12
28
Precisely represent both the fractional portion and the integer portion.
Double
1.7E-308~1.7E+308
-1.7E-308~-1.7E+308
8
15
Precisely represent the integer portion, but not the fractional portion.
From this table, we can see that
-
Decimal can exactly represent all numbers within its range, but the range is smaller.
-
Double cannot precisely represent the fractional portion of the number within its range, but the range is larger.
Double occupies only 8 bytes, but it can represent a range much larger than Decimal, mainly because it compromises the precision of the fractional portion. For example: 1234.503 is represented as 1234.5029999999999 in Double.
Therefore, Appeon will be different from PowerBuilder in the following two areas:
-
Precision in mathematical operation
After the mathematical operation, Appeon produces different results from PowerBuilder. For example,
Operation: 9876543219876 - 9876543219875.1 - 0.3 - 0.1 PowerBuilder result: 0.5 Appeon result: 0.500390625
Operation: 123456789- 123456788.05 - 0.3 - 0.05 PowerBuilder result: 0.6 Appeon result: 0.6000000029802321
Operation: 15918.73 - 15.92 - 0.36 - 15902.45 PowerBuilder result: 0 Appeon result: -1.8189894035458565e-12
-
Data range
PowerBuilder by default can support up to 28 digits (including integer portion and fractional portion); while Appeon can only support up to 15 digits (including integer portion and fractional portion), numbers more than that will get truncated automatically. For example, the value 1234567890123456 will be returned as 123456789012345 in Appeon.
An exception is that if the number is assigned to a DataWindow, then the decimal precision can be extended from 15 digits to 28 digits; however, you cannot manipulate 28-digit decimal in a DataWindow via Get/Set function and dot notation.
-
-
UnsignedLong (32-bit) and UnsignedInteger (16-bit)
The UnsignedLong (32-bit) and UnsignedInteger (16-bit) data types are handled as Long and Integer. Therefore, the supported range for UnsignedLong is from 0 to 4,294,967,295, and the supported range for UnsignedInteger is from 0 to 65,535.
-
You must ensure that the result of a numeric expression will not cause overflow in PowerBuilder. Otherwise the result on the Web is different from that in PowerBuilder.
Decimal in DataWindow
The decimal precision extends to 28 digits in a DataWindow by enabling the 28-digital Decimal option in AEM.
-
Precision
With 28-digit Decimal option, the decimal precision in DataWindow supports up to 28 digits and ranges from -39,614,081,257,132,168,796,771,975,167 to +39,614,081,257,132,168,796,771,975,167.
-
Function Limitations
-
28-digit Decimal supports the following arithmetic operators:
Arithmetic operators: "+", "-", "*", "/"
Relational operators: =, >, <, <>, >=, <=
-
28-digit Decimal is supported in the following DataWindow expressions: Abs, Avg, CumulativeSum, Median, Sign, and Sum.
-
-
Function Differences
-
In the calculation, values/variables of Double or Real data type are handled as values/variables of Decimal data type.
-
Constants in an expression will be handled as Double data type if the expression is being dynamically modified and contains relational operators (=, >, <, <>, >=, <=).
-
Constants in an expression will be handled as Decimal data type if the expression is being dynamically modified and contains arithmetic operators ("+", "-", "*", "/").
-
Appending the letter D in uppercase or lowercase to identify a number as a decimal constant in a DataWindow expression is unsupported in 28-digit decimal.
-
Decimal displaying in the DataWindow in Appeon may differ from that in PowerBuilder. Sometimes Decimal displays in scientific notation in PowerBuilder but displays in standard notation in Appeon.
-
If exceeding 28 digits, the decimal number cannot be correctly displayed on the Web.
-
Any data type is fully supported, with the exception as follows:
-
Assigning the return value of a String function to an Any variable that has not been previously assigned is unsupported.
-
Using Any in the OCX is unsupported.
-
Using Any array is only supported in the retrieval argument.
-
Using Any array in a dot notation is unsupported. To work around it, you can using Any variable instead of Any array.
For example:
Unsupported code:
la_data[] = dw_1.object.data
Supported code:
any la_data1 la_data1 = dw_1.object.data
Supported
-
Autoinstantiated object data types:
NVOs (Class User Object) with their Autoinstantiate property checked;
Structure data types;
Autoinstantiated system objects: ListViewItem, TreeViewItem.
-
Nonautoinstantiated object data types:
NVOs (Class User Object) with their Autoinstantiate property unchecked;
Visual controls (user-defined visual controls and system controls)
Nonautoinstantiated system objects, including: Application, DataStore, DataWindowChild, DynamicStagingArea, MDIClient, Menu, Message, Transaction Object, Window.
-
PowerObject classes:
The supported PowerObject classes include DragObject, DWObject, GraphicObject, PowerObject, and WindowObject.
Note: In the Web application, because the declaration of a PowerObject does not specify the object type, the initial value of the variable is NULL. Therefore, when the IsValid function is executed, IsValid returns NULL.
Unsupported
-
Among all the supported system objects and system controls, if the data type is a non-global Transaction Object, the data type is not supported.
-
If the data type is an unsupported system object or system control, it is unsupported.
-
Do not refer to a DataWindow object by using global functions or instance variables. Otherwise the executing result will has error on the Web.
Supported
All system-defined enumerated data types and values are supported, unless the enumerated data type belongs to an unsupported feature.
Unsupported
Enumerated data types have predefined sets of values. Most of the PowerBuilder enumerated data types have default values. Using the default values of enumerated data types is unsupported.
Supported
-
Forced conversion between string and char data type:
-
Assigning strings to char arrays
-
Assigning char arrays to strings
-
When a string literal is assigned to a char variable, the first character of the string literal is assigned to the variable.
For example:
char c = "xyz" //results in the character x being assigned to the char variable c.
-
Special characters (such as new line, form feed, octal, hex, etc.) can be assigned to char variables using string conversion.
For example:
char c = "~n"
-
A char variable assigned to a string variable results in a one-character string.
-
Expressions using both strings and char arrays promote the chars to strings before evaluation.
For example:
char c if (c = "x") then // promotes the contents of c to a string before comparison with the string "x"
-
Using chars in PowerScript functions. All PowerScript functions that take strings also take chars, subject to the above described conversion rules.
-
-
Forced conversion between numeric data types:
-
The order of precedence in PowerBuilder regarding numeric data types is supported. The following is the order of precedence from highest to lowest (based on the range of values for each data type):
(High) Double >> Real >> Decimal >> UnsignedLong >> Long >> UnsignedInteger >> Integer (Low)
-
If operands in an expression have different data types, the value whose type has lower precedence is converted to the data type with higher precedence.
For example:
int x; x=2.4
PowerScript result: the value of x is actually 2, because x is defined as an integer. PowerBuilder will cut the digit after the decimal point, then assign 2 to x.
-
Unsigned type has precedence over signed. So if one operand is signed and the other is unsigned, both are promoted to the unsigned version of the higher type. For example, if one operator is a Long and another an UnsignedInteger, both are promoted to UnsignedLong.
-
Transform other numeric data types recessive to integer or int data. A force conversion from other numeric data to int/long data will arrive at the same value in PowerScript and JavaScript.
-
Unsupported
-
In PowerBuilder, when Time data type is automatically converted into DateTime, the date is always 1900-01-01. Thus, the DataWindow always gets a value of DateTime type: Retrieve (1900-01-01 xx:xx:xx).However, if connected to a JDBC SQL Server, the default date is the current day. In other words, DataWindow gets Retrieve(today xx:xx:xx) when Time data type is automatically converted into DateTime.
Difference
When assigning a numeric number to an Any data, a forced conversion from Any to Integer may arrive at different values in PowerBuilder and on the Web. For example,
Integer li_value any la_value = 3.5 li_value = Integer(la_value) // li_value will be 3 on the Web and 4 in PowerBuilder.