Professional Documents
Culture Documents
data validation and business rules applies or not perspective. To be specify in more details below The flow is: That there is an origin excel csv file (txt file with format file extension of .csv) This file is being processed via an enging- data feeder This process creating an xml text string into a cell in the database With a simple sql command, this xml string being copied into an xml txt file Then the idea is to compare and add some more calculations The idea is to do it against different names of origin excel files (maybe we need to parse the xml file and to store the details of each columns per each row by using split vb command and then save them in varibales in order to check format-type and length of the xml txt inside the elements) The origin file is a flat txt file with CSV as the extension format: Sample:
HDR PPR EXT IPD IPP ADV CLI CLI CLI 4 ######## PPR 2F 4 ABL Adelaide Bank - CMTUnknown Unknown 4 ABL 50118 Property Tr P U Unknown 4 ABL 50118 CCL 4 ABL 50118 CCL 3.6456 ######## 4 ABL 50118 50118 Loxton 4 ABL 50118 50118 40751352 4 ABL 50118 50118 40674421 4 ABL 50118 50118 70872910
T Nick HOMBSCHDENISE AUST HENRY AMOS JOHN Unknown Mrs Female Mr Male Mr Male Unknown ######## ######## ######## Unknown Unknown Unknown
This file being transferred through an engine (data feeder importer) And then being generated into a cell field in a MS SQL DB as xml scheme So the output file is a XML FILE -------------------------------------------------------------------------------------------------------------------------------------To prepare a code in VB script that with QTP, can do the next things: 1. Will load/read/import the data from the origin EXCEL CSV FILE into QTP, into the a specific debatable sheet, and then load the xml output file into another datatable, and then create code that will compare them and report where they are not matching. Cab be done in many different ways To import the csv file into qtp,, then to import the output xml file, to conver it back to csv file, and then compare them.
To import csv file to run time datatable sheet1, then to import xml outoutfile to a runtime datatable sheet 2, and to compare them --------------------------------------------------------------------------------------------------------------------------This is a code that support the above and is working- just to confirm that both csv files are equal or not Its still missing to highlight or report where there is a mismatch Dim xmlFile, csvFile xmlFile="C:\Users\Aviad.SarShalom\Desktop\origing and output file\outputXMLfile.xml" csvFile="C:\Users\Aviad.SarShalom\Desktop\origing and output file\originfileCSVversion 4.0.csv"
Set xlsApp = CreateObject("Excel.Application") Set xlswb = xlsApp.Workbooks.OpenXML(xmlFile,2) xlswb.SaveAs csvFile, 6 xlswb.close false xlsApp.quit
TrueOrFalse = "Same" DataTable.Import("C:\Users\Aviad.SarShalom\Desktop\origing and output file\originfileCSVversion 4.0.csv") FirstTableCount = DataTable.GetRowCount DataTable.Import(csvFile) SecondTableCount = DataTable.GetRowCount if (FirstTableCount <> SecondTableCount) then msgbox "Both files are not Equal" else For I = 1 To FirstTableCount DataTable.Import("C:\Users\Aviad.SarShalom\Desktop\origing and output file\originfileCSVversion 4.0.csv") Datatable.SetCurrentRow(I) value1 = DataTable.Value(1) MsgBox value1 DataTable.Import(csvFile) Datatable.SetCurrentRow(I) value2 = DataTable.Value(1) MsgBox value2 if(value1 <> value2) then TrueOrFalse = "Different" Exit For end if Next
Test data structure of csv file and business rules This is an explanation about the Structure of the CSV fileAdviser The Adviser record contains details about an adviser and the organisation for which they are associated. An Adviser record must exist if the adviser (i.e. Adviser ID) is referenced in another record type.
Field Name Format Mandatory / Optional Mandatory Mandatory Mandatory Description
Abbreviation used to define record type - ADV EPI Version - 4.0 A unique identifier for the Platform Provider. This field is supplied to the Platform Provider by the External Platform Interface custodians. Platform Providers identifier for the group of advisers extracted in the file (as referenced in Extract Identification record). Platform Providers unique identifier for the Adviser. Financial Planning Software identifier for Adviser. APIR Participant Code for Adviser. Format: AA99999AA
Extract ID
A (60)
Mandatory
Advisers last name as registered with Platform Provider. Advisers first nam e as registered with Platform Provider. Advisers title. Allowable values are: y y y y y y y y y y y Mr Mrs Ms Miss Dr Prof Sir Lady Father Rev Other.
Gender
A (7)
Mandatory
Field Name
Format
Mandatory / Optional
Business Name
A (60)
Optional
Registered Name of business for which the adviser is associated. APIR Participant Code for organisation that the adviser is associated. Format: AAAA999AA
A (9)
Optional
Branch name for which the adviser is associated. Advisers Australian Business Number. Australian Company Number / Australian Registered Body Number. The preferred contact method for the Adviser. Allowable values are: y y y y y Address Phone Email Web Unknown.
A (10)
Mandatory
24/04/2010 9:0
Nominated contact method must have a corresponding PPR 4 Contact Details record, unless method is Unknown.
HDR,4,24/04/2010 9:03,PPR,1,F,,,,,,,,,,, PPR,4,AON,Aon Consulting Pty Ltd,APIR123AU,Address,Address,,,,,,,,,, EXT,4,AON,Extract123,,,,,,,,,,,,, ADV,4,AON,Extract123,Adviser-AON,VL-AdviserAON,4.2631E+12,Wallace,William,MR,Male,AON FINANCIAL PLANNING AND PROTECTION,APIR123AU,Desk 95,53078119212,53078000000,Email TRL,4,3,,,,,,,,,,,,,,
csv file
AON_20100424_Extr act123_003.csv
using sql with the below command (I just need to insert into an input box what is the advisor code numer) select * from AdvisorDetails where AdvisorCode='Adviser-AON'
and it will generate the below xml file string in the data base
outputXMLfile.xml