Why am I getting a syntax error?

Dan Coutu coutu at snowy-owl.com
Wed Feb 8 11:28:24 PST 2006


Kenneth Brody wrote:
> 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"?
>
>   
Yes, I get a syntax error pointing to (Filename) as the source of 
trouble. This is with version 5.0.14D4

>> 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
>   
I'll give it a try! It's nice to have a way to do the job. I just don't 
understand why the intuitive approach I outlined doesn't work. Note: the 
fact that I don't understand why illustrates that there is missing 
information here. It is not necessarily a fault of the code for not 
doing things the way I'd expect it to. In this case it could well be a 
fault in the documentation that either doesn't explain the technique 
sufficiently or the documentation is written so that finding the 
pertinent description was quite difficult.

Thanks,

Dan


More information about the Filepro-list mailing list