Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference > Siebel eScript Commands > Buffer Objects >
putValue() Method
This method puts the specified value into a buffer at the current file cursor position.
Syntax
bufferVar.putValue(value[, valueSize][, valueType ])
Parameter Description value A number valueSize A positive number indicating the number of bytes to be used; default is 1 valueType The type of data to be read, expressed as one of the following:Returns
Not applicable
Usage
This method puts a specific value into a buffer. Acceptable values for valueSize are 1, 2, 3, 4, 8, and 10, providing that this value does not conflict with the optional valueType flag.
Combined with valueSize, any type of data can be put into a buffer. The following list describes the acceptable combinations of valueSize and valueType:
valueSize valueType 1 signed, unsigned 2 signed, unsigned 3 signed, unsigned 4 signed, unsigned, float 8 floatAny other combination causes an error. The value is put into the buffer at the current cursor position, and the cursor value is automatically incremented by the size of the value to reflect this addition. To explicitly put a value at a specific location while preserving the cursor location, do something similar to the following.
var oldCursor = bufferItem.cursor; // Save the cursor location
bufferItem.cursor = 20; // Set to new location
bufferItem.putValue(foo); // Put bufferItem at offset 20
bufferItem.cursor = oldCursor // Restore cursor locationThe value is put into the buffer with byte-ordering according to the current setting of the bigEndian flag. Note that when putting float values as a smaller size, such as 4, some significant figures are lost. A value such as
1.4
is converted to something like1.39999974
. This is sufficiently insignificant to ignore, but note that the following does not hold true:bufferItem.putValue(1.4,4,"float");
bufferItem.cursor -= 4;
if( bufferItem.getValue(4,"float") != 1.4 )
// This is not necessarily true due to significant digit loss.This situation can be prevented by using 8 as a valueSize instead of 4. A valueSize of 4 may still be used for floating-point values, but be aware that some loss of significant figures may occur, although it may not be enough to affect most calculations.
See Also
Bookshelf Home | Contents | Index | Search | PDF |
Siebel eScript Language Reference Published: 18 April 2003 |