Former Member

### Question mapping

Hi all,

I want to compare different value of a node with occurrence 1..n.

I need to put into value1 the integer with the max value of the n nodes.

For example:

I have this structure:

<MAIN>

<NODE>

<value1></value1>

</NODE>

</MAIN>

In my case, i recieved this file:

<MAIN>

<NODE>

<value1>1</value1>

</NODE>

<NODE>

<value1>2</value1>

</NODE>

<NODE>

<value1>3</value1>

</NODE>

</MAIN>

Exist any form (in JAVA or UDF wiithout ccBPM & PBM ) to compare elements of different nodes (node ocurrence 0 [value 1] with node with ocurrence 1  [value 2])?

The solution should be:

<MAIN>

<NODE>

<value1>3</value1>

</NODE>

</MAIN>

Thanks.

Regards.

10|10000 characters needed characters exceeded

Former Member
Jun 16, 2014 at 03:44 PM

Hi Alvaro,

Try below logic ,

Value1 (Source) -> Remove Context -> Sort - > UDF -> Value1 (Target)

UDF Logic :

get last value from the Queue.

Thanks

Hari.

10|10000 characters needed characters exceeded
• Former Member
Jun 17, 2014 at 05:29 AM

Hi,

You can try like this:

Define the SORT order as descending.

BR,

Anirban

10|10000 characters needed characters exceeded
• Jun 16, 2014 at 02:05 PM

Hi Alvaro,

If the tags to compare are going to be always the same you can use the standard function copyValue. Check this documentation: copyValue (SAP Library - SAP Exchange Infrastructure) Example here: Standard Functions in PI 7.0 - Process Integration - SCN Wiki

When you get the values you can compare them  with the equalS function.

Regards.

10|10000 characters needed characters exceeded
• Former Member
Jun 17, 2014 at 10:12 AM

Hi all,

The problem with this scenario has been resolved.

Aditional i need to do apply a similar concept in the next scenario:

Source structure:

Tarhet structure:

I recieved this file:

And the actual result is:

I need the next transformation in target system:

I have tried to develop a Java function and context resultt but don't know like do it.

Any idea?

Thanks.

Regards.

10|10000 characters needed characters exceeded
• Former Member Mark Dihiansan

HI,

Yes, the logic is that one Error 20 can have more than one Error 21.

The Error 21 should be grouped for each error 20 to which it belong. (The logic to identify this, should be observed when a new error occurs 20)

For example, if i recieved this xml:

<?xml version="1.0" encoding="UTF-8"?>

<ns0:MT_Error_process xmlns:ns0="http:/127.0.0.1/source">

<Recordset>

<CABECERA>

<M>0</M>

</CABECERA>

<ERRORES>

<Tipo_Registro>0</Tipo_Registro>

<Num_Registro_Fichero_Recibido_con_Error/>

<Contenido_del_registro_erroneo>Error 20</Contenido_del_registro_erroneo>

<Tipo_Registro_Target/>

<Num_Registro_Fichero_Recibido_con_Error_Target/>

<Contenido_del_registro_erroneo_Target/>

</ERRORES>

<ERRORES>

<Tipo_Registro>1</Tipo_Registro>

<Num_Registro_Fichero_Recibido_con_Error/>

<Contenido_del_registro_erroneo>Error 21</Contenido_del_registro_erroneo>

<Tipo_Registro_Target/>

<Num_Registro_Fichero_Recibido_con_Error_Target/>

<Contenido_del_registro_erroneo_Target/>

</ERRORES>

<ERRORES>

<Tipo_Registro>1</Tipo_Registro>

<Num_Registro_Fichero_Recibido_con_Error/>

<Contenido_del_registro_erroneo>Error 20</Contenido_del_registro_erroneo>

<Tipo_Registro_Target/>

<Num_Registro_Fichero_Recibido_con_Error_Target/>

<Contenido_del_registro_erroneo_Target/>

</ERRORES>

<ERRORES>

<Tipo_Registro>0</Tipo_Registro>

<Num_Registro_Fichero_Recibido_con_Error/>

<Contenido_del_registro_erroneo>Error 21</Contenido_del_registro_erroneo>

<Tipo_Registro_Target/>

<Num_Registro_Fichero_Recibido_con_Error_Target/>

<Contenido_del_registro_erroneo_Target/>

</ERRORES>

<FIN>

<X/>

<Y/>

</FIN>

</Recordset>

</ns0:MT_Error_process>

The result should be:

<?xml version="1.0" encoding="UTF-8"?>

<ns1:EnviarRespuestaProdcontrol xmlns:ns1="http://127.0.0.1/RespuestaProdControlIncidencias.asmx">

<ns1:respuesta>

<ns1:Cabecera>

<ns1:Tipo_interfaz>M</ns1:Tipo_interfaz>

</ns1:Cabecera>

<ns1:Incidencias>

<ns1:RespuestaProdcontrolIncidencias>

<ns1:Codigo_incidencia>Error 20</ns1:Codigo_incidencia>

<ns1:Descripcion_incidencias>Error 21</ns1:Descripcion_incidencias>

</ns1:RespuestaProdcontrolIncidencias>

<ns1:RespuestaProdcontrolIncidencias>

<ns1:Codigo_incidencia>Error 20 Error 21</ns1:Codigo_incidencia>

<ns1:Descripcion_incidencias/>

</ns1:RespuestaProdcontrolIncidencias>

</ns1:Incidencias>

</ns1:respuesta>

</ns1:EnviarRespuestaProdcontrol>

Exist any way to do that?

Thanks again.

Regards.