function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
mPortalWizmPortalWiz 

All Day Event

Dev,

Thanx for your reply on the sorting.

I have another Query. Its regarding the allDay event.

I am retrieving today's event based on the date-time of today (such as 09/25/03 00:00 AM to 09/26/03 00:00 AM). I am able to view all the event details properly but for the allDay event. How to get an allDay event along with other events?

Thanx

mPortalwiz

 

DevAngel2DevAngel2

Hi mPortalWiz,

What you need to do is create a complex filter to get the non-allDay events using the dueDateTime field and the allDay events using the dueDateOnly field. 

( (dueDateTime >= '09/25/03 00:00 AM' and dueDateTime <= '09/26/03 00:00 AM') or (dueDateOnly > Today - 1day and dueDateOnly < Today + 1day))

I don't have any java code that illustrates this, but I have some C# that you could port.

object[] filter = new object[1];
//final filter array - one element
object[] andFilter1 = new object[2];
//First "and'd" filter - two elements
object[] andFilter2 = new object[2];
//second "and'd" filter - two elements
object[] andOrFilter = new object[2];
//first and second filters "or'd" - two elements
//Create simple filter as first part of first and'd filter
andFilter1[0] = sfh.MakeFilterObject("dueDateOnly", DateTime.Today.AddDays(-1), "greater than");
//Create simple filter as second part of first and'd filter
andFilter1[1] = sfh.MakeFilterObject("dueDateOnly", DateTime.Today.AddDays(1), "less than");
//Create simple filter as first part of second and'd filter
andFilter2[0] = sfh.MakeFilterObject("dueDateTime", DateTime.Today.AddDays(-1), "greater than");
//Create simple filter as second part of second and'd filter
andFilter2[1] = sfh.MakeFilterObject("dueDateTime", DateTime.Today.AddDays(1), "less than");
//Create complex filter as first part of or'd filter
andOrFilter[0] = sfh.MakeFilterObject(andFilter1, "and");
//Create complex filter as second part of or'd filter
andOrFilter[1] = sfh.MakeFilterObject(andFilter2, "and");
//Create complex final or'd filter
filter[0] = sfh.MakeFilterObject(andOrFilter, "or"); ret = (object[]) sfh.QueryFilter("event", -1, SelectList, filter, false);

QueryFilter is a helper, you should be able to use your standard query syntax in it's place.
MakeFilterObject is a helper also an is below:

Public
Shared Function
MakeMapEntryObject(ByVal key As String, ByVal value As Object) As sForce.mapEntry
    Dim m As New sForce.mapEntry
     m.key = key
     m.value = value
     Return m
End Function

Public
Function MakeFilterObject(ByVal fieldName As String, ByVal fieldValue As Object, ByVal operator As String) As sForce.mapEntry()
    Dim filtMap(2) As sForce.mapEntry
    filtMap(0) = MakeMapEntryObject("field", fieldName)
    filtMap(1) = MakeMapEntryObject("value", fieldValue)
    filtMap(2) = MakeMapEntryObject("operator", operator)
    Return filtMap
End Function

Public
Function MakeFilterObject(ByVal fieldValue As Object, ByVal operator As String) As sForce.mapEntry()
    Dim filtMap(1) As sForce.mapEntry
    filtMap(0) = MakeMapEntryObject("value", fieldValue)
    filtMap(1) = MakeMapEntryObject("operator", operator)
    Return filtMap
End Function