load( local!nameFilter, /* local!nameFilterCLA, */local!filterType: 1, local!pickedRMOfficerUsers: {}, local!isUserCLA: isusermemberofgroup( loggedinuser(), cons!CAC_COMMERCIAL_LOAN_ASSISTANTS_GROUP ), local!delegations: if( local!isUserCLA, rule!CAC_getDelegationsByAssistantTypeSubTypeStatus( loggedinuser(), "Exception", "Accepted" ), null ), local!delegateeUsernames: if( local!isUserCLA, local!delegations.OfficerUserId_Txt, null ), local!delegateeFullNames: if( local!isUserCLA, apply( rule!APN_displayUser, local!delegateeUsernames ), null ), local!pagingInfo: a!pagingInfo( startIndex: 1, batchSize: 2, sort: { field: "exceptionDate", ascending: true } ), with( local!datasubset: if( isusermemberofgroup( loggedinuser(), cons!CAC_COMMERCIAL_LOAN_OFFICERS_GROUP ), todatasubset( append( rule!CAC_getOpenExceptionByCustNameOfficerNum( local!nameFilter, "99970", "New", { "Cleared", "Waived" }, today() - 1000, local!pagingInfo ), rule!CAC_getExceptionByCustNameOfficerNum_fltr( local!nameFilter, user( loggedinuser(), "customField2" ), { "Cleared", "Waived", "New" }, local!pagingInfo ) ) ), if( local!isUserCLA, with( officersIncentiveNumbers: local!delegations.OfficerIncentiveNumber_Int, officersUserNames: local!delegations.OfficerUserId_Txt, subTypes: local!delegations.DelegationSubType_Txt, matchingOfficers: if( or( local!pickedRMOfficerUsers = "", isnull( local!pickedRMOfficerUsers ) ), officersIncentiveNumbers, if( - 1 = lookup( apply( fn!tostring, officersUserNames ), tostring( local!pickedRMOfficerUsers ) ), "nomatch", index( officersIncentiveNumbers, lookup( apply( fn!tostring, officersUserNames ), tostring( local!pickedRMOfficerUsers ) ), "nomatch" ) ) ), exceptions: if( matchingOfficers = "nomatch", null, rule!CAC_exceptionSubTypeReportBatchData( local!nameFilter, matchingOfficers, subTypes, local!pagingInfo ) ), exceptions ), null ) ), rule!APN_uiReportOneColumn( contents: { with( isCLA: local!isUserCLA, rule!APN_uiSectionTwoColumn( label: "Report Filters", column1: { a!dropdownField( label: "Filter By", choiceLabels: if( isCLA, { "Customer Name", "Relationship Manager" }, { "Customer Name" } ), choiceValues: if( isCLA, { 1, 2 }, { 1 } ), value: local!filterType, saveInto: { local!filterType, local!nameFilter << rule!APN_returnFirstInput( "", _ ), local!pickedRMOfficerUsers << rule!APN_returnFirstInput( {}, _ ), local!pagingInfo.startIndex << rule!APN_returnFirstInput( 1, _ ) } ), if( local!filterType = 2, { a!pickerFieldCustom( label: "", instructions: "Please select a commercial loan officer.", maxSelections: 1, suggestFunction: rule!CAC_arrayPickerFilter( filter: _, labels: local!delegateeFullNames, identifiers: local!delegateeUsernames ), selectedLabels: local!pickedRMOfficerUsers, value: local!pickedRMOfficerUsers, saveInto: local!pickedRMOfficerUsers/*<< rule!CAC_arrayPickerRemoveDuplicates*/ )/*, a!textField( label: "Selected Delegatees", readOnly: true, value: local!pickedRMOfficerUsers )*/ }, a!textField( label: "", instructions: "Start typing to see results", value: local!nameFilter, saveInto: { local!nameFilter, local!pagingInfo.startIndex << rule!APN_returnFirstInput( 1, _ ) }, alignment: "LEFT", refreshAfter: "KEYPRESS" ) ) } ) ), rule!APN_uiSectionOneColumn( label: "Commercial Action Center Exceptions Report", contents: { if( isnull( local!datasubset ), a!textField( label: "", readOnly: true, value: "No Results" ), if( local!datasubset.totalCount < 1, a!textField( label: "", readOnly: true, value: "No Results" ), a!gridField( totalCount: local!datasubset.totalCount, columns: { a!gridTextColumn( label: "Customer Name", data: index( local!datasubset.data, "customerName", {} ), field: "customerName" ), a!gridTextColumn( label: "Customer #", data: index( local!datasubset.data, "customerNumber", {} ), field: "customerNumber" ), a!gridTextColumn( label: "Credit Stream ID", data: index( local!datasubset.data, "crsExceptionID", {} ), links: if( local!datasubset.totalCount = 0, {}, apply( a!recordLink( recordType: cons!CAC_EXCEPTION_RECORD_TYPE, identifier: _ ), if( isnull( local!datasubset.data.apnExceptionID ), null, local!datasubset.data.apnExceptionID ) ) ), field: "crsExceptionID" ), a!gridTextColumn( label: "Type of Exception", data: index( local!datasubset.data, "exceptionType", {} ), field: "exceptionType" ), a!gridTextColumn( label: "Description", data: apply( rule!CAC_getTruncatedExceptionDescription, index( local!datasubset.data, "description", {} ), index( local!datasubset.data, "descriptionLine1", {} ), index( local!datasubset.data, "descriptionLine2", {} ) ) ), a!gridTextColumn( label: "Officer Name", data: index( local!datasubset.data, "officerName", {} ), field: "officerName" ), a!gridTextColumn( label: "Status", data: index( local!datasubset.data, "apnStatus", {} ), field: "apnStatus" ) }, value: local!pagingInfo, saveInto: local!pagingInfo ) ) )/*end if*/ } ) } )/***** end APN_uiReportOneColumn ***/ ) )