odd lookup problem

Bruce Easton bruce at stn.com
Mon Nov 8 18:55:12 PST 2010


On 11/8/10 9:13 PM, Kenneth Brody wrote:
> On 11/8/2010 2:46 PM, Richard Kreiss wrote:
> [...]
>> Modified code which didn't work:
>>
>> 192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:                                                                   ◄
>>          Then: lv=master_code&"99"                                               ◄
>> 193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:                                                                   ◄
>>          Then: lookup SALES = sales_journal  k=lv   i=C -nL                      ◄
>> 194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:         SALES                                                     ◄  This line shows false in debugger
>>          Then:         GOTO next_w                                               ◄
> [...]
>> Working code:
>>
>> 192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:
>>          Then: lv=master_code&"99"
>> 193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:
>>          Then: lookup SALES = sales_journal  k=lv   i=C -nL
>> 194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:         NOT sales
>>          Then:         GOTO ask_sv
>> 195  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>>          ◄ If:         SALES and sales(4) = master_code
>>          Then:         GOTO next_w
> [...]
>> In the above version, line 195 shows true.  This was tested before I added the check for the master_code in the sales journal as the next lowest value could be someone else's record when using next lowest.
>>
>> Master_code in in the form NNNNN-NNNN
>>
>> Again, my question is why is line 194, the not statement, necessary for line 195 to be true when it doesn't apply when doing an exact match lookup?
> Assuming identical values for field "lv", and identical data and index.C in
> the "sales_journal" file, there is no reason that "if: sales" would be false
> in the first version and "if: not sales" would be false in the second version.
>
> Now, in the second version, the "if: not sales" is required because, without
> it, the "if" on line 195 would error out if the lookup failed, due to the
> reference to "sales(4)".  However, this is a separate issue.  (Note, too,
> that in the second version, the test for sales on line 195 is redundant, as
> it must be true if the line is reached.)
>
Amen.  But also, the latter part of the last question posed hints at an 
incorrect assumption- that the 'not' test doesn't apply for the 
particular lookup and that what is being performed is an exact-match 
lookup.  To me the 'not' test is always meaningful in some way for any 
kind of lookup, and I don't see an exact-match lookup anywhere here.

Bruce




More information about the Filepro-list mailing list