Why am I getting a syntax error?

Kenneth Brody kenbrody at bestweb.net
Wed Feb 8 10:48:27 PST 2006


Quoting Dan Coutu (Wed, 08 Feb 2006 13:23:52 -0500):
[...]
> So I store the name of the filePro file in a declared variable called
> FileName, simple enough. It seemed reasonable to want to have a gosub
> that did a lookup of an existing record like this:
>
> lookup fil=(Filename) r=(RecordNo) -ex

That's perfectly reasonable.

> (Naturally I had also stored the filePro record number to be updated in
> the declared variable RecordNo.) Well, this doesn't work because you
> can't use a variable for the name of the lookup file. Bummer.

Excuse me?  I use the above all the time, as I'm sure do 90% of the
regulars on this list.

Can you define "doesn't work"?

> So instead
> of a single line of code for however many filePro files I was working
> with I had to make a line of code for each individual file with the file
> names hardcoded like this:
>
> if:   FileName eq "customer"
> then: lookup fil=customer r=(RecordNo) -ex
> if:   FileName eq "contact"
> then:  lookup fil=contact r=(RecordNo) -ex

That's unnecessary, as the original version you have should work fine.

[...]
> fil(FieldNum) = FieldVal
>
> Again, bummer. It isn't allowed. This one is more painful. Some of the
> files have hundreds of possible fields. Instead of the simple code above
> I have to resort to this type of coding:
>
> if:   FieldNum eq "1"
> then: fil(1) = FieldVal
> if:   FieldNum eq "2"
> then: fil(2) = FieldVal

No, you don't.

Alias an array:

    dim fields[999]:fil[1]

and then:

    fields[FieldNum] = FieldVal

[...]

--
KenBrody at BestWeb dot net        spamtrap: <g8ymh8uf001 at sneakemail.com>
http://www.hvcomputer.com
http://www.fileProPlus.com


More information about the Filepro-list mailing list