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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
hcroce
Contributor
Contributor

how to count rows from a tMap, if count = 0, don't create empty file and don't incremente counter

Hello,

I don't find solution to manage this process:

  1. in mysql counter table
    1. tag the script name as "active"
  2. Compare two table like the SDC process
  3. if count rows > 0
    1. create a file
    2. in mysql counter table
      1. increment counter
      2. tag the script as "unactive"
  4. if count rows = 0
    1. don't create the file
    2. in mysql counter table
      1. don't increment counter
      2. tag the script as "unactive"

I join the pict of my actual job

 

0683p000009M7wR.png

The tDBInput_3 ask if script already "active"

The tDBInput_1 subjob tag the script as "active" and put counter value in global var for the name of the file.

The tDBInput_2 subjob compare the 2 table to search for new rows.

The tDBInput_5 tag the script as"unactive" and increment the counter of 1

 

Thank you for your help.

Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable

Ignore the job (it is just a demo job that I use for testing bits and pieces out), but take a look at the bottom left "outline" tab. Here you can access globalMap variables associated with components. Notice I have added a tHashOutput component and that this is shown in the "Outline" tab with a "number of line" variable. This is the variable you would use. You should be able to drag this to the RunIF command window

0683p000009M7su.png

View solution in original post

7 Replies
Anonymous
Not applicable

I'm not entirely sure I fully understand your job, but you should be able to achieve what you wish by using tHashOutput and tHashInput components and RunIf links.

 

Instead of writing your data to a file and to the database in your second subjob, write your data to tHashOutput components. Then create another subjob which starts with a tJava. This will be a dummy component. From this component you can use your RunIf links to test whether the number of rows requirement you have have been met. If so, you can read your data from the tHashOutput using a tHashInput component and write it to the file/db.

hcroce
Contributor
Contributor
Author

Thank you Rhall for your quick answer.

I test it and tell you.

 

hcroce
Contributor
Contributor
Author

I don't find tHashOutput and tHashInput in talend studio 7.2...

Anonymous
Not applicable

I forget that these are initially hidden. Here is a post which covers how to find them....

https://community.talend.com/t5/Design-and-Development/tHashInput-amp-tHashOutput-gone-in-5-6-1/m-p/...

hcroce
Contributor
Contributor
Author

Thank you Rhall. I got them.

But now, I don't know how to check number of rows from tHashOutput in "if" condition.

I need to learn the syntax...

I join the actual job modified with the 3 components.0683p000009M7wD.png

 

 

Thank you very much for your help.

Anonymous
Not applicable

Ignore the job (it is just a demo job that I use for testing bits and pieces out), but take a look at the bottom left "outline" tab. Here you can access globalMap variables associated with components. Notice I have added a tHashOutput component and that this is shown in the "Outline" tab with a "number of line" variable. This is the variable you would use. You should be able to drag this to the RunIF command window

0683p000009M7su.png

hcroce
Contributor
Contributor
Author

It works!

Thank you very much Rhall!