on 01-13-2011 9:16 PM
Hi MDMAPI experts,
I was trying to retrieve a timestamp field with a certain date and not able to successfully, is it because of GMT or Timestamp field. Could you post any samples if you have.
Calendar calYesday = Calendar.getInstance();
calYesday.set(2010,11,29);
FieldSearchDimension fsdULILastTimeIncluded = new FieldSearchDimension(new FieldId(repSchema.getFieldId("Customers", "last_updated")));
DateTimeSearchConstraint srchConstCreateLE = new DateTimeSearchConstraint(calToday, DateTimeSearchConstraint.EQUALS);
Please let me know.
Thanks
-Sai
Specify GMT+00:00 timezone in calendar
Calendar c = Calendar.getInstance(TimeZone.getTimeZone("GMT"));
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Use below code to search records based on timestamp constraint
Search search = new Search(mainTableId);
SearchGroup sg1 = new SearchGroup();
FieldId updateDateField = schema.getTableSchema(mainTableId).getFieldId("MDM_UPDATE_DATE");
Calendar upperLimit = Calendar.getInstance();
Calendar lowerLimit = Calendar.getInstance();
lowerLimit.clear(Calendar.HOUR);
lowerLimit.clear(Calendar.HOUR_OF_DAY);
lowerLimit.clear(Calendar.MINUTE);
lowerLimit.clear(Calendar.SECOND);
lowerLimit.clear(Calendar.MILLISECOND);
FieldSearchDimension fsdUpdateDate = new FieldSearchDimension(updateDateField);
DateTimeSearchConstraint dtscUpdateDateUpper = new DateTimeSearchConstraint(upperLimit,DateTimeSearchConstraint.LESS_THAN_OR_EQUAL_TO);
sg1.addSearchItem(fsdUpdateDate, dtscUpdateDateUpper);
DateTimeSearchConstraint dtscUpdateDateLower = new DateTimeSearchConstraint(lowerLimit,DateTimeSearchConstraint.GREATER_THAN_OR_EQUAL_TO);
sg1.addSearchItem(fsdUpdateDate, dtscUpdateDateLower);
sg1.setComparisonOperator(SearchGroup.AND_OPERATOR);
search.addSearchItem(sg1);
RetrieveLimitedRecordsCommand retrieveLimitedRecordsCommand = new RetrieveLimitedRecordsCommand(connections);
retrieveLimitedRecordsCommand.setSession(userSessionID);
retrieveLimitedRecordsCommand.setResultDefinition(resultDefinition);
retrieveLimitedRecordsCommand.setSearch(search);
retrieveLimitedRecordsCommand.execute();
Regards,
Amol
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi MFH,
Thanks for the response, but this search is not successful may be because of timestamp field. Does it compare with GMT internally, I dont know. I was trying to compare Timestamp field less than today (so I hardcoded it Calendar(year-2011, month-01, yesterday 14) and it wont get results properly.
Please let me know of or share more info on this.
Thanks
-Sai
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.