View Full Version : Grouping Multiple Criteria with .filter

Feb 28th, 2007, 11:25 PM
I am having trouble with some Javascript code.

I am working with TDC. specificaly the .filter property.

The below code, as it's written, works exactly like I want by filtering the table by 2 criteria. The problem is that I want the Month and Location (Highlighted in red) to be variable, not constant.

dispManLevel.filter=" (dispMon=February-2007) & (dispLocation=Wilmington, NC - 800 Line) "

I tried creating variables: (I know these are still constant, this is for demo purposes)
var filtMonth = "February-2007"
var filtLocation = "Wilmington, NC - 800 Line"

Then I re-wrote the code as:
dispManLevel.filter=" (dispMon=filtMonth) & (dispLocation=filtLocation) "

For some reason, once I replace with the variable, the line of code stops working, as though the line is not reading the variables. Am I breaking some sort of programing rule? If so, what can I do?

Feb 28th, 2007, 11:54 PM
dispManLevel.filter=" (dispMon="+filtMonth+") & (dispLocation="+filtLocation+") ";