***SPAM*** Re: odd lookup problem

Richard Kreiss rkreiss at gccconsulting.net
Mon Nov 8 06:43:45 PST 2010



> -----Original Message-----
> From: Kenneth Brody [mailto:kenbrody at spamcop.net]
> Sent: Monday, November 08, 2010 9:25 AM
> To: rkreiss at gccconsulting.net
> Cc: Filepro-list at lists.celestial.com
> Subject: ***SPAM*** Re: odd lookup problem
> 
> 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
> 

First version on master_code, field 16, worked.  The problem is I need to check for the latest sales journal record, not just the existence of a record.  This required that I change the key to use the master_code and renewal number.  Since the renewal number is not known,  master_code&"99" with a lookup to the next lowest match.

As I indicated, when I made the change, the if SALES right after the lookup statement showed false and dropped through to no sales journal record, make sales routine.

When not sales was added after the lookup statement and before the if: sales, and there were records found, the if SALES line showed true.

What I am asking is, why should it be necessary to have a not sales before the if sales when doing a lookup to the next lowest match?

Richard





More information about the Filepro-list mailing list