Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
HI ALL;
i want to create column with au to incrrement depend from ID key
ACCOUNTID and ACCOUNTID+1 have same ACCOUNTNUmber
exemple :
ACCOUNTID ACCOUNTNUmber
1 002-00000001
2 002-00000002
3 002-00000003
i want to have this :
ACCOUNTID ACCOUNTNUmber
1 002-00000001
2 002-00000001
3 002-00000002
4 002-00000002
5 002-00000003
6 002-00000003
i put screen frothe job and the table i need .
Thank you .
Tkank you @uganesh
I find a solution that i change the name of string in sequence at new sequence .
(out2.CUAccountID%2)==0 ?
((""+(1000 +NUMERIC_S_LONG.LongSequence("s2",001L, 1))).substring(1,4) ) +"-"+
((""+(100000000 +NUMERIC_S_LONG.LongSequence("s3", 00000001L, 1) ) ).substring(1,9)):
((""+(1000 +NUMERIC_S_LONG.LongSequence("s4",001L, 1))).substring(1,4) ) +"-"+
((""+(100000000 +NUMERIC_S_LONG.LongSequence("s5", 00000001L, 1))).substring(1,9))
/*NUMERIC_S_LONG.LongSequence("s1",001L, 1)) :CUAccountID*/
result
1 001-00000001
2 001-00000001
3 002-00000002
4 002-00000002
Best regards
Your requirement not very clear. why do you want to duplicate the accountnumber in output?
Anyways , if you would like to duplicate , One of the solution is as below
(Assuming your input is already sorted by AccountId)
duplicate record using tunite ( use same input two times to unite) -- tsortrow ( sort on AccountId asc)
1 002-00000001
1 002-00000001
2 002-00000002
2 002-00000002
3 002-00000003
3 002-00000003
Now, add additional column ( seq-id) using tMap/tJavaRow
1 1 002-00000001
1 2 002-00000001
2 3 002-00000002
2 4 002-00000002
3 5 002-00000003
3 6 002-00000003
Drop 1st Column
Thank you ;
i duplicate AccountNumber cause it s type string in output and i want to have at this format "001-00000001".
*AccountId type Long
i try with tunite but i can't .can you help me how to use tunite and tjava row .
Regards
Hechmi
Hello Another simple way to do the same
Connect your input to tMap as Main. Create a Lookup having two rows and do cross-Join. Refer below screen shot.
Result
[statistics] connecting to socket on port 3449
[statistics] connected
1|002-00000001
2|002-00000001
3|002-00000002
4|002-00000002
5|002-00000003
6|002-00000003
[statistics] disconnected
Thank you for your answer @uganesh
I try with your idea but in have different result you can see screen attach .
can you give me where the problem ?
In tMap , do not join id column to dummy. If you will join , result will not be duplicated.
You do not need two parallel flow at the starts and tJoin. One flow itself would be enough as shown in previous screenshot.
Tkank you @uganesh
I find a solution that i change the name of string in sequence at new sequence .
(out2.CUAccountID%2)==0 ?
((""+(1000 +NUMERIC_S_LONG.LongSequence("s2",001L, 1))).substring(1,4) ) +"-"+
((""+(100000000 +NUMERIC_S_LONG.LongSequence("s3", 00000001L, 1) ) ).substring(1,9)):
((""+(1000 +NUMERIC_S_LONG.LongSequence("s4",001L, 1))).substring(1,4) ) +"-"+
((""+(100000000 +NUMERIC_S_LONG.LongSequence("s5", 00000001L, 1))).substring(1,9))
/*NUMERIC_S_LONG.LongSequence("s1",001L, 1)) :CUAccountID*/
result
1 001-00000001
2 001-00000001
3 002-00000002
4 002-00000002
Best regards