I thought this would be an easy thing to figure out, but I'm just coming up with dead-ends. I'm trying to save a file through script and just use the name of the file loaded into the Data Portal as the name of the new TDM I want to create. These will both be in the same folder.
If my filename is 20210406Data.sif I would like the TDM created to be 20210406Data.TDM.
Here's what the final code would be if I wanted to hardcode the name each time
Call DataFileSave(DataReadPath & "20210406Data.TDM", "TDM", True)
I'm hoping there is some command like "FileName" so I can use a script like this.
Call DataFileSave(DataReadPath & FileName &".TDM", "TDM", True)
Solved! Go to Solution.
Please have a look at this code:
dim sFileName, sFullFileName sFullFileName = "D:\test\TestToSplitFileName.SIF" sFileName = FileNameSplit(sFullFileName, "N") msgbox sFileName sFullFileName = DataReadPath & sFileName & ".TDM" msgbox sFullFileName
Thanks Walter for you reply.
It looks like in your script I still have to code in the name of each file. I'm hoping to automate saving the TDM file using the script. Say I have data in 15 different folders that I want to quickly work through. My thought process was to drop the .sif files into the data portal, run a script that does a bunch of operations on the data and then finishes by saving the file as a TDM for later editing if needed. Having the script automatically use the existing .sif filename would make it easier to run through multiple folders of data.
If there is a command for replacing the "D:\test\TestTOSplitFileName.sif" with whatever the current file and path is then the FileNameSplit command would work great.
Looks like I found the solution with more searching on the forum. Data.Root.Name gives me what I wanted.
Call DataFileSave(DataReadPath & Data.Root.Name & ".TDM", "TDM", True)