Highlighted
Absent Member.. Absent Member..
Absent Member..
144 views

is there a better way for validation

Good Morning

I am just wondering if there was a better/cleaner way to preform the following validation.

My main issue is that the following fails

Validation 1 Failed to validate Automation Test Item 1:Automation Test Item 1

While they are identical I still get failures.  I had to put in code to strip all spaces out so that I can get it to pass.

Is there a better way to validate the 2 variable to match other then the IF statements shown below?


Thanks

Jack Fritz CTFL

 

 

 

' VALIDATE THE DATA

' Line 1
Line1_Description = Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_Description").GetROProperty("value")," ","")
Line1_PostedReceived = Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_Posted Received").GetROProperty("value")," ","")
Line1_AmountDue = Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_Amount Due").GetROProperty("value")," ","")
Line1_DebitActNo = Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_Debit Account No").GetROProperty("value")," ","")
Line1_Qnty = Replace(OracleFormWindow("AR Invoice Receiving").OracleTable("Qnty_UnitPrice_AdjExtCost").GetFieldValue(1,1)," ","")
Line1_UnitPrice = Replace(OracleFormWindow("AR Invoice Receiving").OracleTable("Qnty_UnitPrice_AdjExtCost").GetFieldValue(1,2)," ","")
Line1_AdjExtCost = Replace(OracleFormWindow("AR Invoice Receiving").OracleTable("Qnty_UnitPrice_AdjExtCost").GetFieldValue(1,3)," ","")
Line1_AmtPaid =Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_AmtPaid").GetROProperty("value")," ","")
Line1_AmtCancel = Replace(OracleFormWindow("AR Invoice Receiving").OracleTextField("Line1_AmtCancel").GetROProperty("value")," ","")



If Line1_Description <>  Replace(dataTable("Line_1_Item_Desc""FRENT01A.FMX")," ","") Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_Description " & Line1_Description & ":" & dataTable("Line_1_Item_Desc""FRENT01A.FMX")
End If

If Line1_PostedReceived <>  Replace(dataTable("Line1_PostedReceived", dtLocalSheet)," ","") Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_PostedReceived " & Line1_PostedReceived & ":" & dataTable("Line1_PostedReceived", dtLocalSheet)
End If

If Line1_AmountDue <>  dataTable("Line1_AmountDue", dtLocalSheet) Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_AmountDue " & Line1_AmountDue & ":" & dataTable("Line1_AmountDue", dtLocalSheet)
End If

If Line1_DebitActNo <>  dataTable("Line1_DebitActNo", dtLocalSheet) Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_DebitActNo " & Line1_DebitActNo & ":" & dataTable("Line_1_Debit_Account_No""FRENT01A.FMX")
End If

If Line1_Qnty <>  dataTable("Line_1_Quantity""FRENT01A.FMX") Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line_1_Quantity " & Line1_Qnty & ":" & dataTable("Line_1_Quantity""FRENT01A.FMX")
End If

If Line1_UnitPrice <>  dataTable("Line_1_Unit_Price""FRENT01A.FMX") Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line_1_Unit_Price " & Line1_UnitPrice & ":" & dataTable("Line_1_Unit_Price""FRENT01A.FMX")
End If

If Line1_AdjExtCost <>  dataTable("Line_1_Adj_Ext_Cost""FRENT01A.FMX") Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_AdjExtCost (118.62) " & Line1_AdjExtCost & ":" & dataTable("Line_1_Adj_Ext_Cost""FRENT01A.FMX")
End If

If Line1_AmtPaid <>  dataTable("Line1_AmtPaid", dtLocalSheet) Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_AmtPaid " & Line1_AmtPaid & ":" & dataTable("Line1_AmtPaid", dtLocalSheet)
End If

If Line1_AmtCancel <>  dataTable("Line1_AmtCancel", dtLocalSheet) Then
    Reporter.ReportEvent micFail, "Validation", iteration & " Failed to validate Line1_AmtCancel " & Line1_AmtCancel & ":" & dataTable("Line1_AmtCancel", dtLocalSheet)
End If

0 Likes
1 Reply
Highlighted
Outstanding Contributor.
Outstanding Contributor.

Re: is there a better way for validation

Hi JFritz,

Try using the below to compare expressions:

result= expression1 comparisonoperator expression2

result= object1 Is object2

The Is operator has specific comparison functionality that differs from the operators in the following table. The following table contains a list of the comparision operators and the conditions that determine whether result is True, False or Null:

comp.PNG

comp2.PNG

Hoppe you will find well this information

Regards,

 

 

Ruddy Alvarez H.
Customer Support Engineer

If you find thst aat this or any other post resolves your issue, please be sure to mark it as an accepted solution.
If you are satisfied with anyone’s response please remember to give them a KUDOS by clicking on the STAR at the bottom left of the pond show your appreciation.
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.