cancel
Showing results for 
Search instead for 
Did you mean: 

Time calculation Rules on Mapping

Former Member
0 Kudos

Hi,

Could you please suggest me here as i need to map based on these below conditions.

PICKUP_TIME -


>EarliestTime

conditions are:

IF PICKUP_TIME is not equal to 00:00:00 then read value from: PICKUP_TIME and reduce this by 30 min.

Please give me the solution as i need ASAP.

Thanks & Regards,

Y.Raj.

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Malini Balasubramaniam,

As i has used the UDF for Ritu Sinha's (the another blog) and i tested...looks its fine.

But, when i check your code it seems like a Generic where am using this same UDF and i let you know once i test the same code which you have provided here and as well as i could close this blog.

Thanks for your help and valuable response to me.

Regards,

Y.Raj.

Former Member
0 Kudos

Hi yeshwant,

I have jst checked the pickuptime. To check with the dekley_time

use if else bool function and use substring to extract from pos 6 to 13 in else part.

Former Member
0 Kudos

Hi,

Thank you all contributors here and especially Mrs. Malini..

Regards,

Y.Raj.

Former Member
0 Kudos

Hi,

Create a UDF where you capture the pickup time and check these conditions.

Else, u need to use standard functions and reduce your pickup time -30 .

Check for standard mathematical functios or accomplish it in UDF.

Regards,

Krish

Former Member
0 Kudos

>>IF PICKUP_TIME is not equal to 00:00:00 then read value from: PICKUP_TIME and reduce this by 30 min.

what does mean by >>reduce this by 30 min.

You mean, reduce the time by 30min (that is coming in PICKUP_TIME) and map it to target field EarliestTime?

thanks

farooq

Former Member
0 Kudos

Hi Farooq,

Here am giving you the IDOC field names which i need to map to Receiver and the conditions are,

Source Fields (Time)

PICKUP_TIME

DELKEY_TEXT_WE

Target Field(Date/Time)

EarliestTime

Conditon is : IF PICKUP_TIME is not equal to 00:00:00 then Read value from: PICKUP_TIME and reduce this by 30 min. and place the result into: EarliestTime. Else

if map value from DELKEY_TEXT_WE pos. 6 until 13 into: EarliestTime.

This is the condition i need to check in Mapping.

Could you please suggest me how can i manage this.

Thanks & Regards,

Y.Raj.

Edited by: YeswanthRaj Kumar on Sep 19, 2008 8:14 AM

Former Member
0 Kudos

Hi,

try using the following mapping

pickup_time -------\
                  equalsS-->not--->if --->earliest time
Constant[00.00.00]---/             then<----UDF<----pickup_time

Under imports use java.util.*;java.text.*;

public String time_cal(String a,Container container)
{
long sec = (long)1000.0 * 30 * 60;
String parts[] = a.split(":");
long sec1 =(long) ((Integer.parseInt(parts[0]) * 3600 * 1000.0) + (Integer.parseInt(parts[1]) * 60 * 1000.0) + (Integer.parseInt(parts[2]) * 1000.0));
long second = sec1 - sec;
DateFormat time = new SimpleDateFormat("HH:mm:ss");
java.util.Date today = new java.util.Date(second);
String result = time.format(today);
return result;
}

Edited by: malini balasubramaniam on Sep 19, 2008 3:34 PM