Page 1 of 1

Need to find the TI name with the extract file

Posted: Thu Feb 17, 2022 5:57 pm
by ajayk4
Hi all,

I have a .CSV file extracted from TI, With that file can I get know from which TI it got extracted. As I have 100's of TI files which is very difficult to go through each of the TI.

Can anyone suggest how to achieve this.

Re: Need to find the TI name with the extract file

Posted: Thu Feb 17, 2022 6:08 pm
by Alan Kirk
ajayk4 wrote: Thu Feb 17, 2022 5:57 pm Hi all,

I have a .CSV file extracted from TI, With that file can I get know from which TI it got extracted. As I have 100's of TI files which is very difficult to go through each of the TI.

Can anyone suggest how to achieve this.
Not posting into the Enhancements forum without reading Martin's post "Enhancements forum guidelines -PLEASE READ BEFORE POSTING HERE" would be a start.

The second would be to use the GetProcessName() TI function and make the returned value part of the export filename.

------------------
Edit: One clarification in the light of the subsequent responses; that method would allow you to identify the source of FUTURE files. If you have a CURRENT file that you don't know the source of then maybe some better documentation of your system would be an idea. Searching through the .pro files using any method will work IF the file name is completely static (unlikely, unless you're OK with the output files being potentially overwritten) OR there is enough of the filename that is static for you to be able to search for that part.

If you change your processes to embed the process name in the export filename, that ceases to be a problem.
-----------------
I've moved this to the correct forum.

Re: Need to find the TI name with the extract file

Posted: Thu Feb 17, 2022 6:55 pm
by ascheevel
A couple methods come to mind:

1. look at the last modified date/time of the csv file and then search the tm1server.log file to see which TI process finished around that time

2. use the new processes.search_string_in_code function in TM1py 1.9.0 to look for the exact filename string in a TI process. This works better when the filename is standard/static and not dynamically derived.

Re: Need to find the TI name with the extract file

Posted: Thu Feb 17, 2022 9:30 pm
by Emixam
ascheevel wrote: Thu Feb 17, 2022 6:55 pm A couple methods come to mind:

1. look at the last modified date/time of the csv file and then search the tm1server.log file to see which TI process finished around that time

2. use the new processes.search_string_in_code function in TM1py 1.9.0 to look for the exact filename string in a TI process. This works better when the filename is standard/static and not dynamically derived.
3. In Notepad++, Search->Find in Files.
Find What: File Name
Filters: *.pro*
Directory: TM1 data folder

Re: Need to find the TI name with the extract file

Posted: Thu Feb 17, 2022 9:45 pm
by ascheevel
Emixam wrote: Thu Feb 17, 2022 9:30 pm 3. In Notepad++, Search->Find in Files.
Find What: File Name
Filters: *.pro*
Directory: TM1 data folder
Good add, thank you.

Re: Need to find the TI name with the extract file

Posted: Fri Feb 18, 2022 1:41 am
by ajayk4
ascheevel wrote: Thu Feb 17, 2022 9:45 pm
Emixam wrote: Thu Feb 17, 2022 9:30 pm 3. In Notepad++, Search->Find in Files.
Find What: File Name
Filters: *.pro*
Directory: TM1 data folder
Good add, thank you.
I am not sure what you are trying to say, you mean I need to search for .pro in data folder with the same name which my output file contains.

Is this right??

Re: Need to find the TI name with the extract file

Posted: Fri Feb 18, 2022 3:01 am
by Alan Kirk
ajayk4 wrote: Fri Feb 18, 2022 1:41 am
ascheevel wrote: Thu Feb 17, 2022 9:45 pm
Emixam wrote: Thu Feb 17, 2022 9:30 pm 3. In Notepad++, Search->Find in Files.
Find What: File Name
Filters: *.pro*
Directory: TM1 data folder
Good add, thank you.
I am not sure what you are trying to say, you mean I need to search for .pro in data folder with the same name which my output file contains.

Is this right??
Not quite.

Those suggestions assume that the name of your output file (or some part of the name) is EMBEDDED (hard coded) in your TI process.

This probably isn't all that common; most export files will include something like a dynamically generated time stamp to ensure that they don't overwrite earlier files. In some cases the entire name is dynamically generated, or is looked up from a control cube, in which case you're out of luck in using this method.

But suppose that your file name is something like "GLExportFile202202181356.csv". If you have, say, "GLExportFile" hard coded in the prolog of the exporting process as part of the export file name, then you can search all of the .pro files to see which process contains that string of text. It is LIKELY, not certain but LIKELY, that you are looking at the process which generated the text file.

Of course, you would need to have access to the data directory to be able to do that.

Re: Need to find the TI name with the extract file

Posted: Fri Feb 18, 2022 9:21 am
by Wim Gielis
To know the processes that can create text files, you can use Notepad++ (if you have access to the TM1 data directory).

You can search with regular expressions for:

asciioutput|textoutput

in the *.pro files of that directory, without subdirectories (not needed).

This will give you all instance where either of the 2 exists.

In theory, ExecuteCommand or other even more exotic constructions can also generate files but very likely AsciiOutput and TextOutput will cover (almost) all cases.

After that, it becomes a semi-manual or even completely manual task to identify what is what. With business knowledge, you can skip certain cases. E.g. a file with balance sheet data will not be exported from a process that has "Export sales data" in the name. But it remains a rather manual task.