Quantcast
Channel: SmartClient Forums
Viewing all articles
Browse latest Browse all 4756

FilterBuilder and Date, DateTime, CreateorTimeStamp or ModifierTimestamp

$
0
0
Hi Isomorphoic,

Version : Isomorphic SmartClient/SmartGWT Framework (v9.1p_2014-06-03/PowerEdition Deployment 2014-06-03)

I have a question about the FilterBuilder and DateTime.

I use the format “yyyy/MM/dd - HH:mm:ss” for datetime/timestamp in my application.

The column of type DateTime, CreatorTimeStamp and ModifierTimeStamp are display in this format to avoid showing the milliseconds to the user. But these milliseconds are stored in the database.

1. I would like to use a RelativeDateItem without time in the FilterBuilder. I try to do like this
Code:

RelativeDateItem dateItem = new RelativeDateItem();
dateItem.setShowPickerTimeItem(false);
dateItem.setFormat("yyyy/MM/dd");
dateItem.setDateParser(new DateParser() {
                                       
        @Override
        public Date parse(String dateString) {
                //parse yyyy/MM/dd
                return Localization.parseDate(dateString);
        }
});
dateItem.setDateFormatter(new DateDisplayFormatter() {
                                       
        @Override
        public String format(Date date) {
                //format yyyy/MM/dd
                return Localization.formatDate(date);
        }
});
dataSourceField.setEditorProperties(dateItem);

When I select/enter a date in the RelativeDateItem, example 2014/05/15 and I do the filtering. The criteria is like this
Code:

{
    "_constructor":"AdvancedCriteria",
    "operator":"and",
    "criteria":[
        {
            "fieldName":"CREATED",
            "operator":"equals",
            "value":new Date(1400104800000),
            "_constructor":"AdvancedCriteria"
        }
    ]
}

The payload
Code:

=== 2014-06-04 15:10:26,348 [0-21] DEBUG RPCManager - Request #1 (DSRequest) payload: {
    criteria:{
        _constructor:"AdvancedCriteria",
        operator:"and",
        criteria:[
            {
                fieldName:"CREATED",
                operator:"equals",
                value:new Date(1400104800000),
                _constructor:"AdvancedCriteria"
            }
        ]
    },
    operationConfig:{
        dataSource:"businessUnit",
        operationType:"fetch",
        textMatchStyle:"exact"
    },
    startRow:0,
    endRow:75,
    componentId:"isc_ListModuleView_10_0",
    useStrictJSON:true,
    appID:"builtinApplication",
    operation:"businessUnit_fetch",
    oldValues:{
        _constructor:"AdvancedCriteria",
        operator:"and",
        criteria:[
            {
                fieldName:"CREATED",
                operator:"equals",
                value:new Date(1400104800000),
                _constructor:"AdvancedCriteria"
            }
        ]
    }
}

The sql generated is
Code:

((SEC_BUSINESS_UNIT.CREATED = '2014-05-15T00:00:00' AND SEC_BUSINESS_UNIT.CREATED IS NOT NULL))
The definition of the column in the database (SQLServer) is CREATED DATETIME DEFAULT GETDATE() NOT NULL

2. Where are the milliseconds, as the column is type “CreatorTimeStamp”

3. As the column is type “CreatorTimeStamp”, when I select the equals operator with date value 2014/05/15, this must be ‘translated’ in between 2014/05/15 00:00:00.000 and 2014/05/15 23:59:59.999. Can it be done automatically or must I have to code that.

Regards

Julien

Viewing all articles
Browse latest Browse all 4756

Trending Articles