load( local!fromDateTime, local!toDateTime, local!pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 20, sort: a!sortInfo( field: "statusId", ascending: true ) ), with( local!datasubset: rule!Report_getDataSubset( fromDateTime_dtm: local!fromDateTime, toDateTime_dtm: local!toDateTime, pagingInfo_any: local!pagingInfo ), local!isResultEmpty: or( isnull( local!datasubset ), rule!BW_CK_isEmpty_Array( local!datasubset.data ) ), local!exportUri: if( local!isResultEmpty, null, getdatasubsetdownloadlinkfromrule( rule: rule!Report_getExportableDataSubset, input: "" ) ), { a!sectionLayoutColumns( label: "Report Summary”, columns: { a!columnLayout( contents: { a!dateField( label: "From Date", instructions: local!fromDateTime, value: if(isnull(local!fromDateTime),null,gmt(local!fromDateTime, "+420")), saveInto: { local!fromDateTime << gmt(_, "-420") }, required: true ) } ), a!columnLayout( contents: { a!dateField( label: "To Date", instructions: local!toDateTime, value: if(isnull(local!toDateTime),null,gmt(local!toDateTime, "+1859")), saveInto: { local!toDateTime << gmt(_, "-1859") }, required: true ) } ) } ), a!sectionLayout( firstColumnContents: { if( local!isResultEmpty, {}, a!gridField( totalCount: local!datasubset.totalCount, columns: { a!gridTextColumn( label: "STATE OF CDD", field: "requestStatus", data: index( local!datasubset.data, "requestStatus", null ) ), a!gridTextColumn( label: "COUNT", field: "requestId", data: index( local!datasubset.data, "requestId", null ) ), a!gridTextColumn( label: "AGING (DAYS)", field: "ageOfStatus", data: index( local!datasubset.data, "ageOfStatus", null ) ) }, value: local!pagingInfo, saveInto: local!pagingInfo ) ) } ), if(or(local!isResultEmpty, isnull(local!exportUri)), {}, a!sectionLayout( firstColumnContents: { a!linkField( links: { a!safeLink( label: "Click Here to export this data to excel - " & local!exportUri, uri: local!exportUri ) } ) } ) ) } ) )