Getting there quickly...
John Esak
john at valar.com
Thu Jun 10 00:17:45 PDT 2004
A couple people emailed me privately for the method I use to go directly
(and instantly) to any record in a file from the command line. I'm
going to post it here rather than send it out privately since I feel
that is the purpose of this forum... filePro code should abound here
not get sent around privately... much. Whenever possible, why not post
little snips like this?
Now, first thing... it is very important to me that you don't think I
feel this is any kind of substitution for the amazingly full-featured
"bclerk" Bob has written. I just use this method for this one thing alone
and it doesn't compare to what bclerk obviously does. I use Bob's
programs all the time, for example, the code below is here compliments
of "pprc" the fantastic script which dumps it out so cleanly for just such
posting here.
As for this little set of scripts. They take me either directly to a name
or a company name in our rolodex file. I use them hundreds of times a week.
They are about the most useful thing in my collection besides "vil".
This should be self-explanatory, but any questions, stop by The FP Room and
feel free to ask... www.tinyurl.com/yuag7
filePro File: rolodex
Processing Table: input
Last Modified: Thursday - Jun 10, 2004 at 2:46 AM
Documented: Thursday - Jun 10, 2004 at 2:48 AM
1 Then: end
@menu If: '@menu
2 Then:
3 Then: declare rols_flag(1,,g)
If: @py eq "rols" and rols_flag eq ""
4 Then: rols_flag="Y"; goto rols
If: @py eq "rolc" and rols_flag eq ""
5 Then: rols_flag="Y"; goto rolc
If: rols_flag eq "Y"
6 Then: exit
7 Then: end
rols If:
8 Then: pushkey getenv("rols_name"){"[ENTR][ENTR]"; end
rolc If:
9 Then: pushkey getenv("rols_name"){"[ENTR]"; end
To make this handful of lines work for you, create two scripts:
"rolc" which contains:
rols_name=$1; export rols_name
rclerk rolodex -m company -s1 -xia -ry "rolc"
and
"rols" which contains:
rols_name=$1; export rols_name
rclerk rolodex -m company -s1 -xib -ry "rols"
(For Windows make the obvious change to the rols_name variable with %'s
The index.A in my rolodex file has Last_Name and First_Name fields, so the
PUSHKEY in the "rols" subroutine requires two ENTERS. The index.B is built
just on one field, Company, so only one ENTER gets the job done.
To run the script simply type:
rols Smi
and you will go to the first record in the name index starting with Smi...
you can browse from there. If you are exact, it will attempt to be exact of
course. So typing "rols Smith" takes you directly to the first Smith
record,
etc.
Same with the company script, i.e., "rols fp" gets me right to FP Tech's
record.
Again you can be more exact.
To find comapanies or names with spaces in them, just use quotes... as in:
rolc "United Air"
and this will take you to the first record starting with United Air.
For those of us who work from the command line, these scripts are great.
For your menu-driven users, you can insert an INPUT POPUP asking for the
name or company they want... then continue on as shown... have fun.
John Esak
Visit The FP Room www.tinyurl.com/yuag7 24/7
More information about the Filepro-list
mailing list