DeepSee MDX Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   

Looks up a given key in a term list and returns a substitute string. This function enables you to perform string replacements within a query. This function is an InterSystems extension to MDX.
Returned Type
This function returns a string.
Syntax and Details
LOOKUP(term_list_name, lookup_value,default,alternative_field)
Where the arguments are string expressions as follows:
This function examines the given term list, finds the term whose "key" field equals the string given by lookup_value and then returns the value contained in the field identified by alternative_field.
All term lists have at least two fields: "key" and "value". You can add additional fields. For information, see Defining Term Lists in the Advanced DeepSee Modeling Guide
DeepSee notes the most recent modification time stamp of any term list and invalidates any query cache that uses an outdated term list.
For example, suppose that for HoleFoods, we have a term list named Teams that is defined as follows:
Here is a simple query that uses this term list:
SELECT Lookup("Teams",Outlet.Boston.Properties("NAME")) ON ROWS FROM HOLEFOODS
Lookup                              Red Sox
Here is a more complex query:
SELECT Lookup("Teams",Outlet.CURRENTMEMBER.Properties("NAME"),"No Team") ON 0, ON 1 FROM HOLEFOODS
 1 Amsterdam                        No Team
 2 Antwerp                          No Team
 3 Atlanta                           Braves
 4 Bangalore                        No Team
 5 Barcelona                        No Team
 6 Beijing                          No Team
 7 Berlin                           No Team
 8 Boston                           Red Sox
 9 Brasilia                         No Team
See Also

Send us comments on this page
Copyright © 1997-2019 InterSystems Corporation, Cambridge, MA