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

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Is there any unique row number generator

Hi all,
I want to load the data from dimension tables to fact table. In this case i have to load the unique row number in fact table . Its like as a sequence generator in ETL- Inofrmatica . How can i do ? plz expecting ur reply
thanks
guru
Labels (2)
7 Replies
Anonymous
Not applicable
Author

There is the tAddSequence component in the Misc category. It adds a unique row number at the and of the flow. Give that a try.
alevy
Specialist
Specialist

That's not a standard component. In tMap, you can have a field populated with Numeric.sequence("<sequence name>",<seed value>,<increment step>).
_AnonymousUser
Specialist III
Specialist III

how can i keep track of highest sequence value from my previous job execution?
i don't want to start the sequence to start from min value each time on each job execution.
Anonymous
Not applicable
Author

If you have a Database SEQUENCE for example it exist in ORACLE you can reuse the Oracle Sequence using the Additional Columns fucntion of the Advanced TAB of your DatabaseOutput component.
You name the COLUMN where you want to put the SEQUENCE; you use the Position Replace; and then you use the proper expression in the SQL expression (for example my_seq.nextval).
Another scenario would be to have a connector that RETRIEVE your SEQ first; then you assign the VALUE to a a Context variable and you start from there a Talend sequence using the routine Numeric.sequence.
There is so many ways for doing it.
Which one are you looking forward; the one which stick with the DB; or the one which is less DB activity consuming etc...
Best regards.
_AnonymousUser
Specialist III
Specialist III

Hi cantoine,
i could run my job successfully when i had Oracle Table as my final table.
how can i achieve same results if i want to write into a delimited file.
i dont want to use second approach mentioned in your previous reply.
thank you for your quick response.
Anonymous
Not applicable
Author

If I understand you want to Incremental a SEQUENCE to store in a FILE, right ?
This sequence value is coming from an Oracle Table, right ?
The only way of doing it is to call the current SEQUENCE VALUE from a tOracleInput at the begining of your JOB; and then use this value as a ContextVariable to start your Numeric.Sequence routine in your tMap; then this values will be written in your FILES.
In the meantime if you need to refresh the Sequence at the end of your PROCESS; you will have to call a tOracleROW and perform the query to update your SEQUENCE value with the current Numeric.Sequence or do a + File_NUMBER_OF_ROWS from the Global Variable.
Hope it helps.
_AnonymousUser
Specialist III
Specialist III

cantoine,
thank you for your guidance. i created my job as per the design. Also i used below sql in tOracleRow componenent to have the sequence recreated in DB after completion of my processing logic.

"begin
execute immediate 'drop sequence customer_ID';
execute immediate 'CREATE SEQUENCE customer_ID
START WITH "+ Integer.valueOf(Integer.parseInt((String)globalMap.get("currVal"))) +"
MAXVALUE 999999999999999999999999999
MINVALUE 1
NOCYCLE
CACHE 20
NOORDER';
end;
"