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

Richard Kreiss rkreiss at gccconsulting.net
Mon Nov 8 11:46:52 PST 2010



> -----Original Message-----
> From: Kenneth Brody [mailto:kenbrody at spamcop.net]
> Sent: Monday, November 08, 2010 2:22 PM
> To: rkreiss at gccconsulting.net
> Cc: Filepro-list at lists.celestial.com
> Subject: ***SPAM*** Re: ***SPAM*** Re: odd lookup problem
> 
> On 11/8/2010 9:43 AM, Richard Kreiss wrote:
> [...]
> >>> 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
> [...]
> > 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.
> 
> Okay.  But, in the examples you showed, you also changed from using field
> 16 as the lookup key to using master_code&"99".  (ie: rather than using field
> 16, you are now using field master_code.)
> 
> > 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.
> 
> You didn't answer my questions regarding fields 16 and master_code, as well
> as what's actually in the lookup key and in the sales_journal file.
> 
> > 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.
> 
> As is expected.  If the lookup succeeds, "if: sales" will be true, and "if:
> not sales" would be false.  The reverse is true if the lookup fails.
> 
> > 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?
> 
> You haven't shown any code where the only change was the addition of "if:
> not sales", so there's no way to answer that.
> 
> --
> Kenneth Brody

Original code:

192  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:
      Then: lookup SALES = sales_journal  k=16   i=C -nx
193  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:         SALES			This shows true in debugger
      Then:         GOTO next_w
194  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
      ◄ If:
      Then: zv="This person is not a member yet\nDo you want to continue entering Sale?"
195  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
n_sale◄ If:
      Then: input popup("18","-1") y ""{zv

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                                               ◄
195  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:                                                                   ◄
       Then: zv="This person is not a member yet\nDo you want to continue entering sales?"

Here are copies of the code you requested.  Line 193 in the original code will show as true when the debugger is on if any sales journal record is present.  It will drop through to the sales question if no sales journal record is present.

Modified code based on looking up the next lowest value.  Line 194, above, now shows as false even though sales journal records are present.
--------------------------------------------------------------------------------------------------------------
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
196  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
ask_sv ◄ If:
       Then: zv="This person is not a member yet\nDo you want to continue entering sale?"
197  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
yn_sale◄ If:
       Then: input popup("18","-1") y ""{zv
198  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         @sk = "BRKY"
       Then:         END
199  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         y = ""
       Then:         BEEP;MSGBOX "Enter either a (Y) for yes\nOr (N) for No";GO
200  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:         y = "N"
       Then:         END
201  -------   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -   -
       ◄ If:
       Then: GOTO @keys

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?

Richard 








More information about the Filepro-list mailing list