Search Criterion with date variables



I'm using BOS 5.0.9

I'm trying to add a date variable to my search criterion, but can't get the expected results

My code is:

  1. SearchDate start_date = new SearchDate(valueStartDate)<br />
  2. SearchDate end_date = new SearchDate(valueEndDate)<br />
  3. query<br />
  4. .criterion(ProcessInstanceIndex.VARIABLE_NAME).equalsTo(myDate)<br />
  5. .and(<br />
  6. .criterion(ProcessInstanceIndex.VARIABLE_VALUE).ranges(start_date.toString(), end_date.toString(), false)

the issue is that this returns the following query:

 AND variable_name:myDate AND variable_value:[20131020230000000 TO 20131121000000000]

this is not what I want, What I need is something that return a query like:

 AND myDate:[20131020230000000 TO 20131121000000000]

not two "ands".

How can I achieve that in my groovy script?

Thanks in advance,


No answers yet.