kdjonesmtb2
Technical User
Hello,
I have script that creates X12 834 Individual Enrollment trx for Health care
Each file creates a Header rows that I want to ignore when I combine the files into a single file
Only the 1st file should have the header. For example 100 separate files that were created,
I want to combine files 2-100 into file #1
If I want to only select the populated rows in files 2-100 and append them to file #1; starting with row 2 in each of the files(2-100) what is best way to only select the rows in each txt file (the txt files have 67 rows - (carriage returns were used when creating the files)
File name - QTPTest1.x12
Here is an example of code that already appends the existing file to add rows
'Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso=createobject("Scripting.FileSystemObject")
Set qfile1 = fspenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest" & cstr(row)& ".x12", ForAppending,True)
qfile1.Write(File_Header_SE)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(Result50) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(SE02_Transaction_Set_Control_Number)
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'GE*1*2013~
'
'
'File_Header_GE
'GE01_Number_of_Transaction_Sets_Included
'GE02_Group_Control_Number
qfile1.Write(File_Header_GE)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(GE01_Number_of_Transaction_Sets_Included) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(GE02_Group_Control_Number)
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'
'
'File_Header_IEA
'IEA01_Number_of_Included_Functional_Groups
qfile1.Write(File_Header_IEA)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(IEA01_Number_of_Included_Functional_Groups) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write((DataTable.Value("ISA13_I12_Interchange_Control_Number",dtGlobalSheet)))
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'qfile1.Close
objworkbook.close 'Closes the Excel workbook each time a test case is incremented in the Global DataTable
I have script that creates X12 834 Individual Enrollment trx for Health care
Each file creates a Header rows that I want to ignore when I combine the files into a single file
Only the 1st file should have the header. For example 100 separate files that were created,
I want to combine files 2-100 into file #1
If I want to only select the populated rows in files 2-100 and append them to file #1; starting with row 2 in each of the files(2-100) what is best way to only select the rows in each txt file (the txt files have 67 rows - (carriage returns were used when creating the files)
File name - QTPTest1.x12
Here is an example of code that already appends the existing file to add rows
'Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set fso=createobject("Scripting.FileSystemObject")
Set qfile1 = fspenTextFile("\\ikanas267\Documents\kgittensjones\My Documents\QTP 834\Text files\qtptest" & cstr(row)& ".x12", ForAppending,True)
qfile1.Write(File_Header_SE)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(Result50) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(SE02_Transaction_Set_Control_Number)
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'GE*1*2013~
'
'
'File_Header_GE
'GE01_Number_of_Transaction_Sets_Included
'GE02_Group_Control_Number
qfile1.Write(File_Header_GE)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(GE01_Number_of_Transaction_Sets_Included) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(GE02_Group_Control_Number)
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'
'
'File_Header_IEA
'IEA01_Number_of_Included_Functional_Groups
qfile1.Write(File_Header_IEA)
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write(IEA01_Number_of_Included_Functional_Groups) ' calculated number of segments
qfile1.Write((DataTable.Value("Common_Delimiter",dtLocalSheet)))
qfile1.Write((DataTable.Value("ISA13_I12_Interchange_Control_Number",dtGlobalSheet)))
qfile1.Write((DataTable.Value("Tilde",dtLocalSheet))) & vbcrlf
'qfile1.Close
objworkbook.close 'Closes the Excel workbook each time a test case is incremented in the Global DataTable