DIAdem

cancel
Showing results for 
Search instead for 
Did you mean: 

DataReadPath Doesn't Update

Solved!
Go to solution

Hi,

 

I am using the code below to load a file to be analyzed. My problem is when I use the DataReadPath variable I can only get the data path to change if I physically go to the Navigator tab and drag and drop a data file from the folder I want to work in. When I navigate to the correct folder inside the FileDlgShow dialog box and select the file I want to run the value of the variable doesn’t update, so when I run the script again to load the next file it still opens to the old location not the one I just loaded data from.

 

I then use the second code below to save the processed data file in a sub folder inside the same folder as the original data. If I do not manually drag a data file from the correct folder into the data portal before running my script the resultant file gets saved in the wrong place.

 

Is there a way the force the DataReadPath variable to update or am I going about it wrong and should be doing it in a different way?

 

Call Data.Root.Clear()

FileDlgShow DataReadPath, "", "Please Select a File to Analyze"

If (DlgState = "IDOk") Then

DataFileLoad FileDlgNameList(0),"",""

Else

MsgBoxDisp "Data loading has been aborted."&"@CRLF@Script is finished."

End If

'-----------------------------------------------------

sCurrP_Drv = DataReadPath & "Processed Data\"

if not FolderExist(sCurrP_Drv) then FolderCreate(sCurrP_Drv)

 

sNewName = DataReadPath & "Processed Data\" & Data.Root.Name

Call DataFileSave(sNewName,"TDM")

0 Kudos
Message 1 of 2
(2,875 Views)
Solution
Accepted by topic author Eyoung6676

Hello Eyoung6676,

 

The content of DataReadPath changes only if you work interactive. That means if you load a file via Drag&Drop a file from NAVIGATOR into the Dataportal DataRaedPath is changed – but if you load a file with a script command like DataFileLoad then the content of DataReadPath is not changed. In such cases it possible to set the DataFileRead variable like this:

 

Call Data.Root.Clear()

MsgBoxDisp DataReadPath

FileDlgShow DataReadPath, "", "Please Select a File to Analyze"
If (DlgState = "IDOk") Then
  DataReadPath = NameSplit(FileDlgNameList(0), "P")
  DataFileLoad FileDlgNameList(0),"",""
Else
  MsgBoxDisp "Data loading has been aborted."&"@CRLF@Script is finished."
End If

MsgBoxDisp DataReadPath

Greetings

Walter

0 Kudos
Message 2 of 2
(2,860 Views)