Sample Query
The macro in the sample query below uses the
runLocale session variable as the Language_lookup parameter map key
and returns the corresponding language code. The sq() function specifies
that the return value of the macro be enclosed in single quotation
marks to produce a valid SQL filter predicate. In the following Select
statement, where German is the language, the macro identifies the
language as DE (German), and product the filter (PRODUCT_MULTILINGUAL."LANGUAGE"
= 'DE').
Select P.INTRODUCTION_DATE, P.PRODUCT_TYPE_CODE, P.PRODUCTION_COST, P.MARGIN, PRODUCT_LOOKUP.PRODUCT_NUMBER as PRODUCT_NUMBER1, PRODUCT_LOOKUP."PRODUCT_LANGUAGE", PRODUCT_LOOKUP.PRODUCT_NAME, PRODUCT_LOOKUP.PRODUCT_DESCRIPTION From gosales].PRODUCT as P, [gosales].PRODUCT_LOOKUP Where P.PRODUCT_NUMBER = PRODUCT_LOOKUP.PRODUCT_NUMBER and (PRODUCT_LOOKUP."PRODUCT_LANGUAGE" = #sq($Language_lookup{$runLocale})#)