Variable Lookup Field

Chris Rendall crendall at teamind.com
Fri Aug 8 05:56:52 PDT 2008



Chris Rendall wrote:
>> I'm creating an export routine and I'd like for the user to be able to enter which field numbers they want exported and then export just those fields.  I have a dummy variable, ba, that contains the field number I want to export, and I'd like to use the variable with a lookup.  I step through the debugger and when I get to the line that contains hs=fab(ba) I get an error "Reference to a field that doesn't exist".  ba contains the number 14, and before this line executes I can check fab(14) and I get the right data.
>>
>> Is it possible to use a variable with a lookup?
>>
>> Thanks,
>> Chris

>Chris,

>You need to map the looked-up record to an array:

>        dim array(n):fab(1)

>Of course "n" means the number of fields in the file fab comes from.
>Then you will be able to say

>        hs=array(ba)

That's exactly what I needed to do!  I added this code and now my export is working perfectly!

Thanks!

Team Industries, Inc. --- 2007 Labor - Management Award Winner ---

Nominated by the United Association of Plumbers & Steamfitters of the United States and Canada, and selected/presented by the Union Label & Service Trades Department of the AFL-CIO.


More information about the Filepro-list mailing list