Skip to main content
Announcements
NEW: Seamless Public Data Sharing with Qlik's New Anonymous Access Capability: TELL ME MORE!
cancel
Showing results for 
Search instead for 
Did you mean: 
JayZ1
Contributor III
Contributor III

Help with Tdie and tFilterRow

I have a main job and a sub job, I wanted to add some more filtering to ensure that the data I am using is accurate.

 

So i enhanced my job to do a db check before we execute the subjob, for example I connect to the database and execute a query, one column in db would essentially have the value '-1' if data has been fully published to this table.

 

 

I am having some issues and it isn't working the way I am expecting, so would like some input.

 

In this case after connecting to the db an outputing the values I go to a tfilter, ensuring that the value is -1, my query will return the following:

 

-1

nothing 

 

I have switched the rejected/filtered output to see if it would make it work. Ideally if the value does not exist i want to use T-die to kill the whole script, making sure the subjob which i call later doesn't get invoked.

JayZ1_1-1721336815534.png

 

JayZ1_0-1721336723240.png

 

 

How could I go about implementing this correctly?

 

Labels (2)
2 Solutions

Accepted Solutions
quentin-vigne
Partner - Contributor III
Partner - Contributor III

Hi JayZ1,

Here is how I would do :

Setup a tDBInput component that get the value you need to check if your DB has been updated

In my case I used a query that give me the value "62" (only one row)

quentinvigne_0-1721636512290.png

then setup a tJavaRow that assign your query value to a context variable (in this example : "test")

 

quentinvigne_1-1721636555940.png

 

Don't forget to create the context variable "test" (or whatever you want to call it) in the Context window.

Then setup the "Run If" trigger between the tJavaRow and the tDie component using the equals() function on your context variable : 

quentinvigne_2-1721636626814.png

 

In my example, if the query return 62, the tDie kills the job, when it returns something else the job doesn't get killed.

View solution in original post

JayZ1
Contributor III
Contributor III
Author

Hi Thank you this seems like a good possible solution. For some reason for me the IF trigger is executing as false still. Let me provide some screenshots:

 

JayZ1_0-1721678791106.png

JayZ1_1-1721678808762.png

JayZ1_2-1721678867197.png

 

originally I just had this empty, I tried changing it to equal 0 so it would get re-assigned either way it wasn't working

JayZ1_3-1721678911087.png

 

Here is the tlog output I was validating USR_ID = -1

JayZ1_4-1721678944142.png

 

 

Thanks for the help!

View solution in original post

3 Replies
quentin-vigne
Partner - Contributor III
Partner - Contributor III

Hi JayZ1,

Here is how I would do :

Setup a tDBInput component that get the value you need to check if your DB has been updated

In my case I used a query that give me the value "62" (only one row)

quentinvigne_0-1721636512290.png

then setup a tJavaRow that assign your query value to a context variable (in this example : "test")

 

quentinvigne_1-1721636555940.png

 

Don't forget to create the context variable "test" (or whatever you want to call it) in the Context window.

Then setup the "Run If" trigger between the tJavaRow and the tDie component using the equals() function on your context variable : 

quentinvigne_2-1721636626814.png

 

In my example, if the query return 62, the tDie kills the job, when it returns something else the job doesn't get killed.

JayZ1
Contributor III
Contributor III
Author

Hi Thank you this seems like a good possible solution. For some reason for me the IF trigger is executing as false still. Let me provide some screenshots:

 

JayZ1_0-1721678791106.png

JayZ1_1-1721678808762.png

JayZ1_2-1721678867197.png

 

originally I just had this empty, I tried changing it to equal 0 so it would get re-assigned either way it wasn't working

JayZ1_3-1721678911087.png

 

Here is the tlog output I was validating USR_ID = -1

JayZ1_4-1721678944142.png

 

 

Thanks for the help!

quentin-vigne
Partner - Contributor III
Partner - Contributor III

You need to put your context.DatabaseCheck as String/Varchar and the value you get from your database as String/Varchar also

 

Make sure everything is set as varchar for this to work.
Right now you're trying to compare -1 (int) and "-1" varchar which doesn't work in java

Keep me updated if this still doesn't work