- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-01-2014 11:52 PM
Hi,
How to query a table to fetch a record which has highest value in "opened" field which is a Date/time field?
Thanks in advance.
Solved! Go to Solution.
- Labels:
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2014 12:11 AM
Add the below 2 lines to your query:-
gr.orderByDesc('opened');
gr.setLimit(1);
Thanks & Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2014 12:11 AM
Add the below 2 lines to your query:-
gr.orderByDesc('opened');
gr.setLimit(1);
Thanks & Regards,
Hari
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2014 12:24 AM
Thanks Harikrishnan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2014 12:14 AM
Hi Raj,
Use OrderByDesc in the glide record.
for eg-
var gr=new GlideRecord('incident');
gr.orderByDesc('opened_at');
gr.query();
while(gr.next()){
gs.print(gr.number);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-02-2014 12:25 AM
Thanks Anish it worked:)