variables.elementName = getEventRecurrenceCEName(); variables.elementIDfield = "uniqueID"; variables.parentIDfield = "calEventID"; //variables.CCAPIName = getEventRecurrenceCCAPIname(); variables.CCAPIName = getCCAPIName(variables.elementName); variables.elementViewName = getCEViewName(variables.elementName); var dataQry = QueryNew("temp"); var filterDataQry = QueryNew("temp"); var expirationDate = ""; // Set the expirationDate and do not get records that have a rangeEndDate that is LESS than this StartDate. if ( LEN(TRIM(arguments.startDate)) ) expirationDate = application.ptCalendar.date.csDateFormat(DateAdd("d",-1,arguments.startDate),getDayEndTime()); /* * FILTERING NOTES: * rangeStartDate: * Recurring records might have a rangeStartDate that us less than the passed in StartDate * but they may have on-going dates that will be generated after the StartDate * so... we CAN NOT filter by StartDate the same way as we do other queries! * * rangeEndDate: * We CAN filter out all records with rangeEndDates in the past. Since we no longer care about those * expired recurrence pattern records. But when filtering by rangeEndDate we must NOT exclude records with * only a rangeQantity * * expirationDate: * Compare rangeEndDate to the expirationDate that is passed in... we will * will want to filter out all recurrence properties records that have expired by (LESS THAN) * the start of the date range we are trying to retrieve ---> * */ SELECT * FROM #variables.elementViewName# WHERE 1 = 1 AND uniqueID = AND calEventID = AND uniqueID IN ( SELECT uniqueID FROM #variables.elementViewName# WHERE RangeEndType = 'EndQuantity' AND rangeQuantity IS NOT null AND rangeQuantity <> '' UNION SELECT uniqueID FROM #variables.elementViewName# WHERE RangeEndType = 'EndDate' AND rangeEndDate >= ) ---> return getRecurrenceQuery(eventID=TRIM(arguments.eventID));