Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
hechmi
Contributor III
Contributor III

how seq_long create

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

 002-00000001
2   002-00000002
3   002-00000003
i want to have this :

ACCOUNTID ACCOUNTNUmber

 002-00000001
 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 .

Labels (2)
1 Solution

Accepted Solutions
hechmi
Contributor III
Contributor III
Author

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  

View solution in original post

8 Replies
akumar2301
Specialist II
Specialist II

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)

 002-00000001

 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

 

 

 

hechmi
Contributor III
Contributor III
Author

Thank you ;
i duplicate AccountNumber cause it s type string in output .
*AccountId type Long
itry with tunite but i can t .can you help me hw to use tunite and tjava row .
Regards
Hechmi
hechmi
Contributor III
Contributor III
Author

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

akumar2301
Specialist II
Specialist II

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.

 

0683p000009M2cv.jpg

 

0683p000009M2tp.jpg

 

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

hechmi
Contributor III
Contributor III
Author

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 ?

 


job.JPG
result.JPG
tmap.JPG
akumar2301
Specialist II
Specialist II

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.

hechmi
Contributor III
Contributor III
Author

thank you  @uganesh 

I try with this job but i don't have result 

you can see it ,what is the problem 

|account_number|AccountID|name

001-00000002 |1 |teste|
|003-00000004 |2 |teste|  account number different ?
|005-00000006 |3 |teste|
|007-00000008 |4 |teste| 

 

best regards


tmap2.JPG
hechmi
Contributor III
Contributor III
Author

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