Micro Focus QTP (UFT) Forums
QTP Script - Doubt regarding moving the control to a specified line - 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: UFT / QTP Beginners (https://www.learnqtp.com/forums/Forum-UFT-QTP-Beginners)
+--- Thread: QTP Script - Doubt regarding moving the control to a specified line (/Thread-QTP-Script-Doubt-regarding-moving-the-control-to-a-specified-line)



QTP Script - Doubt regarding moving the control to a specified line - natrajr83 - 08-06-2008

Hi,
I am using VB script in the QTP. I am a beginner. I need help in knowing the command that is used to move the control to a specified line number. For ex say going to a step 10 lines before the current line or 10 lines after the current line. Please help.

Thanks,
Nataraj.R


RE: QTP Script - Doubt regarding moving the control to a specified line - surya_7mar - 08-06-2008

Try Ctrl+G to jump to a Specified Line


RE: QTP Script - Doubt regarding moving the control to a specified line - natrajr83 - 08-06-2008

Thanks for your reply Surya. I am writing the script in the expert view and i want to know if there is any command that can be written manually so that when i run the script, after a particular step the control passes on to the specified nth step and if it proceeds from there. I dont know what i am telling is either correct or if it is possible.


RE: QTP Script - Doubt regarding moving the control to a specified line - surya_7mar - 08-06-2008

Use Goto.

See the QTP help


RE: QTP Script - Doubt regarding moving the control to a specified line - prince3105 - 08-06-2008

Hi Surya , What Nataraj is telling that, while running the script can we jump from one line and ask QTP to goto a particular line? Like "goto" statement in "C" language. Unfortunately there is no facillity in Vbscrpt and QTP. Instead of it you can use If else statement and Select statement


RE: QTP Script - Doubt regarding moving the control to a specified line - natrajr83 - 08-06-2008

Yes Prince, that is what i meant. I am having a set of values in the data table which i am calling through the script using the following statement:
Code:
If datatable.Value("English", dtGlobalSheet)="Save"
Then
    Browser("Browser").Page("Page").WebButton("Save").Click
DataTable.SetNextRow
End If

If datatable.Value("English", dtGlobalSheet)="Back"
Then
    Browser("Browser").Page("Page").WebButton("Back").Click
DataTable.SetNextRow
End If

By using this i am calling the values of the next next rows continously. If i use the same in the loop, the last value that will get set will be Back. So my QTP looks for this particular word Back instead of Save which i used it in the previous If condition. I can very well use

Code:
DataTable.SetPreviousRow

to set the value for Save. But the same will become too complex when there are suppose say 10 buttons in the next next row of data table. So i wanted an alternate way of doing that. Is it still possible to use If else and Select statements?
Please help.