odd lookup problem

Richard Kreiss rkreiss at gccconsulting.net
Sat Nov 6 08:40:14 PDT 2010


Has anyone encountered this:

I have a lookup:

192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: lookup SALES = sales_journal  k=16   i=C -nx
193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         SALES
       Then:         GOTO next_w
194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: zv="This person is not a member yet\nDo you want to continue entering this sale?\n(Y)es or (N)o -> "

As you can see, if the record exist, the program braches, if not it drop through and pops up in input box.

However, the lookup actually needs to find the latest sales journal record so I modified the lookup as follows:

::lv=master_code&"99"

The index is built on the master_code and renewal(2,.0) fields

192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: lookup SALES = sales_journal  k=lv   i=C -nL
193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         SALES
       Then:         GOTO next_w
194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: zv="This person is not a member yet\nDo you want to continue entering this sale?\n(Y)es or (N)o -> "

Here is the interesting problem, I always get a false on line 193 even though there are records in the sales journal for this person.  However, if I modify the code further to:

192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: lv=master_code&"99"
193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: lookup SALES = sales_journal  k=16   i=C -nL
194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         NOT sales
       Then:         GOTO make_zv
195  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         SALES  and sales(3) = master_code
       Then:         GOTO next_w
196  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
make_zv◄ If:
       Then: zv="This person is not a member yet\nDo you want to continue entering this sale?\n(Y)es or (N)o -> "
197  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
yn_sale◄ If:
       Then: input popup("18","-1") y ""{zv
198  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         @sk = "BRKY"
       Then:         END

Line 195 now is true and the correct sales journal record is found. 

Can anyone explain why version 1 fails but works when not sales is added?


Richard Kreiss
GCC Consulting
rkreiss at gccconsulting.net
  





More information about the Filepro-list mailing list