cancel
Showing results for 
Search instead for 
Did you mean: 

UDF - Get Value Node

rhviana
Active Contributor
0 Kudos

Hi ExpertALL,

I need support, check the source and target structures.

Source structure below:

Target structure:

As you can see the structure "item" it´s unbound, means repeat many times, inside <item> there is a tag <TYPE> that´s cointains two values "S" or "E".

Check the part of request XML below:


<T_RETURN>

     <item>

          <TYPE>S</TYPE>

          <MESSAGE>Lote baixado com sucesso !!!</MESSAGE>

          <MESSAGE_V1>AC13033621</MESSAGE_V1>

     <SYSTEM/>

   </item>

   <item>

          <TYPE>E</TYPE>

         <MESSAGE>ERROR!</MESSAGE>

          <MESSAGE_V1>AC13033622</MESSAGE_V1>

</item>

   <item>

          <TYPE>S</TYPE>

         <MESSAGE>Lote baixado com sucesso !!!</MESSAGE>

          <MESSAGE_V1>AC13033623</MESSAGE_V1>

</item>

   <item>

          <TYPE>E</TYPE>

         <MESSAGE>ERROR!</MESSAGE>

          <MESSAGE_V1>AC13033624</MESSAGE_V1>

</item>

</T_RETURN>

What I need to do, when the value of tag <TYPE> only once comes with value "E", I need insert value "1" into tag <ERROR> in response structure.

If contains only "S" leave <ERROR>blank</ERROR>

Like this exemple below:


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

<ns1:MT_OUTPUT xmlns:ns1="zurn:greefa.fischer">

   <E_EMAIL>xpto@teste.com</E_EMAIL>

   <RESPOSTA>

      <TYPE>S</TYPE>

      <MESSAGE_V1>AC13033621</MESSAGE_V1>

   </RESPOSTA>

   <RESPOSTA>

      <TYPE>E</TYPE>

      <MESSAGE_V1>AC13033622</MESSAGE_V1>

   </RESPOSTA>

   <RESPOSTA>

      <TYPE>S</TYPE>

      <MESSAGE_V1>AC13033623</MESSAGE_V1>

   </RESPOSTA>

   <RESPOSTA>

      <TYPE>S</TYPE>

      <MESSAGE_V1>AC13033624</MESSAGE_V1>

   </RESPOSTA>

   <ERROR>1</ERROR>

</ns1:MT_OUTPUT>

Suggestions ?

Kind regards,

Ricardo Viana.

Accepted Solutions (1)

Accepted Solutions (1)

former_member184720
Active Contributor
0 Kudos

Hi Ricardo - Did you try

Type -> remove context -> sort(ascending)-> equalS(E) -> if without else(1) -> target

Former Member
0 Kudos

Hi ,

I think you need to make small change in the above logic (Not 100% sure ,don't have PI system in front of me).

Type -> remove context -> sort(ascending)->splibyvalue(valuechange)-->collapsecontext--> equalS(E) -> if without else(1) -> target

rhviana
Active Contributor
0 Kudos

Hareesh,

Thanks, that´s perfect and works here.

Kind regards,

former_member184720
Active Contributor
0 Kudos

The only difference would be it avoids multiple checks as you got collapse context.. but as the target occurrence is 0..1 it always returns the first occurrence so not an issue..

Answers (1)

Answers (1)

Harish
Active Contributor
0 Kudos

Hi Viana,

you can try the below logic in message mapping



regards,

Harish