01-25-2010, 08:50 PM
Code:
Dim rowcount, i, j, CatMatchFound
CatMatchFound = false
rowcount = datatable.GetSheet( "CategoryReportData").GetRowCount
'***Include 1 space after the last word in CategoryVal(ex. "Uniforms_") the _ represents a space****
For i = 1 to rowcount
CategoryVal=datatable.Value("Category", "CategoryReportData")
CategoryTot = datatable.Value("Total", "CategoryReportData")
'msgbox (CategoryVal)
rowcountofcompare = datatable.GetSheet( "Check Detail Lines on Category Report").GetRowCount
For j = 1 to rowcountofcompare
'msgbox( datatable.GetSheet( "Check Detail Lines on Category Report").GetRowCount)
CompareVal =datatable.Value("Category","Check Detail Lines on Category Report")
CompareTot =datatable.Value("Total", "Check Detail Lines on Category Report")
' msgbox(CompareVal)
If CategoryVal= CompareVal Then
CatMatchFound = true
If CategoryTot = CompareTot Then
Print "Match on Category Total Report : "&(CategoryVal) &" $" & (CategoryTot)& _
" matches " &(CompareVal)&" $" &(CompareTot)
Reporter.ReportEvent 0, "Category Report Check" , "The Category and Total displayed on the report matches expected results."
'Msgbox (rowcount) & " rows "&(CategoryVal)
Else
'Print "Category Total report also included other invoices for this category: " &(CategoryVal)
Print " WARNING : Partial match found. Please verify that the Category being "
Print " added does not exist and re-run the test. "
Print " *****************************************************************************************************"
Print " Detail : The Category Total Report displays "&(CategoryVal) &" $" & (CategoryTot)
Print " does not match expected values: " &(CompareVal)&" $" &(CompareTot)
Print " *****************************************************************************************************"
Reporter.ReportEvent 3, "Category Report Check" , "The Category and Totals displayed on the report do not match expected results. " & _
"The Category Total Report displays "&(CategoryVal) &" $" & (CategoryTot) & _
" which is not matching the expected values: " &(CompareVal)&" $" &(CompareTot)
'msgbox (CategoryVal)
End If
End If
DataTable.GetSheet("Check Detail Lines on Category Report").SetNextRow
Next
DataTable.GetSheet( "CategoryReportData").SetNextRow 'Insert Runtime datatable
Next
If (CatMatchFound = false) Then
Print "********************************************************************************************************"
Print "No matches found for Category - this message only displays if the Category.Value on the "
Print "Check Detail Lines on Category Report action did not match due to before and/or after "
Print "spaces with each value. Correct by adding a space before or after the value and re-run "
Print "********************************************************************************************************"
Reporter.ReportEvent 1, "Category Report Check" , "Actual does not match expected results for a match on Category"
End If