filepro INDIRECT function

Enrique Arredondo henry at vegena.net
Mon Jun 12 15:02:48 PDT 2006


----- Original Message ----- 
From: "Kenneth Brody" <kenbrody at bestweb.net>
To: "Enrique Arredondo" <henry at vegena.net>
Cc: <filepro-list at lists.celestial.com>
Sent: Tuesday, May 23, 2006 2:28 PM
Subject: Re: filepro INDIRECT function


> Quoting Enrique Arredondo (Tue, 23 May 2006 14:01:52 -0700):
> [...]
>> If you have on excel..... A1 =  1234    and on B1 = A1    and on C1=
>> indirect(B1)   the C1 cell will show 1234.
>>
>> so in filepro language....
>>
>> import ascii imp(...... so  imp(1) = 1   .... and 1 = "Porsche" in the
>> database, so If I want to export it to a csv file, What should I use
>> instead
>> of  :
>>
>> export ascii out(......       out(1)=indirect(imp(1))   ... and out(1)=
>> Porsche.
>>
>> Do I make sense ?
>
> So imp(1) contains the field number that you want to export, correct?
>
> One way is to alias an array to the current record:
>
>    dim fields[999]:1
>
> where "999" is really the number of fields in the record.  Then, you
> can have:
>
>    out(1) = fields[imp(1)]
>
> Of course, you'll want to bounds-check imp(1) first.
>
> Another way is via the FIELDVAL() function:
>
>    out(1) = fieldval(-,imp(1))
>
> Note that the second method has some advantages.  First, you don't
> need to bounds-check imp(1), as invalid field numbers will simply
> return a null string ("").  Second, it can contain a dummy field
> name such as "aa", or system fields such as "@rn", and still work.
> If you want to make sure that only real fields can be accessed,
> bounds-check it to be greater than zero and less than or equal to
> 999.
>

This fieldval thing works wonders!, But now when I use a dummy field (i.e. 
up  that I fill up using a lookup to a different file , it's not working. Do 
I have to do
some trick so it takes the dummies ?

thanks!



More information about the Filepro-list mailing list