10-16-2014, 09:40 PM
(This post was last modified: 10-16-2014, 09:46 PM by premanand1979.)
Hello guys,
I have a function to get data table values for my test, based on the function return value (True or False), I am doing subsequent actions. The function return value is getting passed successfully for the first two runs and it returns a empty value during the 3rd run. The return value of the function is maintained until it comes out of the function.
Please see below the example function call and code. The first two function calls Apple and Orange are working fine. Test is failing for the third functional call Banana.
Call Sample_Function(1,"Apple")
Call Sample_Function(2,"Orange")
Call Sample_Function(3,"Banana")
I have a function to get data table values for my test, based on the function return value (True or False), I am doing subsequent actions. The function return value is getting passed successfully for the first two runs and it returns a empty value during the 3rd run. The return value of the function is maintained until it comes out of the function.
Please see below the example function call and code. The first two function calls Apple and Orange are working fine. Test is failing for the third functional call Banana.
Call Sample_Function(1,"Apple")
Call Sample_Function(2,"Orange")
Call Sample_Function(3,"Banana")
Code:
Function Sample_Function(RowId,SearchCriteria)
Dim DataStatus
DataStatus = Retrieve_Excel_Data(RowId)
If DataStatus = True Then 'It returns a empty value during 3rd run
Msgbox "Sucess"
Else
Msgbox "Failed"
End If
End Function
Function Retrieve_Excel_Data(RowId)
Dim XlsStatus, Source, Target, RowCount
XlsStatus = False
DataTable.AddSheet(Target)
DataTable.ImportSheet "C:\a.xls", Source, Target
RowCount = DataTable.GetSheet(PO_Target_SheetName).GetRowCount
If RowCount < 1 then
XlsStatus = True
Retrieve_Excel_Data = XlsStatus
Else
Retrieve_Excel_Data = XlsStatus
End If
End Function