parse delimited filename

parse delimited filename

Hi
I get files to this effect:
DATETIME FILETYPE GUID MD5
20120730110652-CommissionLoad-88ceb41d-c378-4bb6-a758-e69497f378ab-8d6e0d8960b2decb5d433346cb5bda0c
the files are dynamic. I search for the file using tFileList and look for *Commission*.txt , there are other file types eg. StaffLoad etc...
I need to parse the filename and store the different sections of the filename into (i assume) context variables, as I need to :
a. calculate the MD5 of the file and compare it to the MD5 in the filename
b. write to a table the file details and a status of whether the file was read properly , corrupt etc...
I am unsure of how to effect this.
Regards
One Star

Re: parse delimited filename

Hi
You might use tFileList, tFixedFlowInput and tFileOutputDelimited to store all these filenames.
Then use tFileInputPostional to extract these four columns to store in db table.
For MD5, you might use tFileProperties to get MD5 of each file and compare it with tFileInputPositional.
Regards,
Pedro

Re: parse delimited filename

apologies ... how do i get tFixedFlowInput to store the filenames . I cannot seem to get this right.
I have done this as a work around but cannot seem to get it to work .
in tJavaRow
i have some basic code, I am taking the output from tfileproperties (ie tfilelist -----iterate----->tfileproperties----main----> tjavarow

String basename;
String md5;
String ImpGuid;
String delim = "-";
globalMap.put("basename",input_row.basename);
globalMap.put("md5",input_row.md5);
System.out.println("########MD5##########");
System.out.println(input_row.md5);
System.out.println("######Basename#######");
System.out.println(globalMap.get("basename"));
System.out.println("########==FILENAME==##########");
System.out.println(((String)globalMap.get("tFileList_1_CURRENT_FILEPATH")));
//basename = toString(input_row.basename); //does not work cannot convert from object to string
//basename = ((String)globalMap.get(globalMap.get("basename")) //does not work
//String tokens[] = basename.split(delim);
for (int i = 0; i < input_row.basename.length; i++)
{
System.out.println(input_row.basename); //just to read what i have for now
}
I was thinking of reading on the string and assigning the different parts to a context variables but when i try cast or convert to string ...
One Star

Re: parse delimited filename

Hi
You might save all filenames in a delimited file as the following images.
Regards,
Pedro