Variable Lookup Field

Tyler tyler.style at gmail.com
Tue Aug 12 09:08:15 PDT 2008


You're looking for FIELDVAL - I use it all the time.

>From the online filePro Manual:
FIELDVAL()
Syntax:

      Then: xx=FIELDVAL(lookupname,fieldno)

"lookupname" is the name of the lookup file. Use a dash "-" to
represent the current file.
"fieldno" is an expression designating the field number for which you
want the name.

Return value is the contents of the specified field.
Version Ref: 4.5

Description:
Returns the contents (value) of the specified field in a lookup file.

Example:
Retrieves the contents of a lookup field and places it in variable aa.

      Then: lookup inv=arinvoice k=2 i=a –nx
      Then: aa=fieldval (inv,"5")

> Date: Thu, 7 Aug 2008 16:26:35 -0500
> From: Chris Rendall <crendall at teamind.com>
> Subject: Variable Lookup Field
>
> 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
>


More information about the Filepro-list mailing list