Using criteria for Date column

Issue #9 resolved
Anonymous created an issue

I am trying to get rows on basis of Date (less-than and greater-than).I tried following code.



var criteria:Criteria= eManager.createCriteria(AssessmentDetailDTO); criteria.addGreaterThanCondition("assessment_created_date", currentDate);

var result:ArrayCollection= eManager.fetchCriteria(criteria); }}}

I get Syntax error.

Can anybody did this before?

Thanks, Indrajit

Comments (16)

  1. Christian Junk

    The method addGreaterThanCondition requires a String as second argument:

    public function addGreaterThanCondition(property:String, str:String):Criteria

    But even if you add the date as String it doesn't work. I have to update the code to archive this functionality.

  2. Indrajit Pingale


    I tried latest swc. But could not get the expected result. What I did is as follows.

    		public var assessment_created_date:Date;

    getAssessmentDetailsList(noOfDays:int):Array {
    	var criteria:Criteria=eManager.createCriteria(AssessmentDetailDTO);
    	var condiftionDate:Date = new Date(); 
    	condiftionDate.setDate( - noOfDays);
    	criteria.addGreaterThanCondition("assessment_created_date", condiftionDate);
    	var result:ArrayCollection=eManager.fetchCriteria(criteria);
    	return result.source;

    This time, I did not get any error. But no results too.



  3. Log in to comment