on 12-08-2014 12:14 PM
Hi Experts,
Can any one help me on my requirement. Which is as follows.
Sender Structure :-
Target Structure :- (IDOC)
Based on the dates which received from Source side to the TYPE field at target side I need to update that date and time.
EX:- If I get the value CreationDate, At the target I need to get CreationDate and its date and time
<CreationDate>
01/12/2014 13:00:05
</CreationDate>
OR
If I get the calue DocumentDate then I need to get map DocumentDate date and time
<DocumentDate>
02/12/2014 13:00:05
</DocumentDate>
For this Which fields I receive I have to get those values at the target as shown in the examples. Here YDATE is a different list at ECC and those values store in Tables.
Can you please help me out how to map.
Will appricate for your inputs in advance.
Thanks
G V Anil
Dear venkat,
I will suggest UDF . It will be easy n simple
try to write once else let us know , we will provide the udf.
Warm Regards,
Rudra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Here take field2 field3 field4 and field 5 as per your fields....
here I have taken field3 and field 4 first
1) First I am checking field4 is exists if it exists then I am sending the value of field4 else
again I am checking the field3 is existing then I am taking the value of field3. In else I am assiging the value of field 3 to else....
2) Now I am taking the field 2 and field 5 values
First I am checking field5 is exists if it exists then I am sending the value of field5 else
again I am checking the field2 is existing then I am taking the value of field2. In else I am assiging the value of field 2 to else...
Now I taken the conditions from field3, field4 and field5 and field2 again same rule I applied for these 2 things......
from this step I will get the value of one field of all the 4 fields...which one is existing.....
then that value I am doing Datetrans function from that I am doing conversion then Finally I am getting the value EX: 02/12/2014 13:00:05
Then next I am taken substring 0,10 assign that to date
and again I more substring from 11 to 8 assign that field to time...
Thanks,
Sreenivas
Hi Anil,
Hope you are looking for the same result.
Please use the below UDFs for Type, Date ,time . Please modify udf according your values
For Type
public String calculate(String CreationDate, String DocumentDate, String BaseLineDate, String DueDate, String ReversalDate, Container container) throws StreamTransformationException{
String A= "";
if (CreationDate !="")
{
A="CreationDate";
}
else if (DocumentDate !="")
{
A="DocumentDate";
}
else if(BaseLineDate !="")
{
A="BaseLineDate";
}
else if(DueDate!="")
{
A="DueDate";
}
else if(ReversalDate!="")
{
A="ReversalDate";
}
else
{
A="NotValid";
}
return A;
}
*********************************************************************
For Date
String A= "";
if (CreationDate !="")
{
A=CreationDate.substring(0,10);
}
else if (DocumentDate !="")
{
A=DocumentDate.substring(0,10);
}
else if(BaseLineDate !="")
{
A=BaseLineDate.substring(0,10);
}
else if(DueDate!="")
{
A=DueDate.substring(0,10);
}
else if(ReversalDate!="")
{
A=ReversalDate.substring(0,10);
}
else
{
A="NotValid";
}
return A;
***************************************************************
For Time
String A= "";
if (CreationDate !="")
{
A=CreationDate.substring(11,19);
}
else if (DocumentDate !="")
{
A=DocumentDate.substring(11,19);
}
else if(BaseLineDate !="")
{
A=BaseLineDate.substring(11,19);
}
else if(DueDate!="")
{
A=DueDate.substring(11,19);
}
else if(ReversalDate!="")
{
A=ReversalDate.substring(11,19);
}
else
{
A="NotValid";
}
return A;
Hi,
there are 3 udfs.... given by rudra...
For type field use the Type UDF and Date use Date UDF and Time use time UDF.
use these methods in all the 3 UDFs
public String calculate(String CreationDate, String DocumentDate, String BaseLineDate, String DueDate, String ReversalDate, Container container) throws
Thanks,
Sreenivas
Dear Venkat,
One UDF will give you only one return value . how can you map that value to each field.
All threee udf are quite similar nothing to worry about them .
this is the way to use udf .. we are taking 5 input fields and one output. check how to create simple udf in pi
Give the arguments name same as the dates I have given . It will work .
Warm Regards,
Rudra
Hi Azhar, Rudra,Sreenivas, Sneha,
Thanks All for your time and solution's which really healped me lot to learn new thing and solving my problem.
I implimented Sreenivas rply (If you get all the dates at a time in the payload then you can do the duplicate subtree in the target and do the mapping for individual ones). As this solution meets my requirement. And other solutions might be helpful for me in future. Thanks once again...!!!
Thanks
G V Anil
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Anil,
1. I have used a single UDF instead of 3, that returns the TYPE, Date and Time in "TYPE|DateTime" format.
2. The output of this UDF is being mapped to a Graphical variable (V_Date).
3. Then I'm using Substring function and passing the values to the three fields, TYPE, DATE, and TIME, as shown in the screenshots..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
You can achieve this using Graphical Mapping (if-then-else) , Substring, Date Tran... functions as follows:
Assuming your ECC date format is YYYYMMDD and Time is : HH:mm:ss (please check the format that you need in target system and according convert it in Mapping using Date Trans function)
Regards,
Azhar
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I assume that only one of these dates (CreationDate/DocumentDate/BaseLineDate/DueDate/ReversalDate) will be coming in your source payload ?
Just extend the MM that I shared above. Add similar logic for BaseLineDate/DueDate/ReversalDate ( you will need to add 3 more If-then-else to achieve the required results)
Regards,
Azhar
Hi,
Seems you are very new to PI n graphical mapping world...Welcome!
Just drag an output link (from Creation Date field to Length input function)...same Source field (CreationDate can be used as input for multiple other functions) and this is supported in 7.0 as well....and same is the case with Substring...
The mapping screenshot that I shared should suffice your requirement. Give it a try and try to test for 2 date fields initially as I have shown in Screenshot (once it works, you can add rest of the date logic for other date fields too)..will be good hands on n learning for you
Regards,
Azhar
Hi Azhar,
Thanks for your comment , But when I'm trying in my system its not accepting both at a time, if I'm mapping to Concat then the length mapping is automatically getting removed, vice versa.
Is there will be any setting to do that are can you show tel me how to do.
Thanks for understanding and inputs
Thanks
G V Anil
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.