Forum Discussion
8 Replies
- tristaanogreEsteemed ContributorThere are a couple of ways of doing this.
First, if your excel file has a column of unique ID's, you could modify your DDT driver to query for the specific ID's. Something likevar MyDDTDriver = DDT.ExcelDriver("C:\\Temp\\MyExcel.XLS", "MyDataSheet", true)
MyDDTDriver.ADOCommandObject.CommandText = "SELECT * from MyExcel.XLS where ID BETWEEN 5 AND 9"
Now, the SQL statement I have here might be incorrect... I personally work with CSV files which simplifies the queries a bit.
The second way is to increment through the loop. This takes a bit of a performance hit but it is a legitimate way and actually will translate if you're doing this in a keyword test.var MyDDTDriver = DDT.ExcelDriver("C:\\Temp\\MyExcel.XLS", "MyDataSheet", true)
var CurrentRecord=1
var StartRecord = 5;
var EndRecord = 9
for(CurrentRecord=1;CurrentRecord<=StartRecord;CurrentRecord++)
{
MyDDTDriver.Next()
}
while ((!MyDDTDriver.EOF()) && (CurrentRecord <= EndRecord))
{
DoWhatINeedToDo()
CurrentRecord = CurrentRecord++
MyDDTDriver.Next()
}
Note, the code has not been tested but that's how I would probably handle it. - LouisContributorIf you're using keyword testing, you can double click on your data driven loop and follow the propmpt for selecting your excel data source. You can then specify the start and finish lines of the driving data e.g start line 5 finish line 10
- ngocvo3103_1Occasional ContributorHi all,
Thank you for answering me. I'm sorry for not specifying the case that I'm using script.
To Robert Martin, can you please more specify about the first way? I think that's exactly what I'm looking for. I have a case, if I'm using the SQL Server 2008 to store test data, how can I retrieve it using the DDT?
Thanks,
Ngoc Vo - tristaanogreEsteemed ContributorFor a SQL database, use DDT.ADODriver.
To use the specific values or rows you want from that driver, you would, again, reference the ADOCommandObject from the driver and set the CommandText to the SQL query you want. - paramveerContributorHi
I want to make a text file where i will store my customize logs corresponding to action performed in my customized keywords.
So how could i get access to current log folder in the project.
Also suggest me the best way to work with environmental variable.
Plz help... - YMinaev
Staff
Hi,
There's no way to access the current log. Export it to XML and parse the created file, work with the logs of previous executions, or handle log events such as OnLogMessage, OnLogError, etc and save messages to an external file in their handlers.
As for environment variables, use the aqEnvironment.GetEnvironmentVariable method.
Also, your question is not related to the topic of this thread. In such cases, create new threads rather than posting unrelated questions to existing ones. - paramveerContributorDear Jared,
You didn't got my question, i want to get the handle to current log folder to create a text file in that folder..
Thanks in advance - tristaanogreEsteemed ContributorFirst, as Jared mentioned, please post new questions in new threads. It helps make them more searchable and relevant.
In any case, by default, logs for a project are stored in the Log folder under the project folder. So, as long as you're using the standard project pathing, your log folder can be found by concatenating a string likevar LogFolder = Project.Path + "\\Log\\"