Micro Focus QTP (UFT) Forums
What is error in script? - Printable Version

+- Micro Focus QTP (UFT) Forums (https://www.learnqtp.com/forums)
+-- Forum: Micro Focus UFT (earlier known as QTP) (https://www.learnqtp.com/forums/Forum-Micro-Focus-UFT-earlier-known-as-QTP)
+--- Forum: VB Scripting/Descriptive Programming (https://www.learnqtp.com/forums/Forum-VB-Scripting-Descriptive-Programming)
+--- Thread: What is error in script? (/Thread-What-is-error-in-script)



What is error in script? - rahul1234 - 11-10-2009

Hi All,
i have one querry regarding script.
I was trying to parametrize the value from datatable, i wrote like this

Code:
Dim AgentName
AgentName=Datatable.value("AgentName")
Dialog("Login").Winedit("AgentName:").Set datatable("Agent",dtClobalsheet)

When i run the script it was picking the value from datatable and result window was also displaying the value which was taken from the datatable, while it should display some error. Because i wrote dtClobalsheet rather then dtGlobalsheet.
Even i did not wrote Option Explicit.
Can you let me know why it happened?


RE: What is error in script? - Saket - 11-11-2009

hi rahul1234,
The 'SheetID' argument for DataTable.Value is optional and the values could be the sheetname, index or dtLocalSheet or dtGlobalSheet.
If you do not specify a value for this, the first sheet in the datatable is used i.e global sheet.

This will work for any value you specify like MySheet, dtdemoSheet etc. I think QTP treats this as a variable and it gets it as empty as not declared anywhere and uses the first sheet. this is why your script is working.
Use Option Explicit.


RE: What is error in script? - rahul1234 - 11-11-2009

Hi Saket,
Thanks for your reply. And it cleared my doubt.