Four Stars

tFileCopy logging questions

Hi everyone,

I am new to Talend and I'm struggeling with the setup of the following flow:

I am copying files and logging this action with (iterative) tFileList ---> tFileCopy ---> tFlowToIterate ---> tIterateToFlow ---> tFileOutputDelimited

 

I have 2 questions:

1. It feels unnatural to use tFlowToIterate ---> tIterateToFlow for defining values to log with tFileOutputDelimited. Is there a better way of doing this?

2. I have set contexts of the Directory-type (with no "", I use the browse button to pick the folder), but when I use these in the tFileList directory field and the tFileCopy directory field (context.dir1), I get error "dir1 cannot be resolved to a variable". What could be causing this?

8 REPLIES
Six Stars

Re: tFileCopy logging questions

Can you provide a screenshot of your job + the config of the file components?

What exactly are you trying to log?

 

Four Stars

Re: tFileCopy logging questions

I want to log to a local file: which file was moved, at what time, from where, to where.

File components and context definitions + errors below. When I replace the context attributes with hard coded file paths "S:/etc." all files are moved correctly.

 

flowflow

contextscontexts

tFileList_3tFileList_3

tFileCopy_3tFileCopy_3

tFileCopy_4tFileCopy_4

ErrorsErrors

Six Stars

Re: tFileCopy logging questions

Try changing data type of your context variables from Directory to String.

Four Stars

Re: tFileCopy logging questions

Changing to string (with "") results in the same error.

 

Could it be related to JDK version (JDK 1.7.0.790 with Java 8.0.910.15)?

Six Stars

Re: tFileCopy logging questions

That is a possibility.  Can you open the 'code' tab of your job and find the compilation error? That may point you in the right direction.

Moderator

Re: tFileCopy logging questions

Hi,


Auke wrote:

Changing to string (with "") results in the same error.

 

Could it be related to JDK version (JDK 1.7.0.790 with Java 8.0.910.15)?


Have you ever executed your job successfully in your current studio with JDK 1.7.0.790 with Java 8.0.910.15? On which talend build version you are using?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Four Stars

Re: tFileCopy logging questions

Error at the red context.CMPverd: CMPverd cannot be resolved or is not a field 

The other contexts generate identical errors.

 

There are also some warnings about multiple markers, about type safety and about the static method convertToJsonText.  Are those relevant for my issue?

 

				ok_Hash.put("tFileList_3", false);
				start_Hash.put("tFileList_3", System.currentTimeMillis());

				currentComponent = "tFileList_3";

				int tos_count_tFileList_3 = 0;

				class BytesLimit65535_tFileList_3 {
					public void limitLog4jByte() throws Exception {

					}
				}

				new BytesLimit65535_tFileList_3().limitLog4jByte();

				String directory_tFileList_3 = context.CMPverd;
				final java.util.List<String> maskList_tFileList_3 = new java.util.ArrayList<String>();
				final java.util.List<java.util.regex.Pattern> patternList_tFileList_3 = new java.util.ArrayList<java.util.regex.Pattern>();
				maskList_tFileList_3.add("WG.CIC_bedankv0_*.csv");
				maskList_tFileList_3.add("WG.CIC_TMBED0_*.csv");
				for (final String filemask_tFileList_3 : maskList_tFileList_3) {
					String filemask_compile_tFileList_3 = filemask_tFileList_3;

					filemask_compile_tFileList_3 = org.apache.oro.text.GlobCompiler
							.globToPerl5(
									filemask_tFileList_3.toCharArray(),
									org.apache.oro.text.GlobCompiler.DEFAULT_MASK);

					java.util.regex.Pattern fileNamePattern_tFileList_3 = java.util.regex.Pattern
							.compile(filemask_compile_tFileList_3);
					patternList_tFileList_3.add(fileNamePattern_tFileList_3);
				}
				int NB_FILEtFileList_3 = 0;

				final boolean case_sensitive_tFileList_3 = true;
				final java.util.List<java.io.File> list_tFileList_3 = new java.util.ArrayList<java.io.File>();
				final java.util.Set<String> filePath_tFileList_3 = new java.util.HashSet<String>();
				java.io.File file_tFileList_3 = new java.io.File(
						directory_tFileList_3);

				file_tFileList_3.listFiles(new java.io.FilenameFilter() {

 

 

Four Stars

Re: tFileCopy logging questions

Hi Sabrina, when I replace te contexts with hard coded directory paths, the job runs fine.

With contexts containing the directories however, it always fails.

I'm on TOS version 6.4.1.20170623_1246