Need help on LOCATE and BETWEEN(,,) 
Author Message
 Need help on LOCATE and BETWEEN(,,)

PUBLIC serial1, serial2, num_key, serl_key
set talk off
serial1 = " "
serial2 = " "
clear
close all
serl_key = SPACE(6)
num_key = SPACE(15)
do serial.spr  - prompts the user to input eqpt. serial#
do lkuppart.spr - prompts the user to input part# they want to locate
use parts.dbf

        * parts.dbf has the following fields
        * partnum c 15
        * price n 10.2
        * serial1 c 6
        * serial2 c 6
        * notes m 10

locate ALL for upper(num_key)$upper(partnum)
DO WHILE found() BETWEEN (serl_key, serial1, serial2)
        if not found ()
                do parterr.psr
                else
                do parts2.spr
        endif
ENDDO

return
close all
clear

WHAT I WANT THE PROGRAM TO DO
=============================
1. Lookup a part number that exists between serial1 and serial2
2. If this part does not exist do the error screen (i.e. parterr.spr)
3. If this part exists show the part (i.e. do parts.spr)

WHAT THE PROGRAM DOES NOW
==========================
1. Looks up the part number disregarding the serial number parameters

===========
Help, comments, suggestions, ideas, corrections are welcome.

Thanks

Pankaj Asundi



Mon, 23 Dec 1996 03:48:58 GMT
 Need help on LOCATE and BETWEEN(,,)



Quote:
>locate ALL for upper(num_key)$upper(partnum)
>DO WHILE found() BETWEEN (serl_key, serial1, serial2)
>    if not found ()
>            do parterr.psr
>            else
>            do parts2.spr
>    endif
>ENDDO

>WHAT I WANT THE PROGRAM TO DO
>=============================
>1. Lookup a part number that exists between serial1 and serial2
>2. If this part does not exist do the error screen (i.e. parterr.spr)
>3. If this part exists show the part (i.e. do parts.spr)

>WHAT THE PROGRAM DOES NOW
>==========================
>1. Looks up the part number disregarding the serial number parameters

LOCATE FOR UPPER(num_key)$UPPER(partnum) AND ;
   BETWEEN(serl_key,serial1,serial2)
IF FOUND()
   DO WHILE FOUND()
      DO parts2.spr
      CONTINUE
   ENDDO
ELSE
   DO partserr.spr
ENDIF
--

=My thoughts, my posts, my ideas, my responsibility, my beer, my pizza.  OK???=
=        "Didn't open a box.  Last time, didn't know what the box did."       =


Mon, 23 Dec 1996 05:36:00 GMT
 Need help on LOCATE and BETWEEN(,,)
|> locate ALL for upper(num_key)$upper(partnum)
|> DO WHILE found() BETWEEN (serl_key, serial1, serial2)
|>   if not found ()
|>           do parterr.psr
|>           else
|>           do parts2.spr
|>   endif
|> ENDDO

I think the problem is you need a CONTINUE statement within the
loop.  The CONTINUE statement will move to the next record found (or
none if there aren't any).

But I also think there might be a better way to do this.  But I'm not
sure.  Someone else have an idea?  Maybe a SELECT statement or
something. :/

--------------------------------------------------------------------------------

Freedom of thought is given by your deity.
Freedom of speech by your government.
Everything else you have to get yourself.



Mon, 23 Dec 1996 08:15:52 GMT
 
 [ 3 post ] 

 Relevant Pages 

1. Need help in locating source of ActiveX error

2. Performix EMPOWER Product -- Need help in locating manufacturer

3. HELP: TQuery.Locate vs TTable.Locate ?

4. Help Needed in Locating Talented Data Warehouse Consultants/SEs/Sales Executives

5. Help Needed in Locating Data Warehousing Talent: Consultants, Sales Engineers, Sales Executives

6. Need help locating correct trace file.

7. Need some help - cannot locate a product sales specialist w/Oracle, Unix, Sybase for my Client

8. Need Help Locating Informix or Oracle

9. Need help with ObjectPal "Locate"

10. Help Needed Locate A PdoxWin Shareware Product

11. Help needed with locate statement

12. Need help locating recent GENMENUX


 
Powered by phpBB® Forum Software