Salesforce

VecSet (Magic xpa 4.x)

« Go Back

Information

 
Created BySalesforce Service User
Approval Process StatusPublished
Objective
Description

VecSet (Magic xpa 4.x)

Updates the value of a selected cell with a given vector.

Syntax:

VecSet(Vector Field Reference, Cell Index, Value)

Parameters:

Vector Field Reference – A numeric value representing a vector variable index within the Variable list.

Cell Index – The index of the retrieved cell.

Value – Depends on the data attribute stored in the cell vector.

Returns:

True when successful. False when the field reference is not a vector field, the value parameter is not the same data attribute value as stored in the cell vector, or a negative index value is provided.

Example:

VecSet ('B'VAR,1,'a') – sets the first element of vector B to 'a'

Note:

If you know that you are going to fill x cells in the vector, it is best to put a value in cell x and then update all the cells. This will allocate the memory to the vector immediately (instead of allocating memory each time a value is added to a new cell).

The allocation of a vector is according to its size.

Using the VecSet function on cell#999 allocates the first 999 cells, even if there are no values in the first 998 cells.

Deallocating the vector is done by updating the vector pointer to NULL().

There is no technique to "release" the vector tail (for example, the last 500 cells from a 1000 cells vector)

Updating with the NULL function causes the loss of the entire vector.

Even if you update the vector with null, it is not clear that the memory will be released immediately. This kind of update leaves a null pointer, and a garbage collector needs to release the memory. In addition, the operating system's behavior will most likely not reduce the size of the process immediately. Working with a vector is similar to working with memory tables in this sense. The same explanation applies for the memory handling of a Magic xpa BLOB field.

To summarize, you cannot reduce the memory consumption simply by updating cell values with zeros or null values. A vector needs to be completely released, and even then the operating system also plays a part in the timing of the memory release.

See also:

The Online and Rich Client Samples projects (program CS03 and RCS03)

VecGet

Reference
Attachment 
Attachment