Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Function return value is not passed during the 3rd iteration
#1
Not Solved
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")

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
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Object not found during the 2nd iteration of an Action call in a For loop BGunay 0 966 04-23-2020, 07:08 PM
Last Post: BGunay
  Click after CheckProperty to a WebElement passed via Function argument fails naruoga 0 1,152 02-28-2019, 11:46 AM
Last Post: naruoga
  UFT Tool runs more than one iteration always cthossain 2 3,709 02-12-2017, 01:25 PM
Last Post: cthossain
  Calling a function in a Test Script from a function library anupam4j 3 6,110 06-26-2015, 12:31 AM
Last Post: babu123
  Iteration in Local sheets for UFT11.5 haithamQTP 1 3,187 02-27-2014, 09:12 AM
Last Post: supputuri

Forum Jump:


Users browsing this thread: 1 Guest(s)