Situation:
I am trying to map one field to multiple fields. I tried to use the "substring" function, but that will not work because the string being parse as varying length. However, the string as a common delimiter (.)
example:
Location = WV.L2.D3.F1.0
|
- Loc1 = WV
- Loc2 = L2
- Loc3 = D3
- Loc4 = F1
This would be easy if the Location data is a fixed length and pattern
but Location could be any of these pattern below
WV.L2.D3.F1.0
WV.GB11.7.0.0
SV.ARM2.SHV4.0.Y
Strategy:
You can use the tokenize function
-
Create a local variable "var1" on the target field like "Loc1" in which use the below function:
str:tokenize($Input_SourceSchema/Root/Record/Location,'.')[1]
-
Map this local variable "var1" to the target field "Loc1" using the textual rule.
-
Similarly create another local variable "var2" on the second target field like "Loc2" in which use the below function:
str:tokenize($Input_SourceSchema/Root/Record/Location,'.')[2]
-
Map this local variable "var2" to the target field "Loc2" using the textual rule.
You can follow the above steps for other target fields as well.
Note:
If you are using Adeptia v6.1 and above, you will need to change your XSL Transformer
- Change the XSL transformer from Saxon to Xalan(Actions>>XSL Transformer)
Comments
1 comment
If the number of values in the field is variable, you can use a WHEN CONDITION on the target fields to check if that value exists in the source field
Ex:
WHEN {tokenize($Input_SourceSchema/Root/Record/Location,'.')[2] = null} VALUE=[""] OTHERWISE VALUE=[.]
Article is closed for comments.