cancel
Showing results for 
Search instead for 
Did you mean: 

mapping Issue

former_member223432
Participant
0 Kudos

Hi Experts,

I am having a weird requirement...file to JDBC...

I need to pass timestamp from a from my incoming file and concatenating with 2 digit sequence number and pass it to my target field..now the catch here is the 2 digit sequence number depends on the the number of time the source field (ordernum) appears in file...

means: timestamp + if 6 different order num then i should have..

20120216 + 01 = 2012021601

20120216 + 02 = 2012021602

20120216 + 03 = 2012021603

20120216 + 04 = 2012021604

20120216 + 05 = 2012021604

20120216 + 06 = 2012021606

getting a timestamp from incoming file in WORKING fine..i am only facing an issue in gettin this 2 digit seq num based on the number of time the field is coming..

is it possible?

please provide your valuable suggestion

regards

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Ravi Kanth suggested a decent solution (without using any udf) go with that....and use "Index" function (under statistic)

former_member181962
Active Contributor
0 Kudos

Hi,

You can use IndexOf and formatNumber functions

ORDERNUMBER -> IndexOf ->FormatNumber(00)->remove contexts-> <Concatenate this value with time stamp>

Best Regards,

Ravi

Former Member
0 Kudos

execution type: all values of a context

input: a,b

mapping:

order----

-


UDF----


TARGET

timestamp---



String output=""; 
int seq =0;
for (int i=0;i<a.length;i++)
{
seq = seq + 1;
output = b[0] + "0" + seq ;
result.addValue(output);  
}


former_member184681
Active Contributor
0 Kudos

Hi,

This will be easy with a simple UDF, with Execution Type "All Values of Context/Queue" (depending on precise requirement):

int counter = 0;
for (int i = 0; i < input.length; i++){
   if (input<i> == ResultList.CC) result.addValue(input<i>);
   else {
      result.addValue(input<i>.concat(String.format("%02d", ++counter)));
   }
}

Hope this helps,

Greg