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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to execute tFileCopy/tFileDelete from the tJava component

Hi All,

How can I execute components like tFileCopy and tFileDelete from within a tJava/tJavaFlex component. The idea is I would like to rename/move an input file based on certain conditions. My current sample code looks like below and it is obviously wrong because I don't know the sytnax for calling components from within tJava/tJavaFlex components.

I guess an alternative would be to use the tSystem compont within tJava, but I would run into the syntax problems as well. I am not particular whether I used tSystem or tFileCopy - I just want something that does the job.

**The code in the end code section of a tJavaFlex component:

 

 if (num_rows > 0) {
    tFileCopy( ((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")) ,
    context.error_dir + jobName + "/" ((String)globalMap.get("tFileList_1_CURRENT_FILE"))
    );
 }

 

With the above code I get the error:

 

0683p000009LvBk.png

Labels (3)
1 Solution

Accepted Solutions
cterenzi
Specialist
Specialist

I don't think you can invoke other components from the custom code components. What you can do is set variables that are used by conditional trigger links.

View solution in original post

2 Replies
cterenzi
Specialist
Specialist

I don't think you can invoke other components from the custom code components. What you can do is set variables that are used by conditional trigger links.
Anonymous
Not applicable
Author

Hello,

With your requirement, you can use "RunIf" trigger which triggers a subjob or component in case the condition defined is met.

You can add your code in the Condition section. Such as:  Main job-->RunIf(num_rows > 0)-->tFileCopy.

Best regards

Sabrina