Dynamic If Statment
Is it possible to create an if statment with dynamic logical tests? For example, I have a .csv file that has a file name in the first column, and the columns after that have random tag data. The first row of the .csv is a header (so it's pretty much just ignored), the second row is the file and tags to be compared to the others, the third row is the header for the file name column and all of the tag category columns after that, and below that are all the files and their tags to be compare row 2 to. The problem is, not every category of files has the same number of tags, and not all tags may be necessary for the comparison, so I was going to have a dialog window of checkboxes come up listing the header row's non-null tag columns as individual checkboxes. The if statement would then need to compare all of the selected columns to the other listed files (the on row 4 and below) to find any that contain the exact same tags as the source file (the one in row 2).
Below is kind of a rough mock-up of what I'm trying to do.
var baseTag = [];
baseTag = data[1].split(','); //the comparison row's columns loaded to the baseTag array
if(checkbox1.value) tag1 = true;
if(checkbox2.value) tag2 = true;
if(checkbox3.value) tag3 = true;
///etc. etc.///
//check for any files that match
for(i=3;i<data.length;i++) { //data being the array containing all the rows of the .csv
var tag = [];
tag = data.split(',');
if(baseTag[1] == tag[1] && baseTag[2] == tag[2] && baseTag[3] == tag[3] /*etc*/) { //this needs to be set up so that if tag2 = false, it doesn't do the "baseTag[2] == tag[2]" check; but if it's true, it does check it
open(tag[0]);
}
}
Anyway, any ideas on how to do this? I have the feeling it's something simple, but just can't seem to figure it out. Thanks in advance for any help!
dgolberg