Micro Focus QTP (UFT) Forums
problem with retieving the data from the datatable - 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: problem with retieving the data from the datatable (/Thread-problem-with-retieving-the-data-from-the-datatable)



problem with retieving the data from the datatable - vijay44 - 01-25-2010

Hi,
Code:
Set oShell = CreateObject("WScript.Shell")
sCurrDir=oShell.CurrentDirectory
pCurrpath=Split(sCurrDir,"\")
For i=0 to ubound(pCurrpath)-2
    sCurrentPath=sCurrentPath & pCurrpath(i) &"\"
Next
'####import the data File
InputXls=sCurrentPath &"\Data\Icentral.xls"
Datatable.AddSheet("Icentral")
Datatable.ImportSheet ""&InputXls&"","Icentral","Icentral"
Public oSheetName
    oSheetName="Icentral"
x=Datatable.GetSheet("Icentral").getrowcount
For row=4 to x
pszListDataTableNames="N_NullUserLogin,N_InvalidUserLogin,N_InvalidpassLogin,N_NullUserLogin,N_ValidUserLogin"
      pszListDataTableNames=split(szListDataTableNames,",")
    For a= 0 to ubound(pszListDataTableNames)
    If   (pszListDataTableNames(a)=datatable.Value("Scenario_name",oSheetName)) then
       x=Datatable.GetSheet("Icentral").getrowcount
       datatable.SetCurrentRow(row)
eporter.ReportEvent micDone,"------------End of Scenario------------",row
    End If

    Next
    datatable.SetNextRow
Next


I am using the above code, even though i am starting tthe iteration from 4, it does not stop the iteration, it goes on execution again iteration 4.
my script should exit as there are only 4 iterations to be run, and its staring from 4th one.

Any help will be really appreciated

Regards;
vijay


RE: problem with retieving the data from the datatable - manabh - 01-25-2010

Hi,
Please check your driver script setting. It must be "Run on All Iterations" .... (By Default.) .Change it to "Run one iteration".


RE: problem with retieving the data from the datatable - vijay44 - 01-25-2010

[quote='manabh' pid='10017' dateline='1264426649']
Hi,

the settings are fine, i want to exit the for loop specified, as soon as it finishes the iteration.
The no of datatable rows are 4
specified iteration to start from 4
the problem over here is its repeating the same iteration, it should exit the for loop.

Any help will be really appreciated.
Regards;
vijay


RE: problem with retieving the data from the datatable - sreekanth chilam - 01-26-2010

Hi ,

I assume Run Settings are fine and suggest you to try as given below.

Code:
x=Datatable.GetSheet("Icentral").getrowcount
   For row=4 to x
   Datatable.GetSheet("Icentral").SetCurrentRow(row)
pszListDataTableNames="N_NullUserLogin,N_InvalidUserLogin,N_InvalidpassLogin,N_NullUserLogin,N_ValidUse​rLogin"
pszListDataTableNames=split(szListDataTableNames,",")
For a= 0 to ubound(pszListDataTableNames)
If (pszListDataTableNames(a)=datatable.Value("Scenario_name",oSheetName)) then
x=Datatable.GetSheet("Icentral").getrowcount
datatable.SetCurrentRow(row)
eporter.ReportEvent micDone,"------------End of Scenario------------",row
End If
Next
Next