Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi team,
below is the code which i'm implementing after tfilelist using tjava to pick the files based on the conditions
Files in folder:
TEST_1415_1617.csv,
TEST_1515_1617.csv,
retry1_TEST_1515_1617.csv,
TEST_91011_1213.csv,
retry1_TEST_91011_1213.csv,
retry2_TEST_91011_1213.csv,
TEST_20011_1213.csv,
retry1_TEST_20011_1213.csv,
Pick only these
TEST_1415_1617.csv,
retry1_TEST_1515_1617.csv,
retry2_TEST_91011_1213.csv,
retry1_TEST_20011_1213.csv,
structure of job
tfilelist--->itertae--->tjava--->main--->trunjob
im getting an error with conversion of string to string[], but will tjava able to list all the files or it shows current files in each iteration, so will the below code work in my scenario
system.out.println((string.globalMap.get("tfleList_1_CURRENT_FILE"));
String[] fileNames = ((string.globalMap.get("tfleList_1_CURRENT_FILE"));
Map<String, Integer> map = new HashMap<>();
List<String> filesToProcess = new ArrayList<>();
for (int i = 0; i < fileNames.length; i++) {
if (fileNames[i].contains("retry")) {
Integer number = Integer.parseInt(fileNames[i].substring(5, 6));
if (map.get(fileNames[i].substring(7)) == null) {
map.put(fileNames[i].substring(7), number);
} else {
if (number > map.get(fileNames[i].substring(7))) {
map.put(fileNames[i].substring(7), number);
}
}
} else {
if (map.get(fileNames[i]) == null)
map.put(fileNames[i], 0);
}
}
for (Map.Entry<String, Integer> entry : map.entrySet()) {
if (entry.getValue() > 0) {
filesToProcess.add("retry" + entry.getValue() + "_" + entry.getKey());
} else {
filesToProcess.add(entry.getKey());
}
}
System.out.println(filesToProcess);
Hi
The error occurs on this line
String[] fileNames = ((string.globalMap.get("tfleList_1_CURRENT_FILE"));
Can't convert string to string[], to new a String array, should be:
String variableName[] = new String[capacity];
String variableName[] = {comma-delimited values};
Regards
Shong
Hi
The error occurs on this line
String[] fileNames = ((string.globalMap.get("tfleList_1_CURRENT_FILE"));
Can't convert string to string[], to new a String array, should be:
String variableName[] = new String[capacity];
String variableName[] = {comma-delimited values};
Regards
Shong
Thanks