cancel
Showing results for 
Search instead for 
Did you mean: 

SORT BY DATE ASCENDING ORDER

Former Member
0 Kudos

Hi experts,

please provide me the suggestions

Scenario: File to Idoc

PFB,  is the incoming file format: i need to put condition for dataprevisa, where date should come in ascending order and in this incoming file having 10 months data will be present  i need to fetch only last month data.

And each numero line should create each idoc at target side.

if dataprevisa "date" = dataentrega"date" have to create idoc.

if dataprevisa "date" != dataentrega"date" have to create idoc.

if dataprevisa " " = dataentrega" " should not create idoc.

Have to Implement in graphical mapping.

<?xml version="1.0" ?>

<transportadora="27/09/2016 10:30">

<notasfiscais>

<origem="1234567889">

<numero="5407" dataprevisa="30/09/2016" dataentrega="30/09/2016" localizacao="data" />

<numero="5401" dataprevisa="29/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="28/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="27/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="26/09/2016" dataentrega="" localizacao="" />

</origem>

<origem="123456785689">

<numero="5407" dataprevisa="26/09/2016" dataentrega="25/09/2016" localizacao="data" />

<numero="5401" dataprevisa="24/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="25/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="15/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="13/09/2016" dataentrega="" localizacao="" />

</origem>

Thanks and Regards,

Abhilash.

Accepted Solutions (0)

Answers (2)

Answers (2)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Abhilash,

Some comments:


if dataprevisa "date" = dataentrega"date" have to create idoc.

if dataprevisa "date" != dataentrega"date" have to create idoc.

if dataprevisa " " = dataentrega" " should not create idoc.

Just use if dataprevisa != "" AND dataentrega != "" in the xpath of your receiver determination.


Have to Implement in graphical mapping.

This requires multi-mapping, which PI version do you have?

Regards,

Mark

former_member190293
Active Contributor
0 Kudos

Hi Abhilash!

Wouldn't you provide correct XML structure first?

In your current example I can't see elements, only attributes inside XML tags.

Regards, Evgeniy.

Former Member
0 Kudos

hi Evgeniy kolmakov,

no elements only attributes.

structure I have given is correct.

former_member194786
Active Contributor
0 Kudos

Hi Abhilash,

This is not a valid XML, as has already pointed out above. If this is the format of file that you receive, you wouldn't be able to use Message mapping to parse this. You can check if the XML payload is valid by copying it in any XML tool and validating the structure.


Having said that, if you really need to process the data from this file, I guess only option would be to write a Java mapping and do string parsing in it.


Regards,

Sanjeev.

former_member190293
Active Contributor
0 Kudos

Hi Abhilash!

I guess, it's not. You have closing tag </origem> in your structure, for example, but there is no opening tag for it, just the empty name element with attribute <origem="1234567889">.

Regards, Evgeniy.

Former Member
0 Kudos

sorry it ends with

</notasfiscais></transportadora>

former_member190293
Active Contributor
0 Kudos

Once again: your document is incorrect. While trying to validate it:

Element type "transportadora" must be followed by either attribute specifications, ">" or "/>".

Opening tag for transportadora doesn't contain element name. With your current syntax it contains only attribute transportadora="27/09/2016 10:30".

And in closing tag transportadora is an element name.

Regards, Evgeniy.

Former Member
0 Kudos

this is the correct  XML

<?xml version="1.0" ?>

<transportadora="27/09/2016 10:30">

<notasfiscais>

<origem="1234567889">

<numero="5407" dataprevisa="30/09/2016" dataentrega="30/09/2016" localizacao="data" />

<numero="5401" dataprevisa="29/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="28/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="27/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="26/09/2016" dataentrega="" localizacao="" />

</origem>

<origem="123456785689">

<numero="5407" dataprevisa="26/09/2016" dataentrega="25/09/2016" localizacao="data" />

<numero="5401" dataprevisa="24/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="25/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="15/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="13/09/2016" dataentrega="" localizacao="" />

</origem>

</notasfiscais>

</transportadora>

Former Member
0 Kudos

thsi si the correct xml

<?xml version="1.0" ?>

<transportadora dthratualizacao="27/09/2016 10:30">

<notasfiscais>

<origem="1234567889">

<numero="5407" dataprevisa="30/09/2016" dataentrega="30/09/2016" localizacao="data" />

<numero="5401" dataprevisa="29/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="28/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="27/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="26/09/2016" dataentrega="" localizacao="" />

</origem>

<origem="123456785689">

<numero="5407" dataprevisa="26/09/2016" dataentrega="25/09/2016" localizacao="data" />

<numero="5401" dataprevisa="24/09/2016" dataentrega="27/09/2016" localizacao="data" />

<numero="5400" dataprevisa="25/09/2016" dataentrega="28/09/2016" localizacao="" />

<numero="5399" dataprevisa="15/09/2016" dataentrega="" localizacao="" />

<numero="5403" dataprevisa="13/09/2016" dataentrega="" localizacao="" />

</origem>

</notasfiscais>

</transportadora>