kdjonesmtb2
Technical User
I want to use a variable to contain a text file name. I want to be able to use multiple table names in a test script
The DataTable is an excel like table that contains parameters that can be utilized in the vbscript
I tried to use the X as a alias for the Datatable - but the txt file is produced with a name of 'X' rather than "qtptestfile2.txt"
Thanks
Dim S1' Variable for custom spacing 1
Dim X 'Variable for Txt file names
S1=Space((DataTable.Value("Custom_spacing1",dtLocalSheet))) ' variable that insert spacing on loop
X= DataTable.Value("TxtFileName",dtGlobalSheet)
ISA_I01_Author_Info_Qualifier = DataTable.Value("ISA_I01_Author_Info_Qualifier", dtGlobalSheet)
Set fso=createobject("Scripting.FileSystemObject")
'Create a non existing file "qtptest.txt " with overwrite option as True
'Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\qtptest1.txt",true,False) ' textname could become a variable so that many could be generated
'Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\ X",true,False) 'this line works but file name is X rather than the assigned Data Table name of QTPTestfile2.txt
Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\ &(DataTable.Value("TxtFileName",dtGlobalSheet)",true,False) ' syntax on this line is giving an error expected ')' added several parenthesis with no luck
qfile1.Write((DataTable.Value("ISA_I01_Author_Info_Qualifier",dtGlobalSheet)
qfile1.Write("*") ' Hardcoded dellimiter
qfile1.Write(S1) & vbcrlf ' carriage return after ISA01 101 line is complete otherwise continue Write statements
qfile1.Writeline((DataTable.Value("Test2",dtGlobalSheet))) 'New line generated - repeat for each new line in 834
The DataTable is an excel like table that contains parameters that can be utilized in the vbscript
I tried to use the X as a alias for the Datatable - but the txt file is produced with a name of 'X' rather than "qtptestfile2.txt"
Thanks
Dim S1' Variable for custom spacing 1
Dim X 'Variable for Txt file names
S1=Space((DataTable.Value("Custom_spacing1",dtLocalSheet))) ' variable that insert spacing on loop
X= DataTable.Value("TxtFileName",dtGlobalSheet)
ISA_I01_Author_Info_Qualifier = DataTable.Value("ISA_I01_Author_Info_Qualifier", dtGlobalSheet)
Set fso=createobject("Scripting.FileSystemObject")
'Create a non existing file "qtptest.txt " with overwrite option as True
'Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\qtptest1.txt",true,False) ' textname could become a variable so that many could be generated
'Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\ X",true,False) 'this line works but file name is X rather than the assigned Data Table name of QTPTestfile2.txt
Set qfile1=fso.CreateTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP Test 834\Text files\ &(DataTable.Value("TxtFileName",dtGlobalSheet)",true,False) ' syntax on this line is giving an error expected ')' added several parenthesis with no luck
qfile1.Write((DataTable.Value("ISA_I01_Author_Info_Qualifier",dtGlobalSheet)
qfile1.Write("*") ' Hardcoded dellimiter
qfile1.Write(S1) & vbcrlf ' carriage return after ISA01 101 line is complete otherwise continue Write statements
qfile1.Writeline((DataTable.Value("Test2",dtGlobalSheet))) 'New line generated - repeat for each new line in 834