Hello Giridhar,
Find the below details it migh help you to resolve your issue.
Input Data:
<Root> <Record> <D1>03/10/2017</D1> <F1>KK1</F1> <F2>PP1</F2> <F3>TT1</F3> </Record> <Record> <D1>02/10/2017</D1> <F1>KK2</F1> <F2>PP2</F2> <F3>TT2</F3> </Record> <Record> <D1>02/10/2017</D1> <F1>KK3</F1> <F2>PP3</F2> <F3>TT3</F3> </Record> </Root>
Mapping Details:
Output Data:
<?xml version="1.0" encoding="UTF-8"?> <Root> <Item> <O1>02/10/2017</O1> <O2>KK2</O2> <O3>PP2_TT2</O3> </Item> <Item> <O1>02/10/2017</O1> <O2>KK3</O2> <O3>PP3_TT3</O3> </Item> </Root>
Regards,
Sriprasad Shivaram Bhat
Hello Giridhar,
I am assuming you want to filter out records at mapping level and to achieve the same create a Custom Function & map it to record level to send only yesterdays data.
Mapping Snapshot:
Custom Function:
import com.sap.it.api.mapping.*; import java.util.HashMap; import java.text.DateFormat; import java.text.SimpleDateFormat; import java.util.Date; //Add MappingContext as an additional argument to read or set Headers and properties. def String customFunc(String arg1){ Calendar cal = Calendar.getInstance(); DateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy"); cal.add(Calendar.DATE, -1); def y_date=dateFormat.format(cal.getTime()) y_date=y_date.toString() if ( arg1 == y_date) return "true" else return "false" }
Regards,
Sriprasad Shivaram Bhat
Hello Giridhar,
Could you please share input XML payload to mapping and expected output payload.
Regards,
Sriprasad Shivaram Bhat
Dear Sriprasad,
Thanks for providing the solution with the Custom Function. Do i need to pass any date field for D1 as per the screenshot which you have provided or can i pass the header element?
Regards
Giridhar Vegi.
Dear Prasad,
i have mapped as you said . but i am not getting any records after mapping.
Hello Giridhar,
You have to pass the date( dd//mm/yyyy format ) to custom function.
Regards,
Sriprasad Shivaram Bhat
Dear prasad ,
i have tried as you said but i am getting only one record i.e. only clock in record for a single date.i am not getting all records for a single date.
Regards
Giridhar Vegi.
Hi SriPrasad,
How to check the date not equal to null condition for transferring the date format(From yyyy-MM-dd to dd-MM-yyyy or any other). I am using standard functionality like stringequals and NOT with ifs-else; but i am getting error like:
Error Details com.sap.xi.mapping.camel.XiMappingException: com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception during processing target field mapping /Data_Target/DateOfHire. The root message is: Unparseable date: "false", cause: java.text.ParseException: Unparseable date: "false" Please give me some input on this. Even i tried using XSLT. That time i am getting the below error:Error Details ValidationException: Invalid dateTime value "04/01/1994" (Non-numeric year component)<DateOfHire> <xsl:if test="DateOfHire!=''"><xsl:value-of select="format-dateTime(DateOfHire,'[D01]/[M01]/[Y0001]')"/></xsl:if> </DateOfHire>Hi SriPrasad,
How to check the date not equal to null condition for transferring the date format(From yyyy-MM-dd to dd-MM-yyyy or any other). I am using standard functionality like stringequals and NOT with ifs-else; but i am getting error like:
Error Details com.sap.xi.mapping.camel.XiMappingException: com.sap.aii.mappingtool.tf7.MessageMappingException: Runtime exception during processing target field mapping /Data_Target/DateOfHire. The root message is: Unparseable date: "false", cause: java.text.ParseException: Unparseable date: "false" Please give me some input on this. Even i tried using XSLT. That time i am getting the below error:Error Details ValidationException: Invalid dateTime value "04/01/1994" (Non-numeric year component)<DateOfHire> <xsl:if test="DateOfHire!=''"><xsl:value-of select="format-dateTime(DateOfHire,'[D01]/[M01]/[Y0001]')"/></xsl:if> </DateOfHire>
Add comment