Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Business Processes and Rules: Siebel eBusiness Application Integration Volume IV > Data Mapping Using Scripts > EAI Value Maps >
EAIGetValueMap unmappedKeyHandler Argument
The unmappedKeyHandler provides a flexible mechanism for handling cases where keys are not found in the EAI Value Map. In most situations, you can use literal values for defaults or you can use one of several predefined handler functions. However, you can also provide your own handler function.
The technique you use for handling unmapped values depends on the data being mapped.
Typical strategies include:
- Use the empty string as the translation.
This is the default strategy. It clears the field if the data is being imported into your Siebel application. To follow this approach, omit the unmappedKeyHandler argument or pass it as an empty string. For example:
var langMap = EAIGetValueMap("SAP Language","Siebel Inbound","");
This example looks up a nonexistent language code and returns an empty string. For example:
var translatedValue= langMap.Translate ("ABC");
// returns an empty string- Use
null
as the translation.This technique makes the result unspecified rather than empty. For data imported to Siebel applications, this keeps the existing value from being overridden when performing updates. Use
null
as the unmappedKeyHandler—for example:
var langMap = EAIGetValueMap("SAP Language","Siebel Inbound", null);
- Use a literal string as the translation.
Specify the string as the unmappedKeyHandler. For example:
var langMap = EAIGetValueMap("SAP Language","Siebel Inbound", "Unknown Language");
- Raise an error.
This may be the best strategy if the Value Map should contain mappings for every key. You can use the EAIValueMap_NoEntry_RaiseError function. For example:
var langMap = EAIGetValueMap ("SAP Language", "Siebel Inbound", EAIValueMap_NoEntry_RaiseError);
- Use the untranslated value.
The predefined function EAIValueMap_NoEntry_ReturnLookupKey implements this strategy. For example:
var langMap = EAIGetValueMap ("SAP Language", "Siebel Inbound", EAIValueMap_NoEntry_ReturnLookupKey);
Trying to look up a nonexistent language code (for example, ABC) will return the original key. For example:
var translatedValue = langMap.Translate ("ABC"); // returns "ABC"
You can also write a custom handler function. You need to write a function taking three arguments: key, type, and direction. The value your function returns is used as the translation. For example:
function MyUnmappedLangHandler (key, type, direction)
{
return ("Unknown Language: " + key);
}
var langMap = EAIGetValueMap ("SAP Language", "Siebel Inbound", MyUnmappedLangHandler);
// Lookup a nonexistent language code.
var translatedValue = langMap.Translate ("ABC"); // returns "Unknown Language: ABC"
Bookshelf Home | Contents | Index | Search | PDF | ![]() ![]() ![]() ![]() |
Business Processes and Rules: Siebel eBusiness Application Integration Volume IV Published: 18 April 2003 |