I want to implement a simple date filter and I feel it is not as easy as I thought it is.
DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
Date date = new Date();
String datestring = dateFormat.format(date);
ExpressionFilter dateFilter = new ExpressionFilter("datefield1 <= datestring", String.class);
inputPipe = new Each(inputPipe,dateFilter);
datefield1
is a field in the inputPipe
which I want to filter on based on the current date. The problem with the above code is that it expects to find the fields mentioned in the ExpressionFilter
to be present in the inputPipe
. datestring
is not a field in the inputPipe
and hence it is failing there.
Also tried this way but it throws a compile error. I'm new to Cascading and Java, so please excuse if I miss anything.
ExpressionFilter dateFilter = new ExpressionFilter("datefield1 <= "+datestring, String.class);