Variable Assignments

Kenneth Brody kenbrody at spamcop.net
Sun Aug 21 09:21:05 PDT 2016


On 8/21/2016 11:11 AM, Jose Lerebours via Filepro-list wrote:
>
> On 08/21/2016 10:51 AM, Kenneth Brody via Filepro-list wrote:
>> On 8/21/2016 1:23 AM, Stanley - stanlyn.com via Filepro-list wrote:
>> [...]
>>> Aa="9"+"1"
>>>
>>> Fn=aa    ' returns the number 10 instead of the value of field 10
>>>
>>> I've tried fn=(aa) and fn=((aa)) and both returns 10
>>
>> That's because aa equals 10, so naturally storing the value of field aa
>> anywhere will get you 10.
>>
>> This is where FIELDVAL() comes in:
>>
>>     fn = fieldval(-,aa)
>>
> ah, there is an answer ... lol
>
> Ken, is the use of an array versus the method fieldval() any different in
> turns of speed or memory resources?
>
> My guess is that the array uses up memory where the method does not, at
> least not constant.

The array method uses a minuscule amount of memory.  (When you define an 
array as an alias, all it really take up in memory is the name of the array, 
and a piece of information as to where it is aliased to.  As opposed to a 
'regular' array, which takes up X field definitions, and their associated 
storage.)

You would have to profile the two methods to see which, if either, is 
faster.  Knowing the code, I don't expect anything significant.

-- 
Kenneth Brody


More information about the Filepro-list mailing list