Decode
Lookup a descriptive value by given code using XX/1 lookup tables.
var strDesc = Decode(strTable, strCode [,strAlternative]);
Parameters
- strTable : [in] String, name of XX/1 lookup table.
- strCode : [in] String, code for which the description/value is to be retrieved. The parameter must not contain brackets.
- strAlternative : [in] String, value that is returned, if code is not found in the lookup table. This parameter is optional. If this parameter is not specified and code is not found null is returned. The parameter must not contain brackets.
Return Values
String containing the value for code or null or content of 3rd parameter, if not found .
Example: "Miami International, FL, US"
Remarks
This function performs well also on large size tables.
Example
JavaScript:
- Returns "Miami International, FL, US":
var strDesc = Decode("Airports","MIA");
- Returns null, because XXX is not found in the lookup table:
var strDesc = Decode("Airports","XXX");
- Returns "Miami Airport", because XXX is not found in the lookup table:
var strDesc = Decode("Airports","XXX","Miami Airport");
XSLT:
<AirportName>
<xsl:value-of select="concat('!func:Decode(Airports,',DestCode,',',translate(DestName,'()','[]'),')')"/>
</AirportName>