RLabkey makeFilter with filters as variable?

LabKey Support Forum (Inactive)
RLabkey makeFilter with filters as variable? Ben Bimber  2018-01-15 15:55
Status: Closed
 
HI Jon

Yes, i mis-typed EQUALS/EQUAL, though that's not the problem here. The example you added is exactly like what I posted at the start of the thread:

makeFilter(c("myColumn", "EQUAL", "value1"), c("myColumn2", "CONTAINS", "value2")),

That is calling makeFilter with a list of vectors, each of which represents a filter. I'd like to build up this list of filters dynamically in code before calling makeFilter(). More like the following (which does not work):

#start with some default filters
filters <- list(
     c('myColumn', EQUAL,'value1'),
     c('myColumn2',EQUAL,'value2)
)

#some event in code determines whether to add more filters
if (something == true){
  filters <- append(filters, c('myColumn3',EQUAL,'value3))
}

#now pass my dynamically created list to makeFilter()
makeFilter(filters)

There must be a way to do this. As i posed above, in Rlabkey, makeFilter uses '...', R's elipsis argument, which seems vaguely like java varargs; however, I cant figure out a way to pass in a datatype to makeFilter() that will work. I basically need a vector of vectors, though i cant figure out how to get R to generate that.