odd lookup problem

Kenneth Brody kenbrody at spamcop.net
Mon Nov 8 06:25:19 PST 2010


On 11/6/2010 11:40 AM, Richard Kreiss wrote:
> 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 first example uses field 16, while this uses field master_code.

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

What is the definition of master_code in this file, and what is the 
definition of it in the sales_journal file?

>
> 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:

What is the actual value of field lv?

> 192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>         ◄ If:
>         Then: lv=master_code&"99"
> 193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
>         ◄ If:
>         Then: lookup SALES = sales_journal  k=16   i=C -nL

Now you're back to field 16 as the lookup key.

> 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?

You keep changing the lookup key as well, so it's tough to diagnose where 
the problem lies, as you keep changing more than one variable.

And you never mentioned that the first version failed, just that it "needs 
to find the latest sales journal record".

-- 
Kenneth Brody


More information about the Filepro-list mailing list