Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Loop thru 3 colunms of a file, stop, then restart at 4th column

Status
Not open for further replies.

sheri100

Programmer
Joined
Feb 8, 2006
Messages
2
Location
US
I have test scripts (mostly Javascript) that reads the first row of a .tsv file to set parameters in my application. These parameters determine the data to be displayed within the application. I have a second .tsv file that contains the same data as the table in my application. I then compare the second data file to the table data to make sure the values are correct. This all works correctly but it requires me to have multiple data files for every different set of parameters, could be upwards of 800 files. My display tables are always 3 by 10. I would like to put all the table data in one file. In other words read the first row of the parameter file, compare the first 3 by 10 set of data, read line 2 of the parameter file and compare it to the second 3 by 10 set of data.
The code is as follows;

testData.put("import.tsv");

var set = testData.dataset("import.tsv");

for(var pv_data in set){


format = testData.field(set[pv_data], "Format") ;
name = testData.field(set[pv_data], "Name") ;
btflag = testData.field(set[pv_data], "BT Flag") ;
xaxis = testData.field(set[pv_data], "X-axis") ;
yaxis = testData.field(set[pv_data], "Y-axis") ;
slice1 = testData.field(set[pv_data], "Slice1") ;
slice2 = testData.field(set[pv_data], "Slice2") ;
slice3 = testData.field(set[pv_data], "Slice3") ;
file = testData.field(set[pv_data], "File") ;

//code that calls the above variables omitted

for ( i = 0; i<=2; i++)

{
runTest = true ;
// Verification Point 'VP1'
//the variable "file" reads a file with the data
testData.put(file);
var dataSet = testData.dataset(file);

for (var numRow in dataSet)
{

table = findObject(":MainWindow.QHBox1.QWorkspace1.Model View.VMSMain.vmsStack.VMSViewAssumptions.mainFrame.pageFrame.assumptionTabWidget.tab pages.dataTab.dataDisplayTable");

cell = table.item(numRow, i);

var compare = cell.text();
print ("this is compare " + compare);

var data = testData.field(dataSet[numRow], i) ;

test.compare(compare, data);

runTest = false;

}

}
}


Thanks in advance for any help...
 
You've not said which bit(s) you need help with. Nor have you said what you're tried so far (if anything), or how the data needs to be compared.

You've also given code which is pretty much useless to understand without knowing the details of the method calls involved.

So to resolve this, how about telling us what you've tried so far, and specifically why it isn't working?

Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
This is what I need help with...

for ( i = 0; i<=9; i++) - i loops thru the columns in my application table data and my .tsv file

numRow loops thru the rows in my application table data and my .tsv file

test.compare(compare, data); compares the table data in my application to the data in my .tsv file which is called using the variable "file"

The script I posted earlier works, I want to enhance it. Depending on what parameters I pass my application determines what data is displayed in the table. The data is always displayed in 3 rows by 10 columns. The .tsv file is in the same format and a comparison is made between the two.

Imports.tsv contains the parameters that the application reads to determine what data to display, which is close to 800 different combinations and currently requires me to have close to 800 files of data to do that. Everytime var file is called it reads the .tsv associated with the parameters.

I would like to be able to use only 2 .tsv files. One for the parameters (Imports.tsv) and one for all the possible data combinations and still be able to do my comparisons.

If I put all my data combinations in one file, I somehow need to read the first 3 rows of that file, return to the beginning of the code (for(var pv_data in set)) which will change the parameters and then read the next 3 rows in my data combinations file.

I really have no idea how to get this to work.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top