Forum Discussion

llcotton's avatar
llcotton
Occasional Contributor
7 years ago

Is there a way to use a variable in a data driven loop for the file address

I use the  data driven file operation on version 12.4 a lot for testing.  I even create a file from ready api runs and use the contents for further testing. 

The data driven operation requires the file name.  Is there a way to use a variable for the file name?

This hard coded file name makes maintenance a nightmare.  We recently had to move to a new computer and server and all

data driven loops had to be reconnected.

 

Is there a way to set a default file path?

Thank you

2 Replies

  • tristaanogre's avatar
    tristaanogre
    Esteemed Contributor

    What I usually do if I have a file that I need to use in a test, I store it somewhere within the project path.  For example, if my project path is C:\MySource\MyProjects\Project1\ for my Project1.MDS file, any files that I need to use within that project I make sure are somewhere within C:\MySource\MyProjects\Project1.  I can then use Project.ConfigPath in all my automation as a starting point for any files.  So, if I have a file in the Scripts folder of my project, I can call 

     

    Project.ConfigPath + '\\Scripts\\MyFile.txt'

    and no matter what the root path is, it will always find my file.