Variable Lookup Field

Barry Wiseman bwiseman at optonline.net
Thu Aug 7 14:57:24 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)


More information about the Filepro-list mailing list