Siebel eScript Language Reference > Siebel eScript Commands > Buffer Object Methods >

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:

  • signed (the default)
  • unsigned
  • float
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

float

Any 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 location

The 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 like 1.39999974. This is sufficiently insignificant to ignore, but note that the following does not hold true:

bufferItem.putValue(1.4,8,"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

getValue() Method

Siebel eScript Language Reference