Siebel eScript Language Reference > Methods Reference > Buffer Methods >

Put Value in Buffer Method


The Put Value in Buffer method replaces existing data in a buffer with a value that you specify. It replaces data starting at the current position of the cursor. It puts the value that the buffer contains at the current cursor position, and then automatically increments the cursor value by the value that the value argument contains.

To put a value at a specific position and preserve the cursor position, you can add code that is similar to the following:

var oldCursor = bufferItem.cursor; // Save the cursor position
bufferItem.cursor = 20;            // Set to new position
bufferItem.putValue(foo); // Put bufferItem at offset 20
bufferItem.cursor = oldCursor // Restore cursor position

For more information, see Usage of the Term Put.

Format

bufferVar.putValue(value[, valueSize][, valueType ])

Table 58 describes the arguments for the Put Value in Buffer method.

Table 58. Arguments for the Put Value in Buffer Method
Argument
Description

value

A number.

valueSize

The description for the valueSize argument and the valueType argument for the Put Value in Buffer method is the same as the description for these arguments for the Get Cursor Position Value From Buffer method. For more information, see Get Cursor Position Value From Buffer Method.

valueType

Avoiding Digit Loss

To put the value in the buffer, the Put Value in Buffer method uses byte ordering according to the current value that the bigEndian argument contains. If it puts a smaller float value, such as 4, then digits are lost. It converts a value such as 1.4 to a value that is approximately 1.39999974. This conversion is insignificant and you can ignore it.

Note the following example:

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.

To prevent this situation, you can set the valueSize argument to 8 instead of 4. You can use a valueSize of 4 for a floating-point value, but be aware that some digit loss might occur. This loss might not be significant enough to affect most calculations.

Siebel eScript Language Reference Copyright © 2018, Oracle and/or its affiliates. All rights reserved. Legal Notices.