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

My OnComponentError would never be fired?

0683p000009M8VV.jpg

 

0683p000009M8wK.jpg


Please see the design above:
I want to unzip all .gz files into a "temp" folder. In case if it fails when unzipping one .gz file, I want the filename and error message printed out.

But I also don't want the job to fail when that happens -- so I have "Die on Error" unchecked in tFileUnarchive step.

I used a fake .gz file (I renamed a regular text file as .gz file) with several real .gz files for testing.
I don't get the error message at all. I did have something show up in the print out area, but not from my code:
0683p000009M80H.jpg


Is it because I unchecked "Die on Error" so the OnComponentError would never be fired?
Does anyone have a good idea to catch the filename and error message when there is a problem unzipping the file, but still let the job continue?

Thanks!



Labels (2)
1 Solution

Accepted Solutions
vapukov
Master II
Master II

Hi,

 

I've provided 2 variants:

  • using tRunJob - where all similar to your current design, you just need to relocate 2 components into subjob
  • using tSystem, tSystem could run any command or program installed on machine

as an example - http://kb.winzip.com/kb/entry/124/ or https://stackoverflow.com/questions/41902600/how-would-i-extract-a-gz-file-from-cmd-using-only-comma... 

 

if the execution was successful, error code will be 0, if any error - not 0, and variables will display to you what happens

 

cheers,

View solution in original post

6 Replies
vapukov
Master II
Master II

Hi,

 

as a variant which is definitely working - put Unzip and error logic into SubJob (tRunJob)

Uncheck DieOnChildError, but in the child job use Die On Error for component

 

another variant, use tSystem and If triggers:

0683p000009M8sj.png

0683p000009M8wP.png

Anonymous
Not applicable
Author

Thank you so much for your quick response!

But I have problem understanding what you wrote, especially when I'm looking at your design screenshot --
could you please help create a more understandable job if you have time?

BTW, if I want to use tSystem to unzip a group of .gz files, what should the command be?

Thanks!


vapukov
Master II
Master II

Hi,

 

I've provided 2 variants:

  • using tRunJob - where all similar to your current design, you just need to relocate 2 components into subjob
  • using tSystem, tSystem could run any command or program installed on machine

as an example - http://kb.winzip.com/kb/entry/124/ or https://stackoverflow.com/questions/41902600/how-would-i-extract-a-gz-file-from-cmd-using-only-comma... 

 

if the execution was successful, error code will be 0, if any error - not 0, and variables will display to you what happens

 

cheers,

Anonymous
Not applicable
Author

I hope I understand you now.


I created a stand alone job ("unzip_file")  with tFileList --Iterate--> tFileUnarchive --OnComponentError -> tJava (Print out error message) . I checked " Die on Error" within tFileUnarchive.

In my original job, I replaced above subjob with a tRunJob component and it calls job "unzip file".
Leave "Die on child error" unchecked.

I launched the job -- this time, I saw my error message print out my code. BUT, there is one problem: the child job didn't unzip ALL of the files. I believe when it encountered the bad file, it failed and it stopped unzipping the rest of the files.

Please let me know if I did it correctly. Thank you!

vapukov
Master II
Master II


@Moe wrote:



I launched the job -- this time, I saw my error message print out my code. BUT, there is one problem: the child job didn't unzip ALL of the files. I believe when it encountered the bad file, it failed and it stopped unzipping the rest of the files.

Please let me know if I did it correctly. Thank you!


you need to run subjob for each file (filename as parameter from parent)

 

cheers, Vlad

Anonymous
Not applicable
Author

Thanks! It's working now.