
- Forum
- Testing
- Software Testing
- Error in QTP
Error in QTP
This is a discussion on Error in QTP within the Software Testing forums, part of the Testing category; Hi. I am having some problems with the following code. _________________________________________________ Dim Count Dim BankCount BankCount = Int (DataTable.Value("A", dtGlobalSheet)) ...
-
Error in QTP
Hi.
I am having some problems with the following code.
_________________________________________________
Dim Count
Dim BankCount
BankCount = Int (DataTable.Value("A", dtGlobalSheet))
Count = 0
Do until Count = BankCount
Count = Count +1
msgbox Count
msgbox BankCount
wait 1
Loop
_________________________________________________
The script runs successfully, however when the scripts Count = Bankcount, the execution cycle is looping back to the beginning of the script, and produces the following error.
Error:
Type mismatch: '[string: ""]'
Details:
Line (4): "BankCount = Int (DataTable.Value("A", dtGlobalSheet))".
Could someone please tell me:
1 - Why the script loops back to the beginning once Count = BankCount
2 - Why an error is being returned on the above line of code only on the second pass / why no error is returned on the above line of code on the first pass .. ??
Looking forward to seeing your thoughts / suggestions / script alteration recommendations ...
thanks - and happy new year
-
07-04-2008, 03:16 PM #2
- Join Date
- Apr 2008
- Answers
- 8
do wat? u have to give some statements or funtion to do before until statementHi.
I am having some problems with the following code.
_________________________________________________
Dim Count
Dim BankCount
BankCount = Int (DataTable.Value("A", dtGlobalSheet))
Count = 0
Do until Count = BankCount
Count = Count +1
msgbox Count
msgbox BankCount
wait 1
Loop
_________________________________________________
The script runs successfully, however when the scripts Count = Bankcount, the execution cycle is looping back to the beginning of the script, and produces the following error.
Error:
Type mismatch: '[string: ""]'
Details:
Line (4): "BankCount = Int (DataTable.Value("A", dtGlobalSheet))".
Could someone please tell me:
1 - Why the script loops back to the beginning once Count = BankCount
2 - Why an error is being returned on the above line of code only on the second pass / why no error is returned on the above line of code on the first pass .. ??
Looking forward to seeing your thoughts / suggestions / script alteration recommendations ...
thanks - and happy new year
-
Hi Abuzzi,
You have given the Msgbox right within the loop.. What is the value getting displayed that time??
Is it coming correctly?
-
07-24-2008, 04:26 AM #4
- Join Date
- Aug 2007
- Answers
- 2
Hi,
U plz try with this code as it can take u for infinite loop
BankCount = DataTable.Value("A", dtGlobalSheet)
regards,
Kavita
-
I have encountered the same problem as the original poster.
This code stays in an infinite loop.
intNumRows = 1
intMaxRows = DataTable.Value("Test", dtGlobalSheet)
MsgBox(intMaxRows)
Do Until intNumRows > intMaxRows
MsgBox("In Loop: " & intNumRows)
intNumRows = intNumRows + 1
Loop
This code works fine.
intNumRows = 1
intMaxRows = DataTable.Value("Test", dtGlobalSheet)
MsgBox(intMaxRows)
Do Until intNumRows > 2
MsgBox("In Loop: " & intNumRows)
intNumRows = intNumRows + 1
Loop
I don't know why the first code stays in an infinite loop.
-
Use Cint as follows,
intMaxRows = Cint(DataTable.Value("Test", dtGlobalSheet))
-
what does msgbox(intMaxRows) return in the first case ??I have encountered the same problem as the original poster.
This code stays in an infinite loop.
intNumRows = 1
intMaxRows = DataTable.Value("Test", dtGlobalSheet)
MsgBox(intMaxRows)
Do Until intNumRows > intMaxRows
MsgBox("In Loop: " & intNumRows)
intNumRows = intNumRows + 1
Loop
This code works fine.
intNumRows = 1
intMaxRows = DataTable.Value("Test", dtGlobalSheet)
MsgBox(intMaxRows)
Do Until intNumRows > 2
MsgBox("In Loop: " & intNumRows)
intNumRows = intNumRows + 1
Loop
I don't know why the first code stays in an infinite loop.
-
01-25-2011, 01:14 PM #8
- Join Date
- Jan 2011
- Answers
- 1
Its not a problem with code...
when you delete a value from datatable using delete key on keyborad it leaves the value as null string...
and if your run settings is to run on all rows then the test will run for more that one time..
now second time the problem is the its checking count(intezer) with bankcount(string) so Type mismatch: '[string: ""]' is coming...
to solve this just go to File->settings-> Run... and make it run one iteration only...(remember when deleting from a datatable use right click ->edit->delete)
-
Sponsored Ads

Reply With Quote






