Hi Team,
It's a basic requirement but most common .So I wanted to share it for beginners.
Purpose : Job should execute for a selected country .If there are no records for the selected country then job should terminate .
Create 2 global variables to at Job level
$CNTR : Country to select when job execution
$RC : count records for selected country.
1.Scr_Records : to count the records for a selected country.
$RC = sql('SRT','SELECT Count(*) FROM Stadium_Info where COUNTRY={$CNTR}');
Print('Rows'||$RC);
2.Add try and Catch to display the error message in Trace log
3.Add Conditional (If) transformation .
In Condition part , write $RC >0
* Then part : Create your dataflow when condition met .Put Stadium_Info.COUNTRY =$CNTR in transformation WHERE clause to restrict rows for selected country.
*Else part : Create a script to generate error
Scr_Raise_Exception : raise_exception( 'Table is Empty');
4. In Catch block :
Add a script to Print your error message in Error log
raise_exception( 'There arer no records to fetch for '||$CNTR);
5.Execute the job and enter value for Country variable $CNTR ='IN' ( in database there are no records for IN)
observe Trace and Error logs.
Hope it helps somebody need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
8 | |
5 | |
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 |