Rule: Report_HomeScreen /* -- Here local variables fromDateTime_dte and toDateTime_dte are mapped to filters [a!dateField components] and hold value of type DATE -- */ local!datasubset_any: rule!Report_getDataSubset( fromDateTime_dte: local!fromDateTime_dte, toDateTime_dte: local!toDateTime_dte, pagingInfo_any: a!pagingInfo(startIndex: 1, batchSize: -1) ), local!exportUri: getdatasubsetdownloadlinkfromrule( rule!Report_getExportableDataSubset, a!toJson( { fromDateTime_dte: tostring(local!fromDateTime_dte), toDateTime_dte: tostring(local!toDateTime_dte), pagingInfo_any: local!pagingInfo_any } ) ) ========================= Rule: Report_getExportableDataSubset /* -- input rule input is of type TEXT -- */ with( local!searchParam: a!fromJson( ri!input ), /* -- Forming DataSubset again instead of passing as JSON parameter-- */ local!datasubsetNew_any: rule!Report_getDataSubset( fromDateTime_dte: local!searchParam.fromDateTime_dte, toDateTime_dte: local!searchParam.toDateTime_dte, pagingInfo_any: local!searchParam.pagingInfo_any ), 'type!{urn:appian:plugin:datasubsetdownload:types}ExportableDataSubset' ( datasubset: local!datasubsetNew_any, fieldNames: {"requestStatus","requestId","ageOfStatus"}, fieldLabels: {"STATUS OF CDD","COUNT","AGING IN DAYS"}, filename: "AgingReport" ) ) ========================= Rule: Report_getDataSubset /* -- fromDateTime_dte and toDateTime_dte rule input are of type DATE -- */ if( or( isnull( ri!fromDateTime_dte ), isnull( ri!toDateTime_dte ) ), null(), a!queryEntity( entity: cons!DATA_STORE_ENTITY_AGING_INFO, query: a!query( aggregation: a!queryAggregation( aggregationColumns: { a!queryAggregationColumn( field: "requestStatus", isGrouping: true ), a!queryAggregationColumn( field: "requestId", aggregationFunction: "COUNT" ), a!queryAggregationColumn( field: "ageOfStatus", aggregationFunction: "AVG" ), a!queryAggregationColumn( field: "statusId", aggregationFunction: "MAX" ) } ), filter: a!queryFilter( field: "startDate", operator: "between", value: { /* -- Here values are converted from type DATE to DATETIME without any timezone affected -- */ /* -- If the columns in database are of type DATE, below conversion is NOT required -- */ rule!Report_getConvertedStartDateTime(ri!fromDateTime_dte), rule!Report_getConvertedEndDateTime(ri!toDateTime_dte) } ), pagingInfo: ri!pagingInfo_any ) ) ) ========================= Rule: Report_getConvertedStartDateTime /* -- inputDate_dte rule input is of type DATE -- */ with( local!formattedDate: text(ri!inputDate_dte, "mm/dd/yyyy HH:mm z"), local!splitFr: split(split(split(local!formattedDate, " "),"/"),":"), userdatetime( local!splitFr[3], local!splitFr[1], local!splitFr[2], local!splitFr[4], local!splitFr[5], "00" ) ) ========================= Rule: Report_getConvertedEndDateTime /* -- inputDate_dte rule input is of type DATE -- */ with( local!formattedDate: text(ri!inputDate_dte, "mm/dd/yyyy HH:mm z"), local!splitFr: split(split(split(local!formattedDate, " "),"/"),":"), userdatetime( local!splitFr[3], local!splitFr[1], local!splitFr[2], local!splitFr[4], local!splitFr[5], "00" ) + intervalds(23, 59, 0) ) =========================