salley
8 years agoFrequent Contributor
Help on looping through data array
Hello,
I need to iterate through the data and use them in username and password fields. user name a then password 100 ,, and then b 200. can somebody please look at my code and help please. thanks
Username Password
a|B|C 100|200|300
Set ObjExcelApp=Sys.OleObject("Excel.Application")
Set ObjWoorkBook=ObjExcelApp.Workbooks.Open("Path")
Set ObjWorkSheet=ObjWoorkBook.Sheets("Sheet1")
i=2
StrUname=trim(ObjWorkSheet.Cells(i,1))
StrPW=trim(ObjWorkSheet.Cells(i,2))
UArray=Split(StrClassCode,"|")
PArray=Split(strExposure,"|")
'I am just not sure how to loop through the data use them accordingly,,,,
For i=0 to Ubound(UArray)
for j=0 to UBound(PArray)
msgbox UArray(i)
MsgBox PArray(j)
Next
Next
I guess you can do like below,
function CurDriverExample() { // Creates a driver DDT.ExcelDriver("C:\\MyFile.xls", "Sheet1"); var colSkipper = 0; // Iterates through records while (! DDT.CurrentDriver.EOF()) { //Gets a value from the storage and posts it to the log for(var c = colSkipper ; c < DDT.CurrentDriver.ColumnCount ; c++){ Log.Message(DDT.CurrentDriver.Value(c)); } colSkipper++;//to skip one col in each row DDT.CurrentDriver.Next(); } // Closes the driver DDT.CloseDriver(DDT.CurrentDriver.Name); }