on 04-02-2010 4:22 AM
Hi All,
I am developing MDM Web dynpro custom application using MDM java API 2. I am having difficulty while searching on main table by date field. The fields type in MDM as u201CTime Stampu201D how I make my search constraints. Please point me if there is any tutorial or sample code.
Thanks
John.
.
Hi John,
Refer this guide, hope this helps..
Regards,
Mandeep Saini
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Mandeep,
I am not quite understood from the Article. Because i am trying to search on Main table using whatever date i selected from Web dynpro UI.
My scenario is i am trying to pass the date i selected (MM/DD/YYYY) but mdm we are using time stamp so when i looked at the search constraints API i found one Timeserachconstraints (Calendar, int) so how i convert my date into calendar and pass it to corresponding search constraints.
Really appreciate your help.
Thanks
John.
Hi John,
I haven't got opportunity to work with mdm java api but i hoped that link in above post can help you.
Please refer as you want search on Main table of mdm repository: hope this helps
http://wiki.sdn.sap.com/wiki/display/SAPMDM/SearchInaMDMRepository
http://wiki.sdn.sap.com/wiki/display/WDJava/HowtoconnectMDMusingWebDynpro+Java
If i get anything to convert date into calendar, will get back to you.
Regards,
Mandeep Saini
Hi John,
Try using the following code snippet.
TableId tableId = schema.getTable("Products").getId();
FieldId fieldId = schema.getField("Products", "Update_Date").getId();
FieldSearchDimension searchDimension = new FieldSearchDimension(fieldId);
Calendar cal = Calendar.getInstance();
cal.set(2009, 11, 24);
DateTimeSearchConstraint dateConstraint = new DateTimeSearchConstraint(cal, DateTimeSearchConstraint.GREATER_THAN);
Search search = new Search(tableId);
search.addSearchItem(searchDimension, dateConstraint);
Here "Products" is the name of the table on which the search is done. "Update_Date" is a field of type Timestamp. I've hard-coded the date currently. You can use the various Date constructors to set the date dynamically.
Regards,
Anil Madhavan
Hi John,
I couldn't find a range search functionality for Date. I'm still trying out that.
Meanwhile, you can get all the records from the lower date range, and filter out the ones above the higher date range using the java.util.Date class, after() method, comparing the record date and the higher date range.
For huge datasets, this could definitely pose a problem, as we are bringing in all the records, and then filtering it out.
Regards,
Anil Madhavan
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.