Lookup syntax - literal key
Bruce Easton
bruce at stn.com
Fri Sep 7 10:33:20 PDT 2007
Jay R. Ashworth wrote Friday, September 07, 2007 11:26 AM:
and had written previously:
> > > lookup code=svalookr k=("CAT") i=A -nx brw="*2"
> > > ^
> > > Process contains a syntax error at position indicated.?
> >
> > (caret position checked)
> >
> > Laura's QRG says that "k=(exp) - Key may be an expression" as of 4.8.
> >
> > Does "expression" not devolve as far as "string literal"?
> >
> > Or is this really complaining about the brw= argument?
>
> Clearly, it was complaining about the brw argument; changing it to b=
> didn't help; some of the options aren't optional.
Jay - I see where you are saying changing to b= didn't help, but
is it bringing up some sort of browse?
See if your code matches any of the examples below.
1.-----------------------------
lookup alias=(file) k=(key) i=A -nx b=savedformat
This should used the saved format "savedformat" which is a
file named brw.savedformat in the filepro directory ~filepro/<file>.
2.-----------------------------
lookup alias=(file) k=(key) i=A -nx b="(options)[heading]fields"
This is the same format that is built when you use the wizard.
One option could be something like 'brw=12' or 'fill=asc'.
Note that for fields, indicators should be used as on a screen.
Note that either the (options), [heading] or fields sections can
be missing and you still should get a browse - maybe not what
is desired, but it should bring one up.
Note that the brackets above around the work heading doesn't
mean it's optional - they are the characters that tell clerk
that it's working with the heading part of the browse spec.
3.-----------------------------
lookup alias=(file) k=(key) i=A -nx b=(Options & HdrFmt & FldsFmt)
where you have previously set a var ('Options' in this sample) to the
desired options value, like "(brw=12 fill=asc)";
where a var ('HdrFmt' in this sample) has been previously set for the
desired options for the browse heading; and where
a var ('FldsFmt' in this sample) has been previously set for the
desired format of the browse for the data that is to appear.
Again, note that any one or two of those sections can be missing
and you still should get some sort of browse.
After some testing on 5.0, I see that Joe's suspicions are correct -
if something needs to be evaluated, then parentheses should be
used (as in #3 above):
Then: tt="test"
If:
Then: lookup alias=(file) k=(key) i=A -nx b=tt
yielded no browse at all - even if there is a saved browse format
under <file> called 'test'.
filePro's online + dcabe.hlp could be clearer about using
the #3 method from above by stating:
b=(OptionsSpecification & BrowseHeader & BrowseFormat) with
an example right after the syntax
instead of:
b=(BrowseHeader & BrowseFormat)
(The online manual at the fptech site does have an example using
all three parts under the heading "Browse Lookup Example" [see
dummy fields za, zb & zc about 2/3 the way down the window].)
Syntax and examples easily found in STN's
<plug>
filePro Developer's Reference
</plug>
Bruce
Bruce Easton
STN, Inc.
More information about the Filepro-list
mailing list