global variable for number of records in tMSSQLRow?

One Star

global variable for number of records in tMSSQLRow?

There is a global variable called "NB_LINE" for tMSSQLInput, is there one for (the "recordset" returned by) tMSSQLRow? It really can loop the "recordset" to find the number of rows since the "recordset" is defined as FORWARD_ONLY internally, not sure if it can be overriden.
Community Manager

Re: global variable for number of records in tMSSQLRow?

There is no a global variable NB_LIN is available on tMSSQLRow, if the component returns a recordset, you need to link it to a tParseRecordSet for parsing the recordset, and there is a global variable NB_LIN is available on tParseRecordSet. You can find an example job in user manual.
https://help.talend.com/pages/viewpage.action?pageId=13798574#Raa48944
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: global variable for number of records in tMSSQLRow?

The issue I am running into is when the SQL returns no result, the process flow stops after tParseRecordSet, I am wondering how I can catch this "empty row" exception and keep the process flow going
Community Manager

Re: global variable for number of records in tMSSQLRow?

The issue I am running into is when the SQL returns no result, the process flow stops after tParseRecordSet, I am wondering how I can catch this "empty row" exception and keep the process flow going

Move this processing to a child job, and use a tRunjob to call it, and uncheck the 'die on error' option on tRunJob, the parent job will continue to work even though the child job has an 'empty row' exception.
The job design looks like:
parent job:
other processing
|
onsubjobok
|
tRunJob
|
onsubjobok
|
other processing
child job:
tMSSQLRow--main--tParseRecordSet--tLogRow
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: global variable for number of records in tMSSQLRow?

I need to catch this "empty row" scenario to perform proper processing.
Basically, after executing the query, it needs to perform one processing logic if it returns rows, another processing logic if it returns 0 rows, not just simply keeping the whole flow going.
One Star

Re: global variable for number of records in tMSSQLRow?

had the same problem. solution at the end of this post http://www.talendforge.org/forum/viewtopic.php?pid=137851#p137851