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: 
Anonymous
Not applicable

Fetch count of records from multiple files in child to parent job

Hi Team,

I have develop parent and child job. I am calling child job using tRunJob component. I need to get count of records from child job to parent job. 

I am having multiple files with same metadata. I am able to fetch count for single file but need to get count of all records from all files also need total count of that records.

Please help me in this scenario. Attached snap of parent and child job.

Labels (2)
5 Replies
Anonymous
Not applicable
Author

I'm assuming you are passing the count of records out of the child job to the parent job using the buffer output. If not, do that. The you can either use a tAggregateRow component after your tRunJob or just use your tJavaRow to sum the output 

Anonymous
Not applicable
Author

Hi,

Thanks for the reply. I am explaining you flow of my job. I have multiple xml files which are having same schema so I am using "((Integer)globalMap.get("tFileInputMSXML_1_NB_LINE"))"  property to get total number of records. This I am using in child job so when I am having more than one file I need to get count of all files which processed in child job. I have tried your solution but it give me only count of last file which is processed. I need count of all files which is processing in Child job. Main thing is I am iterating file one by one. your help is appraisable. Thanks.

                            

Anonymous
Not applicable
Author

When you receive your count values from the child job, you need to add those values in your tJava. Here is some example (assuming you are returning an integer value in a column called "myCount"......

 

int myCount = input_row.myCount;

if(globalMap.get("myCount")==null){
       globalMap.put("myCount", myCount);
}else{
      myCount = ((Integer)globalMap.get("myCount")) + myCount;
      globalMap.put("myCount", myCount);
}

output_row.myCount = myCount;

This code was written without testing, so you may need to tweak it. Your final total will appear after your last file. This will also give you a running total.

Anonymous
Not applicable
Author

Hi rhall,

Thanks for the solution. I have resolved issue using context variable. I have used "+=" for context variable so it keep adding count of each file after process completed.

 

Anonymous
Not applicable
Author

That is essentially what I was describing with my last post. The difference being that I used the globalMap HashMap instead of context variables