Command Reference : Function Reference : Function Reference: W
  
 
@wlookup
 
Lookup objects in workfile or database.
Syntax: @wlookup(obj[, type, [attr, [opt]]])
obj: string
type: (optional) string
attr: (optional) string
opt: (optional) integer
Return: string
Returns a string list of all objects in the workfile or database that match the name pattern list and, optionally, the type object type list and the attr attribute pattern using the opt search option.
The obj list may be made up of any number of names, or “?” (indicates any single character) or “*” (indicates any number of characters) patterns separated by spaces. The pattern must exactly match the object name in the workfile or database.
The type is a space delimited list containing one or more object types. The default is “*”. Object types are "*", "sample", "svector", "equation", "graph", "table", "text", "program", "model", "system", "var", "string", "pool", "sspace", "logl", "alpha", "valmap", "factor", "spool", "graph", "userobj", "group+data", "group", "scalar", "mat/vec/sym", "coeflist","group", "matveclist", "sym", "matrix", "vector", "coef", "series", "link", "digraph", "geomap", "string", "formula", "database", and "workfile".
The attr is a space delimited list of attribute value patterns made up of any number of names, or “?” (indicates any single character) or “*” (indicates any number of characters) patterns separated by spaces. The default is “”.
The obj is an integer value indicating how a “*” in the attr should be treated when matching. Use “0” to treat “*” as a wildcard and “1” to treat “*” as a literal. The default is “0”.
Examples
If a workfile contains three graph objects named “GRA1”, “GRA2”, and “GRA01”, one group object named “GRO1”, and two series objects named “SR1” and “SER2”, then
@wlookup("GR*")
returns the string list “GRA01 GRA1 GRA2 GRO1”. All objects beginning with “GR” and followed by any number of characters are included. Alternatively,
@wlookup("?R*")
returns the string list “GRA1 GRA2 GRA01 GRO1 SR1”. SER2 is not included because “?” specifies a single character preceding an “R”.
@wlookup("?R?","series")
returns the string “SR1”. The object type “series” drops all graph objects from the list, and “?R?” filters out SER2 because “?” specifies a single character.
Now let us assume for the same workfile:
GRA1 had the attributes “Month” and “Author” with values equal to “September” and “Sam”.
GRA2 had the attribute “Author” with value equal to “Sam”.
GRA01 had the attributes “Month” and “Author” with values equal to “January” and “Mary”.
GRO1 had the attribute “Month” with value equal to “September”.
SRO1 had the attribute “Mon” with value equal to “January”.
SER2 had the attributes “Month” and “Author” with values equal to “June” and “Sam”.
We limit the results by adding attribute filters
@wlookup("GR*", "*”, "Month=J*")
returns the string list “GRA01”. “GRA01” was the only object that had the “Month” attribute value beginning with “J”.
@wlookup("*", "*", "Month=September Month=J*")
returns the string “GRA01 GRA1 GRO1 SER2”. All objects either had a “Month” equal to “September” or “Month” beginning with “J”.
@wlookup("*", "GRAPH", "Month=September Month=J*")
returns the string “GRA01 GRA1”. Only graph objects which either had a “Month” equal to “September” or “Month” beginning with “J” are included.
@wlookup("*", "*", "Month=*")
returns the string “GRA01 GRA1 GRO1 SER2”. All objects have a “Month” attribute whereby the value is ignored.
@wlookup("*", "SERIES", "Month=*")
returns the string “SER2”. Only the series objects which have a “Month” attribute are included.
@wlookup("*", "*", "M*th=September")
returns the objects which have attributes beginning with “M” and ending with “th”. This returns the string “GRA1 GRO1”.
Cross-references
See also @wquery.