cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for sorting date

Former Member
0 Kudos

Hi Guys,

I am doing scenario File to Idoc, i have to sort date in acending order, the date format will be in either 22.10.2007 or 22/10/2007 . can any one send UDF for this.

Regards,

venu gopal

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hey Venu,

No need to use any UDF for this, just use dateTrans function under DATE and first make it like 24102007 in your mapping and then use sort (use Number) function to sort it then again convert it into your desired need by using dateTrans function.

Regards,

Sarvesh

Former Member
0 Kudos

Hi Venu

You can execute this without UDF. Use " Transform" function in the Date functions.

When you are using the UDF....you keep the strucure as "yyyMMddhhmmss" for that clickon Trnasform function and there you can see ShowAdvancedProperties...there u can find the format of the source which you are expecting and also change the strucutre of you target expected format.

You please try this and check the mapping it will get execute.

Use Standard Date Function DATATRANS. It have the property for format and input is the source date field. It will convert the date format to required specified format which you menstion in the DARTATRANS function

for UDF

Thanks!

Former Member
0 Kudos

hi Veni

See the blow code for sorting the date. But if u give me exact dataType of sender and receicver i can send u exact UDF's

public void sortDate(){

List dateList = new ArrayList();

Date date = new Date("25/10/2007");

dateList.add(date);

date = new Date("3/9/2007");

dateList.add(date);

date = new Date("27/10/2007");

dateList.add(date);

Collections.sort(dateList);

for (Iterator iter = dateList.iterator(); iter.hasNext();) {

Date element = (Date) iter.next();

System.out.println(element);

}

}

<b>Award point if helpful</b>

nisarkhan_n
Active Contributor
0 Kudos

use the SORT function in the Mapping.....hope this helps

Former Member
0 Kudos

hi Nisar Khan,

it will not work if date is in he format 10.04.2007

Former Member
0 Kudos

hi venu,

you can format the date using DATETRANS and try sorting it

regards

Ramesh P

nisarkhan_n
Active Contributor
0 Kudos

sorry venu...