{{fscript "The expected arguments are: startDateInterval, endDateInterval, entity, dateAttribute, kind, days. startDate and endDate expressed since reference date" "Today's date minus 30 days" start := NSDate dateWithTimeIntervalSinceReferenceDate:(startDateInterval doubleValue). end := NSDate dateWithTimeIntervalSinceReferenceDate:(endDateInterval doubleValue). dates := MCReportDateEnumerator allDailyDatesBetween:start end:end. labels := {}. data := {}. lines1 := {}. lines2 := {}. dictionary := #{'labels' -> labels, 'data' -> data, 'lines1' -> lines1, 'lines2' -> lines2}. dates do:[:date | begin := date mcDateAsBeginningOfDay. endDay := date mcDateAsEndOfDay. locum_str := dateAttribute ++ ' >= $start and ' ++ dateAttribute ++ ' <= $end'. c := objectContext resultCountForEntityNamed:entity qualifierLocum:locum_str bindings:#{'start' -> begin, 'end' -> endDay}. labels add:(date mcDayOfMonth). data add:c. lines1 add:c. lines2 add:(date mcLongDate). ]. globals setDictionary:(dictionary JSONRepresentation). }}
{{localize 'Total:'}} {{fscript objectContext resultCountForEntityNamed:entity. }}
{{localize 'First one created on:'}} {{fscript date := objectContext minDateForEntityNamed:entity dateAttributeNamed:dateAttribute. date mcLongDate. }}
{{localize 'Last one created on:'}} {{fscript date := objectContext maxDateForEntityNamed:entity dateAttributeNamed:dateAttribute. date mcLongDate. }}