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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

create a auto-increment column

Hi,
I don't know which component I should use to add auto-increment column that does not exist in the source table. actually I'm trying to extract some columns from a postgreSQL input and meantime trying to add an autoincrement column which i want to turn into primary key in the output table.I've been trying with Tmap but in vain...for example :
(from postgreSQL input -----> Tmap ------------> postgreSQL output)
postgreSQL input
_____________________________
TASK_NAME | TASK_DESCRIPTION
-----------------------------------------
ADD | add_client_op
-----------------------------------------
CHNG | change_client_ref
----------------------------------------
and I wish to have as a result in the output db
___________________________________________
PK_DIM_TASK | TASK_NAME | TESK_DESCRIPTION
------------------------------------------------------------
1 |ADD | add_client_op
------------------------------------------------------------
2 |CHNG | change_client_ref
-----------------------------------------------------------
any help please? I'd be so grateful.
fantom
Labels (2)
3 Replies
Anonymous
Not applicable
Author

Hi Fantom
You might simply add a new column in Out1 of tMap.
Type Numeric.sequence("s1",1,1) in the expression field of this column.
Regards,
Pedro
Anonymous
Not applicable
Author

Hi pedro,
thanks a lot for your help, it worked, and actually the mistake I've been doing is that I was trying to write something like altering the table to add a column then turn it into primary key I didn't mention the 'sequence' in Numeric from the categories (does the same work)
I'm so grateful.
best regards.
Anonymous
Not applicable
Author

Just want to comment one more important notes:

- Change the Variable to Int (because by default, it is String)

- Change the destination auto increase column to Int also