on 02-16-2012 3:38 PM
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
Ravi Kanth suggested a decent solution (without using any udf) go with that....and use "Index" function (under statistic)
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 use IndexOf and formatNumber functions
ORDERNUMBER -> IndexOf ->FormatNumber(00)->remove contexts-> <Concatenate this value with time stamp>
Best Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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);
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
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.