Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a table (pic 1) that contains information that I want to, pull with tMSSqlInput and, pass as Context Parameters, via tRunJob (pics 2-5), to a sub-Job (dummy process currently, shown in pic 8, the actual process is what is deactivated above in the pic). I want it to loop through every row in the table and pass the information to tRunJob.
But I am having trouble getting the main routine to work (pics 6 & 7)
Starting job MainRoutine_DeleteFiles at 17:13 03/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles cannot be resolved to a type
notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles cannot be resolved
notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles cannot be resolved
notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles cannot be resolved
notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles cannot be resolved
connecting to socket on port 3432
connected
connecting to socket on port 4426
connected
Job MainRoutine_DeleteFiles ended at 17:13 03/06/2008.
ok, based on this topic http://talendforge.org/forum/viewtopic.php?pid=7497, I tried adding tLogRow to my job, but that still doesnt work
Starting job MainRoutine_DeleteFiles at 17:49 03/06/2008.
TargetFolder Extension_FileName NumDaysRetain
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.tContextDump_1Process(Copy_of_SubRoutine_DeleteFiles.java:301)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJobInTOS(Copy_of_SubRoutine_DeleteFiles.java:666)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJob(Copy_of_SubRoutine_DeleteFiles.java:566)
\gwpack\import\|*.zip|45.0
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:540)
Job MainRoutine_DeleteFiles ended at 17:49 03/06/2008.
Hello
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
Because there is a special charater'\' in your targetfolder column, so you need to escape '\' before pass it to child job. For example: \file1\file2 ===>\\file1\\file2
I have tested with tJavaRow component, it works with the expression:
String.replaceAll("\\\\","\\\\\\\\")
see the screenshot.
Best regards
shong
Try #1 (the pictures attached are for this try)
row2.TargetFolder=row1.TargetFolder.replaceAll("\\\\","\\\\\\\\");
Starting job MainRoutine_DeleteFiles at 11:50 04/06/2008.
Exception in component tJava_1
java.lang.NullPointerException
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:517)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.runJobInTOS(MainRoutine_DeleteFiles.java:913)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.main(MainRoutine_DeleteFiles.java:820)
Job MainRoutine_DeleteFiles ended at 11:50 04/06/2008.
I tried these because #1 didn't work, just to make sure I wasn't supposed to use the exact same thing you said in your example.
Try #2
output_row.folderpath=input_row.folderpath.replaceAll("\\\\","\\\\\\\\");
Starting job MainRoutine_DeleteFiles at 11:46 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
output_row cannot be resolved
input_row cannot be resolved
row2.filePath cannot be resolved or is not a field
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:516)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.runJobInTOS(MainRoutine_DeleteFiles.java:913)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.main(MainRoutine_DeleteFiles.java:820)
Job MainRoutine_DeleteFiles ended at 11:46 04/06/2008.
Try #3
output_row.TargetFolder=input_row.TargetFolder.replaceAll("\\\\","\\\\\\\\");
Starting job MainRoutine_DeleteFiles at 11:44 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
output_row cannot be resolved
input_row cannot be resolved
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:516)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.runJobInTOS(MainRoutine_DeleteFiles.java:913)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.main(MainRoutine_DeleteFiles.java:820)
Job MainRoutine_DeleteFiles ended at 11:44 04/06/2008.
then I tried using tReplace, instead of tJava (or tMap).
I set Search = "\" and Replace with = "\\", and got this error (first pic)
Starting job Copy_of_MainRoutine_DeleteFiles_a at 12:01 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The method replaceAll(String, String) in the type String is not applicable for the arguments (String)
Syntax error, insert ")" to complete MethodInvocation
Syntax error, insert ";" to complete Statement
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_MainRoutine_DeleteFiles_a.java:638)
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_MainRoutine_DeleteFiles_a.java:1024)
Job Copy_of_MainRoutine_DeleteFiles_a ended at 12:01 04/06/2008.
Then I set Search = "\\\\" and Replace with = "\\\\\\\\", and got this error
Starting job Copy_of_MainRoutine_DeleteFiles_a at 12:03 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.tContextDump_1Process(Copy_of_SubRoutine_DeleteFiles.java:301)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJobInTOS(Copy_of_SubRoutine_DeleteFiles.java:666)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJob(Copy_of_SubRoutine_DeleteFiles.java:566)
\\gwpack\\import\\|*.zip|45.0
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_MainRoutine_DeleteFiles_a.java:718)
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_MainRoutine_DeleteFiles_a.java:920)
Job Copy_of_MainRoutine_DeleteFiles_a ended at 12:03 04/06/2008.
I tried using tMap instead of tJava...
StringHandling.EREPLACE(row1.TargetFolder ,"\\\\","\\\\\\\\")
Starting job Copy_of_MainRoutine_DeleteFiles_a at 11:55 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.tContextDump_1Process(Copy_of_SubRoutine_DeleteFiles.java:301)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJobInTOS(Copy_of_SubRoutine_DeleteFiles.java:666)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJob(Copy_of_SubRoutine_DeleteFiles.java:566)
\\gwpack\\import\\|*.zip|45.0
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_MainRoutine_DeleteFiles_a.java:753)
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_MainRoutine_DeleteFiles_a.java:956)
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.main(Copy_of_MainRoutine_DeleteFiles_a.java:863)
Job Copy_of_MainRoutine_DeleteFiles_a ended at 11:55 04/06/2008.
ok I changed the data in the table (pic 1) so that the values in TargetFolder don't end with \, but I'm still getting errors
(I also tried removing the leading \, but still get the errors below)
tMap (pics 2-4)
StringHandling.EREPLACE(row1.TargetFolder ,"\\\\","\\\\\\\\")
Starting job Copy_of_MainRoutine_DeleteFiles_a at 14:41 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.tContextDump_1Process(Copy_of_SubRoutine_DeleteFiles.java:301)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJobInTOS(Copy_of_SubRoutine_DeleteFiles.java:668)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJob(Copy_of_SubRoutine_DeleteFiles.java:568)
\gwpack\import|*.zip|45.0
\\gwpack\\import|*.zip|45.0
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_MainRoutine_DeleteFiles_a.java:1002)
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_MainRoutine_DeleteFiles_a.java:1233)
Job Copy_of_MainRoutine_DeleteFiles_a ended at 14:41 04/06/2008.
tReplace (pics 5 & 6)
Search = "\\\\" and Replace with = "\\\\\\\\"
Starting job Copy_of_Copy_of_MainRoutine_DeleteFiles_a at 14:51 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error on token ".", delete this token
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:1087)
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:1360)
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.main(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:1266)
Job Copy_of_Copy_of_MainRoutine_DeleteFiles_a ended at 14:51 04/06/2008.
tJava (pics 7 & 😎
row2.TargetFolder=row3.TargetFolder.replaceAll("\\\\","\\\\\\\\");
Starting job MainRoutine_DeleteFiles at 14:57 04/06/2008.
Exception in component tJava_1
java.lang.NullPointerException
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:686)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.runJobInTOS(MainRoutine_DeleteFiles.java:1190)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.main(MainRoutine_DeleteFiles.java:1097)
Job MainRoutine_DeleteFiles ended at 14:57 04/06/2008.
I don't care what component I use to do this (whether its tJava, tMap, tReplace, or something else), btw
I tried changing the SQL code to do the substitution in the original statement (pic 1), but I still get an error
select REPLACE(targetfolder,'\','\\') as TargetFolder, Extension_FileName, NumDaysRetain
FROM Analysis.smfadm.tblOdyssey_FileCleanUp_Variables
Starting job Copy_of_Copy_of_MainRoutine_DeleteFiles_a at 16:35 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Syntax error on token ".", delete this token
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:566)
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.runJobInTOS(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:786)
at notifications.copy_of_copy_of_mainroutine_deletefiles_a_0_1.Copy_of_Copy_of_MainRoutine_DeleteFiles_a.main(Copy_of_Copy_of_MainRoutine_DeleteFiles_a.java:692)
Job Copy_of_Copy_of_MainRoutine_DeleteFiles_a ended at 16:35 04/06/2008.
I tried REPLACE(targetfolder,'\','\\\\') and REPLACE(targetfolder,'\','\\\\\\\\'), with the same error results
Hello strpdsnk
Try #2
Code:
output_row.folderpath=input_row.folderpath.replaceAll("\\\\","\\\\\\\\");
Starting job MainRoutine_DeleteFiles at 11:46 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
output_row cannot be resolved
input_row cannot be resolved
row2.filePath cannot be resolved or is not a field
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.tMSSqlInput_2Process(MainRoutine_DeleteFiles.java:516)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.runJobInTOS(MainRoutine_DeleteFiles.java:913)
at notifications.mainroutine_deletefiles_0_1.MainRoutine_DeleteFiles.main(MainRoutine_DeleteFiles.java:820)
Job MainRoutine_DeleteFiles ended at 11:46 04/06/2008.
1) Please use the tJavaRow replace the tJava component. If your schema column is 'TargetFolder', please use the expression:
row2.TargetFolder=row1.TargetFolder.replaceAll("\\\\","\\\\\\\\");
not row2.folderpath
2) Make sure there are not null value in your 'TargetFolder' column, otherwise, you need to use a tMap component deal with the null value.
Best regards
shong
1. doing that gives me this error: (and doesnt pass the 2nd, Extension_FileName, and 3rd, NumDaysRetain, columns)
Starting job Copy_of_MainRoutine_DeleteFiles_a at 22:22 04/06/2008.
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.tContextDump_1Process(Copy_of_SubRoutine_DeleteFiles.java:301)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJobInTOS(Copy_of_SubRoutine_DeleteFiles.java:668)
at notifications.copy_of_subroutine_deletefiles_2_0.Copy_of_SubRoutine_DeleteFiles.runJob(Copy_of_SubRoutine_DeleteFiles.java:568)
\gwpack\import\|*.zip|45.0
\\gwpack\\import\\||
at notifications.copy_of_mainroutine_deletefiles_a_0_1.Copy_of_MainRoutine_DeleteFiles_a.tMSSqlInput_2Process(Copy_of_MainRoutine_DeleteFiles_a.java:963)
Job Copy_of_MainRoutine_DeleteFiles_a ended at 22:22 04/06/2008.
2. also, there are no null values in that column
but it isn't working in tMap when I've tried that...