cancel
Showing results for 
Search instead for 
Did you mean: 

Message Mapping, First and last values in a CSV file

Former Member
0 Kudos

I'm having problems with a Message Mapping that requires me to take the values from the first line in a CSV and the last line to calculate other values...

The source message type in my mapping is as follow

<MT_Message>
    <Header>                  1..1
         <ID>
         <StartDate>
         <EndDate>
   <Records>                 1...unbounded
           <Interval> 
           <Number>

I need to take the first row/occurence of Records and use this to calculate the Startime. I also need to take the last occurence of Records to calculate the stop time

This is my CSV file content

H	FORECASTS 	20080101	20081231	17568
D	20080101	1	1	66.29283
D	20080101	1	2	61.1344
D	20080101	2	1	61.1344

In this case I need to take the values 1 1 for the StartTime and 2 1 for the StopTime.

How can this be done?

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Damien,

Do u have problem with mapping or content conversion. According to my understanding the problem is with content coversion. U can't take the first and last values in CSV file. Probably u can import all the values and during mapping u can seggregate the required structure alone.

Best regards,

raj.

Answers (3)

Answers (3)

Former Member
0 Kudos

To solves this I removed the context and sorted the queue as the last value in the file will always be the latest Date and Time.

This isn't a solution to your problem but it worked for me!

Former Member
0 Kudos

Thanks for your help. I imported the contents into an array and used the last values in the array

Former Member
0 Kudos

hi ,

Can you tell me , how you import the csv into an array and used the last values in the array

thanks

nelson

ravi_raman2
Active Contributor
0 Kudos

Damien,

Yes you can do this, use a java program to slurp the entire file in then sort it using string comparators`s...let me know if you need further details.

Regards

Ravi Raman