Using Mapping Functions
You can map source and target schema elements using the various mapping functions built-in the Data Mapper. All these mapping functions comprise of sub-functions, which are used to map elements.
Some mapping functions require use of constant values for mapping elements. For this, you need to add the constant node to the Mapping Graph Area.
Adding a Constant
Steps to add a Constant
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
Right-click the blank space in the Mapping Graph Area and select the Constants option. A Constant node is displayed in the Mapping Graph Area.
Double-click the Constant node. The Input dialog box is displayed.
- Enter the desired constant value in the Constant Value field.
Mark the Add Quotes checkbox as checked, if you want to define the constant as a string. Else, the constant is defined as numeric data. By default, this checkbox is unchecked, implying that a constant is defined as a number. However, you can change the constant to string data type by checking this checkbox anytime.
If the constant is defined as a string data type, then Appose trophy (‘) symbol is supported. Additionally, you can enter constants as an input for Select query too.
You can also define an element name as a constant, and leave the Add Quotes checkbox as unchecked. This will generate a valid XSL.
- Click OK. This displays the entered value in the Constant node in the Mapping Graph Area.
Using Math Function
The Math mapping function enables you to map elements by performing simple mathematic operations. It comprises of various sub-functions, which are listed in the table below.
Table 12: Sub-Functions of Math Mapping Function
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
Math
| Add | Adds two numeric elements. | (10) + (5)returns 15 |
Ceiling | Rounds a passed number to the smallest integer that is greater than or equal to the passed number. | Ceiling(33.9)returns 34 | |
Division | Divides two numeric elements. | (100) div(5) returns 20 | |
Floor | Rounds a passed number to the largest integer that is not larger than the passed number. | floor(33.9)returns 33 | |
Mod | Returns the remainder of a division between two numeric values. | (50) mod(3) returns 2 | |
Multiply | Multiplies two numeric elements. | (10) * (5)returns 50 | |
Round | Rounds a passed number to the nearest integer. | round(4.6)returns 5 | |
Subtract | Subtracts one numeric value from other. | (10) – (5)returns 5 | |
Number | Converts parameter to a number. | number("-17.3")returns -17.3 | |
Format number | Transforms input data into a specific format. By default it rounds off the value by considering only the digits before the decimal point. You may, however, specify the number of decimal places to be considered by increasing the count of hashes (#), it rounds off the last digit defined after decimal point, see corresponding example. The specific format allowed is decimal. This function can be used only if the target node is of string data type. | format-number(12.5746, '#.###')returns 12.575 |
You can use the required sub-function of Math mapping function to map elements. The process of using the Math function is the same for all its sub-functions. Thus, the mapping process using one sub-function is outlined below.
Steps to map elements using the 'Division' Math Mapping Function
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
- You need to add a constant value for using this function. Once it is added, a Constant node with its value is displayed in Mapping Graph Area.
Click Math function menu and select the Division sub-function. A div node is displayed in the Mapping Graph Area.
- Create a link from the output of the Source element to the first input of the div node.
- Create a link from the output of Constant node to the second input of the div node.
Create a link from the output of the div function node to the Target element.
- Click Apply Mapping ( ) button. This maps elements using the div sub-function. A line is displayed between the source and target panels showing the mapping of the source element to the target element.
Using String Function
The String mapping function enables you to map elements by manipulating strings. It comprises of various sub-functions, which are listed in the table below.
Table 13 : Sub-Functions of String Mapping Function
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
String
| Concat | Concatenates the second string after the first string. | concat ('Jane', 'Brown') |
Substring | Returns the sub string from the string starting from the specified position and of the specified length. When using this function, you always start counting its position from 1. This implies that the second argument (position) is always greater than or equal to 1. | substring ('abcdef' ,3, 4) | |
String | Returns the string value of the argument. | string ('1000') returns the string 1000 | |
Translate | Translates each occurrence of the first argument in the specified string to the second argument. Both the arguments must consist of one or equal number of characters. | translate ('alphabet', 'a','t') | |
Substring-after | Returns the string after the specified argument from the string. | substring-after('print=yes', '=') returns yes | |
Substring-before | Returns the string before the specified argument from the string. | substring-before('print=yes', '=') returns print | |
Starts-with | Returns true if the string starts with the specified argument or false otherwise. | starts-with ('Sales', 'S') | |
String-length | Returns the length of the specified string. | string-length('adeptia') | |
Contains | Returns true if the string contains the specified argument or false otherwise. | contains ('adeptia', 'tia') | |
Normalize-space | Removes leading and trailing white space (space, tab and new line) from a string, and replaces internal sequences of white space with a single space character. | normalize-space (' Adeptia Inc ' ) returns Adeptia Inc | |
Name | Returns the name of the source node and field name on which mapping is currently done. | If the context node is an element named<ms:schema>, then | |
Local-name | Returns name with the name prefix. If no prefix was specified, then name and local name are same. | If context node is an element named<ms:schema>, then |
You can use the required sub-function of String mapping function to map elements. The process of using the String function is the same for all its sub-functions. Thus, the mapping process using one sub-function is outlined below.
Steps to map elements using the 'Concat' String Mapping Function
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
You need to load two source elements for using this mapping function.
- Create a link from the output of the first Source element to the first input of the concat node.
- Create a link from the output of the second Source element to the second input of the concat node.
Create a link from the output of the concat node to input of the target element node.
- Click the Apply Mapping ( ) button. This maps elements using the concat sub-function. A line is displayed between the source and target panels showing the mapping of the source element to the target element.
Using Date Function
The Date mapping function enables you to map elements by generating dates in specific formats. It also returns the current date and the difference between two dates. It comprises of various sub-functions, which are listed in the table below.
Table 14: Sub-Functions of Date Mapping Function
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
Date | Date-Format | This is a customized mapping function. | date-format (employee/ 1998-03-31, 'yyyy-MM-dd', 'dd-MM-yyyy') |
| Date -Difference | Generates the | date-difference('12-08-2006','dd-MM-yyyy','12-08-2005', 'dd-MM-yyyy') |
| Current Date | Returns the current system date in Month-day-year format. | current date ('MM-dd-yyyy') |
You can use the required sub-function of Date mapping function to map elements. The process of using the Date function is the same for all its sub-functions. Thus, the mapping process using one sub-function is outlined below.
Steps to map elements using the 'Date-Difference' Date Mapping Function
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
You need to add a constant value for using this function. Once it is added, a Constant node with its value is displayed in Mapping Graph Area.
This function requires four inputs. The first input represents the value of Date1. The second input represents the value as the format of Date1. The third input represents the value as Date2. The fourth input represents the value as format of Date2. The Date1 and Date2 values can either be in the form of constants or XPath values. The formats of Date1 and Date2 are however always in the form of constants.
Click Date mapping function and select Date-Difference sub-function. A date-difference node is displayed in the Mapping Graph Area.
- Create a link from the output of the first constant value to the first input of the date-difference node.
- Create a link from the output of the second constant value to the second input of the date-difference node.
- Create a link from the output of the third constant value to the third input of the date-difference node.
- Create a link from the output of the fourth constant value to the fourth input of the date-difference node.
Create a link from the output of the date-difference node to input of the target element node.
- Click the Apply Mapping ( ) button. This maps elements by generating the difference between Date1 and Date2 using the date-difference sub-function.
Using Aggregation Functions
The Aggregation function enables you to map elements by aggregating or counting the values of all nodes in an element. It comprises of various sub-functions, which are listed in the table below.
Table 15: Sub-Functions of Aggregation Mapping Function
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
Aggregation | Sum | Returns total of all values under all nodes of the specified element. | Sum (Age) returns the sum of all Age elements under the specified node. |
| Count | Returns the total number of nodes for the specified element. | Count (Age) returns the total number of records under the Age element. |
| Position | Returns the position of the current context node in the specified element. | position() returns 1 for the first node, 2 for second node and so on. |
| Key | Returns matched records using two parameters: | Refer to the Using Key Function section. |
You can use the required sub-function of Aggregation mapping function to map elements. The process of using the Aggregation function is the same for all its sub-functions. Thus, the mapping process using one sub- function is outlined below.
Steps to map elements using the 'Sum' Aggregation Mapping Function
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
Click Aggregation function and select the Sum sub-function. A Sum node is displayed in the Mapping Graph Area.
- Create a link from the output of the Source element to the input of the Sum node.
Create a link from the output of the Sum function node to the Target element.
- Click the Apply Mapping ( ) button. This maps elements using the Sum sub-function. A line is displayed between the source and target panels showing the mapping of the source element to the target element.
Using Conditional Function
The Conditional mapping function enables you to map elements by building conditional expressions. It comprises of various sub-functions, which are listed in the table below.
Table 16: Sub-Functions of Conditional Mapping Function
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
Conditional | IF Conditions | This function comprises of two sub functions: | |
| For Filtering Records | Filters the records/elements on basis of the specified condition. Note: If filtering is applied at the parent record, IFF condition filters the records on the basis of given condition, and ignores the 'Value'. If you apply a condition at the child of parent, it returns the 'Value', given that IFF condition gets satisfied. | IFF CONDITION {Age=25} Value= [100] |
| For Mapping To Elements | Returns a value if the specified condition is true. | IF CONDITION {Age=25} Value= [100] |
| When Condition | Returns a particular value if the specified condition is true, else it returns another value. | WHEN Condition {contains (Email_ID, '@')} Value= [100] Otherwise Value= [200] |
| Select Query | This is a customized mapping function. | SELECT FIELD = [Value1] FROM DB.TAB = [Value2].[Value3] WHERE {Condition} SELECT FIELD = [EMPNO] FROM DB.TAB = [oracle_databaseserver].[EMP] WHERE {[ENAME= 'Smith'] AND [AGE = 28]} |
| Sequence | This is a customized mapping function. | Sequence {10, 20} |
| Append | This is a customized mapping function. | Append ('IF CONDITION {condition} Value [Value1]', ('IF CONDITION {condition} Value [Value2]' |
Some conditional sub-functions are not included in the Data Mapper screen, but are implemented by extending the 'IF' and 'When' conditions declared in Table 13.14 These sub-functions are listed in Table 13.15.
Table 17: Conditional Functions ('If' and 'When')
Mapping Function | Sub-Functions | Description | Example |
---|---|---|---|
IF Condition | Nested IF | Contains IF condition inside the value of previous IF condition. | IF CONDITION {Age=25} Value= [IF CONDITION {#Designation= 'Manager'} Value = IF CONDITION {Salary= 20000} Value = [100]]] |
When Condition | Nested When | Contains When condition inside the value of previous When condition. |
|
IF and When Condition | IF and When conditions return Boolean | Returns value based on the function used as whether the condition returns True or False. |
|
IF and When Condition | Mixed | Contains IF condition inside the value part of When condition or vice versa. | WHEN CONDITION {/employees/employee/Salary=50000} Value= IF CONDITION {/employees/employee/Designation= Project Manager} Value = ['100'] OTHERWISE Value = ['200'] |
IF Condition | Multiple IF | Contains IF conditions placed sequentially, with each IF having its value part. | IF CONDITION {Age=25} Value= ['500'] IF CONDITION {Designation= 'Manager'} Value = [1000] |
When Condition | When condition with more than one conditions in it. | Contains When condition containing logical operators like and/not to make multiple conditions inside the When condition. | WHEN CONDITION {/employees/employee/Age=25 and /employees/employee/Designation=Manager} Value= ['100'] OTHERWISE Value = ['200'] |
IF Condition | IF condition with more than one conditions in it. | Contains IF condition containing logical operators like and/not to make multiple conditions inside the IF condition. | IF CONDITION {/employees/employee/Age=25 and /employees/employee/Designation=Manager} Value= ['100'] |
You can use the required sub-function of Conditional mapping function to map elements. The process of using the Conditional function is the same for all its sub-functions. Thus, the mapping process using one sub-function is outlined below.
Steps to map elements using the 'IF' Condition (IF CONDITION {} VALUE=[]) Conditional Mapping Function
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Ensure that the source and target elements to be mapped are selected and displayed in the Mapping Graph Area.
- Click Boolean function menu and then select the >=Greater than Equal operator. A >= node is displayed in the Mapping Graph Area.
To learn more about Boolean Functions, refer to the section Using Boolean Functions.
- Add a constant value in the Mapping Graph Area.
- Create a link from the output of the source element to the first input of the >= operator node.
Create a link from the output of the Constant node to the second input of the >= operator node.
Create Links between Nodes for Mapping Elements using Greater Than Equal To Function
Click Conditional mapping function and select IF CONDITION sub-function. Further select For Mapping to Elements option. An IF CONDITION node is displayed in the Mapping Graph Area.
- Create a link from the output of the >= operator element to the first input of the IF CONDITION node.
- Add a constant value of integer type (for example, 25) in the Mapping Graph Area.
- Create a link from the output of the Constant element to the second input of the IF CONDITION node.
- Create a link from the output of the IF CONDITION node to the input of the target element node.
If the value of SALARY element in the source data is greater than or equal to 5000, output will be 3000. If the value of TESTCASENO element in the source data is less than 100, output will be an empty tag.
Click Apply Mapping ( ) button. This maps elements using IF CONDITION function. A line is displayed between source and target panels showing the mapping of the source element to the target element.
This function simply filters the records based on the specified Boolean condition, but it does not create a data stream of the filtered records. You need to explicitly create the filtered data stream by creating another mapping (or adding same output schema in Target Panel) and using the IFF CONDITION () function based on the opposite Boolean condition.
Using Axis Function
The Axis function contains a list of advance XSL functions that are used to map elements only when the For Each function is applied on the Target node. It comprises of various sub-functions, which are listed in the table below.
Table 18: Sub-Functions of Axis Mapping FunctionMapping Function
Sub-Functions
Description
Example
Axis
File Path – XPath
This is a customized mapping function.
This is an XML Lookup which returns the value of the element/attribute within the XML file whose path is specified. The File path and XPath must be specified in single quotes.FilePath ['C:/correct_file.xml'] XPath {'/employees/employee/Name'}
Returns value of Name element from the file correct_file.xml.Self
Returns the element which is the context node itself.
Self::Employee
Returns Employee which is the context node itself.Child
Returns the element which is the child of the context node.
Child::Name
Returns Name which is a child of the context node.Parent
Returns the element, which is the parent (if any) of the context node.
Parent::Name
Returns Name which is a parent of the context node.Following-sibling
This axis contains all the following siblings of the context node. It returns the first occurrence of the element/attribute in the next sibling of the context node. If the context node is an attribute node or namespace node, then this axis is empty.
following-sibling: employee/Name
Returns the first occurrence of Name in the next employee node.Ancestor
Returns the element which is the ancestor of the context node. This axis always includes the root node, unless the context node is the root node.
Ancestor::Name
Returns Name which is an ancestor of the context node.Ancestor-or-self
This axis contains the context node and the ancestors of the context node. It always includes the root node. It returns the context node or ancestors of the context node.
ancestor-or-self::employees/@val
Returns context node or ancestors of context node.Preceding-sibling
This axis contains all the preceding siblings of the context node. It returns the first occurrence of the element/attribute in the preceding sibling of the context node. If the context node is an attribute node or namespace node, then this axis is empty.
preceding-sibling: employee/Name
Returns the first occurrence of Name in the previous employee node.Descendant
Returns the element which is the descendant of the context node. This axis does not contain attribute nodes.
descendant::Name
Returns Name, which is a descendant of the context node.Descendant-or-self
This axis contains the context node and the descendants of the context node. It returns the context node or descendants of the context node.
descendant-or-self::employees/salary
Returns context node or descendants of context node.Generate-id
Generates a unique id for the element/attribute specified by the XPath argument.
generate-id (employees/employee/Name)
Returns unique ID for Name elementCurrent
Removes all tags from the specified xml file and returns the data.
current()
Returns data of the xml file without tags.
You can use the required sub-function of Axis mapping function to map elements. The process of using the Axis function is the same for all its sub-functions.Using Boolean Function
The Boolean mapping function enables you to map elements by applying various logical operators in building Boolean expressions. It comprises of various sub-functions, which are listed in the table below.
Table 19: Sub-Functions of Boolean Mapping FunctionMapping Function
Sub-Functions
Description
Example
Boolean
Equal
Returns TRUE the first variable argument is equal to the second variable argument.
(5) = (5)returns true
Not Equal
Returns TRUE the first variable argument is not equal to the second variable argument.
(5) != (50)returns true
Greater Than
Returns TRUE the first variable argument is greater than the second variable argument.
(5)> (3)returns true
Less Than
Returns TRUE the first variable argument is less than the second variable argument.
(5) < (8)returns true
Greater than Equal
Returns TRUE the first variable argument is greater than or equal to the second variable argument.
(5)>= (5)returns true
(5)>= (3)returns trueLess than Equal
Returns TRUE the first variable argument is less than or equal to the second variable argument.
(5) <= (8)returns true
(5) <= (5)returns trueOr
Returns TRUE if either of the two variable arguments evaluate to TRUE otherwise FALSE. These variable arguments can only be of Boolean data type. Hence, their value can either be TRUE or FALSE only.
(True) Or (True) returns true
(True) Or (False)returns trueAnd
Returns TRUE if both of the two variable arguments evaluate to TRUE otherwise FALSE. These variable arguments can only be of Boolean data type. Hence, their value can either be TRUE or FALSE only.
(True) And (True) returns true
(True) And (False)returns false
A Boolean sub-function is always used in conjunction with a Conditional function. Thus for the process of using the Boolean function, refer to Steps to map elements using the IF Conditional Mapping Function.Using Context Functions
The Context mapping function enables you to map elements by setting or getting value of process flow context variables. It comprises of various sub-functions, which are listed in the table below.
Table 20: Sub-Functions of Context Mapping FunctionMapping Function
Sub-Functions
Description
Example
Context
Set-Context
This is a customized mapping function.
Sets the value of the specified variable argument in the process flow context. This value can be string constant, numeric constant, XPath or output of limited set of mapping function, which can be used before set-context function.
This function does not return a value. If mapped to a target element, it creates an empty tag of that target element in output XML.
set-context ('index', '123')
sets the value of index variable as 123 in the process flow.Get-Context
This is a customized mapping function.
Returns the value of the specified variable argument from process flow Context. This value can be string constant, numeric constant, XPath or output of limited set of mapping function. If no value has been set, then the value specified in the second argument is returned.get-context ('index', '100')
Returns the value of index variable from the process flow. If no value has been set for index, then 100 is returned.
In get-context function you can also use any variable, which is not declared. In such case get-context creates a variable with the specified name and value, which can be further used with the selected target element. This can be done only in Textual Rule panel.
You can use the Set-Context sub-function of Context mapping function to set value of the process flow variable and send it to the Process Designer. The Get-Context sub-function is used to return the value of the process flow variable.Using Set-Context Function
You can use the Set-Context Function in various ways. These are outlined as:
Mapping Set-Context function using local variable
Concept
You can map the Set-Context function to a local variable, when you want to set the value of process flow context variable based on output of a mapping function or condition. You can pass the output of mapping function or condition to a local variable and use that local variable as value of set-context function.
For example, if you want to set the value of process flow context variable based on the output of WHEN condition. The WHEN condition is used to return "True" when value of a source element "SALARY" is greater than 8000, else it will return "False". The output of WHEN condition is mapped to a local variable "BolSalary8K". To set the value of "BolSalary8K" to the process flow context variable, you can use Set-Context function. You have to create another local variable "Var1", where value of process flow context variable "ContextVar" is set using Set-Context function. This is done by mapping Set-Context to the value part of the local variable "Var1". The first argument of the Set-Context function is the name of the process flow context variable "ContextVar" and second argument is the local variable "BolSalary8K", which contains the output of WHEN condition.
Advantages
- Need not be mapped to a target element
- Local variable can be used as second argument of Set-Context function
- XPath of a source element can be used as second argument of Set-Context function
- Set-Context function is executed for each record of the source data
Disadvantages
- Local Variable used to map set-context function will have an empty value.
Map Set-Context Function using Local Variable
Steps to pass output of mapping function or condition to a local variable
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Click Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
- Click the Local Variables tab. The Local Variable pane is displayed.
- Click any target element to declare the local variable in the Local Variable pane.
- Click Local Variable Name text field and enter the name of the local variable you want to create (e.g. BolSalary8K). Press the Tab or Enter key. This takes the control to the Local Variable Value field.
Enter the value of the local variable in the Local Variable Value field. In this example, you have to specify the WHEN condition as displayed in the figure below.
- Click the Save Local Variable ( ) button to save the declared local variable.
Steps to map Set-Context function using local variable
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Click the Node tab displayed in the Mapping Graph Area. All tabs of the Node tab are displayed.
- Click the Local Variables tab. The Local Variable pane is displayed.
- Click any target element to declare the local variable in the Local Variable pane.
- Click Local Variable Name text field and enter the name of the local variable you want to create (e.g. Var1). Press the Tab or Enter key. This takes the control to the Local Variable Value field.
- Click Context mapping function menu and select Set-Context sub-function. Syntax for Set-Context function is displayed in Local Variable Value field.
- Enter the process flow variable name you want to create (e.g. ContextVar) in the first argument of the Set-Context function.
Enter the value of the variable in the second argument of the Set-Context function.
Second argument can be string constant, integer constant, XPath, local variable or output of limited set of mapping function, which can be used before Set-Context function. In this example, BolSalary8K variable is used as second argument of set-context function.
Mapping Set-Context to Local Variable- Click Save Local Variable ( ) button to save the declared local variable.
Global Declaration of Set-Context Function
Concept
Another way of using the Set-Context function is to declare it globally. When doing this, you need not map it to a target element or local variable.
Advantages
- Easy to use
- Need not be mapped to a target element
- Need not create any local variable
Disadvantages
- Local variable cannot be used in value part of Set-Context function
- If XPath of a source path is used, Set-Context function is executed for the first record only.
Declare Set-Context Function Globally
Steps to declare Set-Context function globally
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Click the Global tab displayed in the Mapping Graph Area. All tabs of the Global tab are displayed.
Click the Context Variables tab. The Context Variables pane is displayed.
Context Variables Pane
- Click the Context Variable Name text field and enter the name of process flow context variable you want to create (e.g. Var1) Press the Tab or Enter key. This takes the control to the Context Variable Value field.
Enter the value of process flow context variable in the Context Variable Value field.
- Click the Save Context Variable ( ) button to save the declared process flow context variable. This context variable is added to the list of existing context variables in the Context Variables tab. It is also displayed under Context Variables in the Parameters Panel. If you shift focus to another node, or click any of the Mapping Rules, Textual Rules, Node, Properties, XSL or Debugger tabs, without saving the context variable, an alert message is displayed.
Click No to save the context variable and shift focus to the other object. If you click Yes, then the defined context variable is cleared and the focus is shifted to the other object.
You can also set the value of a context variable that is used in a particular condition. For example, if the context variable Var1 is used in an IFF condition in such a way the value of Var1 depends on the condition being True or False. If it is True then Var1 will have a different value. You can set this value of Var1 if the condition is True, using the Set Context function.
Similarly, you can retrieve the value of a context variable used in a particular condition, if the condition is True.
You can edit or delete a context variable from the Parameters Panel itself. For details, refer to the Managing a Global Variable from Parameter Panel section.
Mapping Set-Context function to any target element
Concept
You can map the Set-Context function to a target element. Since this function does not return a value, it will create an empty tag of that target element in output XML. Thus, it is recommended that you should map the Set-Context function to a target element, whose value is not required at the target end.Advantages
- Need not to create any local variable
- Executed for each record
Disadvantages
- Need an additional target element, whose value is not required at the target end
Map Set-Context Function to a Target Element
Steps to map Set-Context function to a target element
- Ensure that the source and target schemas are loaded and all their elements are listed under their respective nodes.
- Select the target element that you want to map with Set-Context function.
Click Context mapping function menu and select Set-Context sub-function. A set-context node is displayed in the Mapping Graph Area.
- Add a constant node with the name of variable (e.g. index), whose value is to be set in the process flow context.
- Create a link from the output of the constant node (index) to the first input of the set-context node.
Add another constant node for the second argument (e.g. 100) of the set-context function.
The second argument can be a string constant, integer constant, XPath, local variable or output of a limited set of the mapping function, which can be used before Set-Context function.
- Create a link from the output of second constant node (100) to the second input of the set-context node.
Create a link from the output of the set-context node to the target element.
- Click the Apply Mapping ( ) button. This maps the Set-Context function to the target element. The defined variable (index) is passed to the process flow with the value 100. If you shift focus to another node, or click any of the Mapping Rules, Textual Rules, Node, Properties, XSL or Debugger tab, without applying the mapping, an alert message is displayed (refer to Figure 522).
Click No to apply the mapping and shift focus to the other object. If you click Yes, then the mapping activity is cleared and is replaced by the previous mapping in the Mapping Graph Area and the focus is shifted to the other object.
At times the mapping is too large and the applet memory may exceed 256M. In such cases, the mapping will fail and return an error of insufficient memory. You can overcome this situation by increasing the applet memory. For details, refer to Appendix A of the Administrator Guide.