Just a tip for the day.
If you got a tab limited file and want to read it as a CSV file, using the file layout, use the below code snippet.
Local File &TABFILE, &CSVFILE;
Local string &FILE_NAME, &DATA, &NEWDATA;
&FILE_NAME = "Test.txt";
&TAB = Char(9);
&TABFILE = GetFile(&FILE_NAME, "r");
&FileName = &TABFILE.Name;
&POS = Find(".", &FileName);
&NEWFILE_NAME = Substring(&FileName, 1, &POS) | "dat";
&CSVFILE = GetFile(&NEWFILE_NAME, "N", %FilePath_Absolute);
If &TABFILE.IsOpen And
&NEWDATA = Substitute(&DATA, &TAB, ",");
Will be handy...
Or you can change your File Layout to use Tab Delimiter instead of comma.ReplyDelete
Seems like that option is not there anymore.
Tab delimiter is available at least as of PT 8.53.08ReplyDelete