UPut()

<< Click to Display Table of Contents >>

Navigation:  Available Functions >

UPut()

Syntax

UPut( <StorageValue>, <StorageLocation>, <ReturnValue> )

 

Purpose

To store a value of any type.

 

Parameters

<StorageValue> is the value to store. It can be of any data type (character, numeric, date, etc.).

 

<StorageLocation> is the location to store the value in. The <StorageLocation> is always an integer numeric value (1, 2, 3, 4, etc.). You can think of it like an address on a mail box.

 

<ReturnValue> is an optional parameter. It allows you to tell UPut() to return a specific value. This can be useful when using UPut() with custom selection conditions. Since you would normally occupy an entire condition line with a single usage of UPut() in a selection definition, you would need UPut() to return true (.T.) so that its use would have no effect on the outcome of the selection. If <ReturnValue> is omitted, UPut() will return <StorageValue>.

 

Returns

As explained above, the return value of UPut() depends on whether you specify anything for <ReturnValue>. If you do, that will be the value returned by UPut(). If you do not, UPut() will return <StorageValue>.

 

Usage

The UPut() function is designed specifically to be used in conjunction with the UGet() function. The UPut()/UGet() pair of functions allow you to store and retrieve values of any type during a report or selection in DonorQuest. These are very advanced functions, mainly designed to be used with custom selections.

 

Very basically, the UPut()/UGet() functions allow you to store and retrieve temporary values, much like the memory function on a hand-held calculator allows you to temporarily store intermediate results with the memory key. Note that the values you store and retrieve with the UPut()/UGet() functions are temporary -- they will be gone when you exit DonorQuest.

 

Example

When defining Custom selections, you may occasionally need to create very complex conditions. Since these conditions can become very long -- especially if you make use of the SUM_IN() function. For such conditions, it is often easier to break a complex condition down into intermediate results which you would store via the UPut() function. Then, the results of the complex conditions would be readily available via the UGet() function.

 

The following examples further illustrate UPut() and UGet(). For more information, please refer to the UGet() function:

 

CALL

RESULT

UPut( "Memory Is Precious", 1 )

Memory Is Precious

UPut( 3.141592654, 2 )

3.141592654

UPut( "Memory Is Precious", 1, .T.)

True

UPut( 3.141592654, 2, .T. )

True

UGet( 1 )

Memory Is Precious

UGet( 2 )

3.141592654