Converts data into data of type long. There are two syntaxes.
To |
Use |
---|---|
Combine two unsigned integers into a long value |
|
Convert a string whose value is a number into a long or to obtain a long value stored in a blob |
Combines two unsigned integers into a long value.
Long ( lowword, highword )
Argument |
Description |
---|---|
lowword |
An UnsignedInteger to be the low word in the long |
highword |
An UnsignedInteger to be the high word in the long |
Long. Returns the long if it succeeds and -1 if an error occurs. If any argument’s value is null, Long returns null.
Use Long for passing values to external C functions or specifying a value for the LongParm property of PowerBuilder’s Message object.
These statements convert the UnsignedIntegers nLow and nHigh into a long value:
UnsignedInt nLow // Low integer 16 bits
UnsignedInt nHigh // High integer 16 bits
long LValue // Long value 32 bits
nLow = 12345
nHigh = 0
LValue = Long(nLow, nHigh)
MessageBox("Long Value", Lvalue)
Converts a string whose value is a number into a long or obtains a long value stored in a blob.
Long ( stringorblob )
Argument |
Description |
---|---|
stringorblob |
The string you want returned as a long or a blob in which the first value is the long value. The rest of the contents of the blob is ignored. Stringorblob can also be an Any variable containing a string or blob. |
Long. Returns the value of stringorblob as a long if it succeeds and 0 if stringorblob is not a valid PowerScript number or if it is an incompatible datatype. If stringorblob is null, Long returns null.
To distinguish between a string whose value is the number 0 and a string whose value is not a number, use the IsNumber function before calling the Long function.
This statement returns 2167899876 as a long:
Long("2167899876")
After assigning blob data from the database to lb_blob, the following example obtains the long value stored at position 20 in the blob:
long lb_num
lb_num = Long(BlobMid(lb_blob, 20, 4))
For an example of assigning and extracting values from a blob, see Real.
Long method for DataWindows in the DataWindow Reference or the online Help