Requirement:-
There is a need to develop a Data Mapping to transform from "IFTMIND95B" to "COPARN99A" format. In this mapping there is a need to access last "NAD+LP" segments from more than one repetitions.
For example, for this file:-
CTA+IC+:SANCHEZ, ESTER'
NAD+MR++TRANS LANIET.SL.::J.J.DOMINE, 18-2C:46011 VALENCIA+VAT-ID ?: ESB96674858'
NAD+LP++APM VLC::EDIFICIO APM TERMINALS:46024 VALENCIA:SPAIN+VAT-ID ?: ESA96763206'
NAD+DP++MICOTEC:ALMACEN II:CALLE BALSA 15:02246 NAVAS DE JORQUERA:SPAIN'
NAD+LP++MICOTEC:ALMACEN II:CALLE BALSA 15:02246 NAVAS DE JORQUERA:SPAIN'
NAD+DP++MICOTEC:ALMACEN I:CTRA VILLAGARCIA DEL LLANO 7D:16220 QUINTANAR DEL REY:SPAIN'
NAD+LP++MICOTEC:ALMACEN I:CTRA VILLAGARCIA DEL LLANO 7D:16220 QUINTANAR DEL REY:SPAIN'
NAD+CR++INTERC RIBARRO, IRIB::RONDA PUERTO DE VALENCIA, 19-B:46190 RIBARROJA DE TURIA:SPAIN+VAT-ID ?: ESA46182978'
DOC+914:::EU-AIS+20ES00081171234711'
The output should be
NAD+LP++MICOTEC:ALMACEN I:CTRA VILLAGARCIA DEL LLANO 7D:16220 QUINTANAR DEL REY:SPAIN'
Solution:-
Follow the below approach to resolve this issue:-
1. Firstly, use the for-each rule on the target node as below. This will result in all the occurrence of the LP data:-
$Input_DEV_HAP_ESC_IFTMIND95B/EDIRoot/TS_IFTMIN/Loop11_NAD/NAD[NAD01 = 'LP']
2. After this, on NAD (or any Node as per the use case) under Loop3_NAD, apply the below rule:-
IFF CONDITION{position() = last() } VALUE=[True]
This will result in the last occurrence of LP. Map the other element as per your requirement.
This is basic functionality of last function in mapping, modify the things as per the requirement.
Comments
0 comments
Article is closed for comments.