Skip to Content
0
Former Member
Jun 16, 2015 at 06:38 AM

Java mapping: Coding to pick the latest values from multiple records.

14 Views

Hi All,

I have a requirement where I need to pick the latest values from multiple records based on rundate.

The I/P is like this :

<Message>

<ID>1234</ID>

<Name>Raj</Name>

<Name_Date>20150512</Name_Date>\

<SSN>1298</SSN>

<SSN_Date>20150618</SSN_Date>

</Message>

..

<Message>

<ID>1234</ID>

<Name>Ajay</Name>

<Name_Date>20150516</Name_Date>

<SSN>2156</SSN>

<SSN_Date>20150614</SSN_Date>

</Message>


The Output should be:

<Message>

<ID>1234</ID>

<Name>Ajay</Name>

<Name_Date>20150516</Name_Date>\

<SSN>1298</SSN>

<SSN_Date>20150618</SSN_Date>

</Message>


So the logic is that the value of the field should be closest to the RunDate(current date).


Please let me know your feedback on how this requirement can be achieved ?