Command Reference : Function Reference : Function Reference: W
  
 
@wquery
 
Object attributes from database query.
Syntax: @wquery(db[, str, attr])
db: string
str: (optional) string
attr: (optional) string
Return: string
Returns a string list of object attributes for all objects in the database named db that satisfy the query specified by str. The search expression str should be a standard database query.
By default @wquery will return the name of the objects in the database that match the search criteria. However you may specify other object attributes to be returned, by listing them (comma delimited) in attr.
Examples
If a database, MYDB, contains a series object named “GDP_1” and a series called “GDP_2”, with the first being annual frequency and the second being quarterly frequency, then
@wquery("mydb", "name matches GDP* and freq=Q", "name")
returns the string “GDP_2”. Alternately,
@wquery("mydb", "name matches GDP* and freq=A", "name, freq")
returns the string list “GDP_1 A”.
@wquery("basics.edb", "freq = q and start>1970 and not scale=millions")
returns a string list of the names of all objects in the database BASICS.EDB with quarterly frequency and a start date after 1970 which do not have the custom attribute ‘scale’ set to ‘millions’.
@wunique(@wquery("mydb", "start>2000", "freq"))
returns a string list of all the frequencies of objects in the database whose start date is post 2000. Note that we use the @wunique function to remove duplicate frequencies from the list.
Cross-references
See also @wlookup.