Home page  
Help >
DDL Command LOOK
Version 7.11
LOOK

LOOK is an alternate form of query. LOOK performs a query based on criteria entered in appropriate fields in a Screen. After the query, the results are found in the collection, just the same as FIND.

Syntax:
LOOK/options collection tablename screen-name [x;y] -
[special procedure designation] -
[field name list] -
[field=value ... field=value]

Notation standards Options Answers

Options:
A -When last character of a field fills, advance cursor to next field
G -Use query operator "=" rather than default SV for string fields
V -Use query operator AV rather than default SV for string fields
X -Suppress the command response
Y -Do not alter the command answer cells

Answers:
Ctl.Ans1 =The number of records found
Ctl.Ans2 =CANCEL if user cancelled the look, OK if query was done
Ctl.Ans3 =Zero

Notes:
Basically, LOOK is just an alternate form of FIND. You are using a Screen and doing a query-by-form rather than using a statement. The query executes when the last field in the form has been gone through, or when the user presses the OK button.

Although any of the screen types can be used for a LOOK, the fixed screen is best, and that is what we recommend. When creating the screen, be sure to stretch out all fields (make them longer) so that the user has room to enter ranges for numeric fields, or multiple criteria for string (type X) fields.

Only fields where the user enters criteria are used in the query. When more than one field has received criteria, the result of the query is the logical AND of the individual queries.

The default query operators are SV for string fields, ASV for memo fields, EQ for numeric fields, and GE for numeric fields when a range is supplied
(i.e., n1 THRU n2). You can override the default query operators for string or memo fields via the use of the V or G options.

The user can enter more than one criteria for string or memo fields queries by separating the individual criteria with either commas or semicolons. For example, lets say STO; BRO; MAR is entered for the query. If this was entered for a string (type X) field, records are found for all values of that field that begin with STO or BRO or MAR. For a memo field, records are found if any word in the text begins with STO or BRO or MAR.

LOOK supports queries on non-keyed fields. Generally, queries on non-key fields take longer than queries in keyed fields.

Keep in mind that when the answer is zero, that could be because a legitimate query resulted in no records found, or it could be because the user CANCELled the LOOK. You need to capture both answers in order to distinguish between the two:
LOOK A CUSTOMERS ....
SET/Y %ans = %answer
SET/Y %ans2= %answer2

if %ans2='CANCEL'
end
endif

if %ans=0
(do whatever for a legitimate query)
(that resulted in a zero answer )
endif

(you get here when a successful query)
(resulted in a non-zero answer )

In the Example Data Base you can see more examples of LOOK under UTILITIES/VARIOUS TESTS/USING THE LOOK COMMAND. There are two examples, the first uses the procedure named LOOKTEST, the second uses the procedure named LOOKXTEST.

Copyright © 2019 , WhamTech, Inc.  All rights reserved. This document is provided for information purposes only and the contents hereof are subject to change without notice. Names may be trademarks of their respective owners.