= load( local!completeDatasubset, local!selectAllLoans: null, local!selectLoans: null, local!poData: {}, local!selectGrid: 3, local!employeeToUpdate, local!pagingInfoSearch: a!pagingInfo( startIndex: 1, batchSize: local!selectGrid, sort: a!sortInfo( field: "dataCorrectionRequestIdentifier", ascending: true ) ), local!pagingInfo: a!pagingInfo( startIndex: 1, batchSize: local!selectGrid, sort: a!sortInfo( field: "dataCorrectionRequestIdentifier", ascending: true ) ), local!gridSelection: a!gridSelection( pagingInfo: local!pagingInfo ), local!pagingInfoExport: a!pagingInfo( startIndex: 1, batchSize: - 1, sort: a!sortInfo( field: "dataCorrectionRequestIdentifier", ascending: true ) ), local!selectedLoans: {}, local!loanCount: 0, local!searchPFDC: 'type!{com.freddiemac.pfdc}PFDC_searchPFDC'(), local!searchPFDCExisting: 'type!{com.freddiemac.pfdc}PFDC_searchPFDC'(), local!poDataToLoad: if( or( rule!PFDC_isBlank( ri!searchPFDC ), local!searchPFDC = ri!searchPFDC ), {}, todatasubset(rule!PFDC_getCompleteDataset(ri!searchPFDC,cons!PFDC_DC_SEARCH_RESULT_LIMIT_COUNT),local!pagingInfo) ), local!selectedDataCorrections: if( rule!PFDC_isBlank( ri!selectedDataCorrections ), {}, ri!selectedDataCorrections ), local!searchAction: if( rule!PFDC_isBlank( ri!searchPFDC ), {}, "searchPFDC" ), local!dataCorrectionResult: {}, local!searchLoanOrPfdc: "PFDC", local!isGridAction: false(), local!selectedDcList, local!isClear: false, local!isBillable: false, /*tushar*/ local!billableValidation: false, local!loggedInSeller: rule!PFDC_getSellerNumber(), local!loggedInServicer: rule!PFDC_getServicerNumber(), local!isSellerNumberAvailable: if( rule!PFDC_isBlank( local!loggedInSeller ), false(), true() ), local!isServicerNumberAvailable: if( rule!PFDC_isBlank( local!loggedInServicer ), false(), true() ), local!defaultReviewGroupList: index( cons!PFDC_APPROVAL_GROUPS_CHOICE_VALUES, wherecontains( getgroupnames( getgroupsformemberuser( loggedInUser() ) ), cons!PFDC_APPROVAL_GROUPS_CHOICE_VALUES ) ), local!defaultReviewGroup: if( rule!PFDC_isExternalUser( loggedInUser() ), "", if( rule!PFDC_isBlank( local!defaultReviewGroupList ), "", local!defaultReviewGroupList[1] ) ), local!originalDefaultReviewGroup: local!defaultReviewGroup, local!originalDefaultSellerNumber: local!loggedInSeller, local!originalDefaultServicerNumber: local!loggedInServicer, local!isExternalUserLoggedIn: if( rule!PFDC_isExternalUser( loggedInUser() ), true, false ), with( local!isError: rule!PFDC_isBlank( rule!PFDC_textValidation( ri!searchPFDC.fmLoanNumber, 9 ) ), /* check if search criteria is empty for validation */ local!isSearchPFDCNull: if( and( rule!PFDC_isBlank( ri!searchPFDC ), rule!PFDC_isBlank( local!defaultReviewGroup ), and( rule!PFDC_isBlank( local!loggedInSeller ), rule!PFDC_isBlank( local!loggedInServicer ) ) ), "true", if( and( rule!PFDC_isSearchPfdcEmpty( ri!searchPFDC, if( isExternalUserLoggedIn, "external", "internal" ) ), rule!PFDC_isBlank( local!defaultReviewGroup ) ), "true", "false" ) ), /* Refresh dataset on every grid action like sorting and pagination */ local!datasubset: if( rule!PFDC_isBlank( local!poDataToLoad ), {}, if( and( local!isGridAction, ri!searchAction = "searchPFDC", not( local!isSearchPFDCNull ) ), todatasubset(rule!PFDC_getCompleteDataset(local!searchPFDCExisting,cons!PFDC_DC_SEARCH_RESULT_LIMIT_COUNT),local!gridSelection.pagingInfo), /*todatasubset(local!completeDatasubset,local!gridSelection.pagingInfo),*/ local!poDataToLoad ) ), local!toDeselectAll: if( rule!PFDC_isBlank( local!datasubset ), false, if( or(local!datasubset.totalCount = local!loanCount), "true", "false" ) ), { /* List of input fields to provide search criteria */ a!sectionLayout( label:"selected record IDs = "&local!selectedDataCorrections&" Current dataset = "&local!datasubset, firstColumnContents: { a!richTextDisplayField( label: "", labelPosition: "COLLAPSED", value: a!richTextItem( text: "Data Correction Created Date", style: "STRONG" ) ), a!dateField( label: "From:", labelPosition: cons!PFDC_LABELPOSITION, value: ri!searchPFDC.DCCreatedFromDT, saveInto: { a!save( ri!searchPFDC.DCCreatedFromDT, rule!PFDC_formatDateEDT( save!value ) ), a!save( local!isGridAction, false() ), } ), a!dateField( label: "To:", labelPosition: cons!PFDC_LABELPOSITION, value: ri!searchPFDC.DCCreatedToDT, saveInto: { a!save( ri!searchPFDC.DCCreatedToDT, rule!PFDC_formatDateEDT( save!value ) ), a!save( local!isGridAction, false() ), } ), }, secondcolumncontents: { }, validations: if( local!isSearchPFDCNull, a!validationMessage( message: "A value must be provided for at least one field.", validateAfter: "SUBMIT" ), "" ), validationGroup: "searchPFDC", isCollapsible: true ), a!sectionLayout( label: "", firstColumnContents: { a!buttonLayout( primarybuttons: { a!buttonWidget( label: "Search Post Fund Data Correction Record", validate: true(), validationGroup: "searchPFDC", value: if( local!isSearchPFDCNull, "x", "searchPFDC" ), saveInto: { ri!searchAction, a!save( local!isGridAction, false() ), a!save( local!isClear, false ), a!save( local!loanCount, 0 ), a!save( local!selectedDataCorrections, null ), a!save( local!gridSelection.selected, null ), a!save( local!gridSelection.pagingInfo, local!pagingInfo ), /* Setup seller number as search criteria for external users */ a!save( ri!searchPFDC.SellerAccountIdentifier, if( rule!PFDC_isExternalUser( loggedInUser() ), local!loggedInSeller, local!loggedInSeller ) ), /* Setup servicer number as search criteria for external users */ a!save( ri!searchPFDC.ServicerAccountIdentifier, if( rule!PFDC_isExternalUser( loggedInUser() ), local!loggedInServicer, local!loggedInServicer ) ), a!save( ri!searchPFDC.ReviewAssignedTo, if( rule!PFDC_isExternalUser( loggedInUser() ), {}, local!defaultReviewGroup ) ), a!save( local!searchPFDCExisting, ri!searchPFDC ), a!save(local!poDataToLoad,if( or( local!isSearchPFDCNull, not( local!isError ) ), {}, todatasubset(rule!PFDC_getCompleteDataset(ri!searchPFDC,cons!PFDC_DC_SEARCH_RESULT_LIMIT_COUNT),local!pagingInfo) )), } ) } ) }, secondColumnContents: { a!buttonLayout( secondarybuttons: { } ) } ), if( or( ri!searchAction = "searchPFDC", if( ri!searchAction = "searchPfdcApp", true(), rule!PFDC_isValidUserAction( ri!searchAction ) ) ), { if( ri!searchAction = cons!PFDC_USER_ACTION_EXPORT, if( isnull( ri!downloandExcel ), { if( rule!PFDC_isBlank( ri!exportLimitError ), rule!PFDC_displayErrorMessage( "No items available to Export" ), rule!PFDC_displayErrorMessage( ri!exportLimitError ) ) }, a!linkField( label: "Download Link:", readOnly: true, labelPosition: "ADJACENT", links: a!documentDownloadLink( document: todocument( ri!downloandExcel ), label: "Search Report Excel" ) ) ), { a!sectionLayout( label: "", firstColumnContents: { a!buttonLayout( primaryButtons: {}, secondaryButtons: {} ), }, secondColumnContents: { a!buttonLayout( primarybuttons: {}, secondaryButtons: if( rule!PFDC_isBlank( local!datasubset ), {}, if( local!datasubset.totalCount > 0, { }, {} ) ) ) }, validations: if( local!loanCount < 1, a!validationMessage( message: "At least one loan must be selected to Process.", validateAfter: "SUBMIT" ), "" ), validationGroup: "submit" ), a!gridField( label: " ", instructions: "Total Selected :" & local!loanCount, totalCount: local!datasubset.totalCount, columns: { a!gridTextColumn( label: "Freddie Mac Loan Number", field: "midasLoanIdentifier", data: index( local!datasubset.data, "midasLoanIdentifier", {} ) ), a!gridTextColumn( label: "Investor Contract Identifier", field: "contractIdentifier", data: index( local!datasubset.data, "contractIdentifier", {} ) ), a!gridTextColumn( label: "Data Correction Identifier", field: "dataCorrectionRequestIdentifier", data: index( local!datasubset.data, "dataCorrectionRequestIdentifier", {} ) ), }, identifiers: index( local!datasubset.data, "dataCorrectionRequestIdentifier", {} ), value: local!gridSelection, saveInto: { local!gridSelection, a!save( local!isGridAction, true() ), a!save( ri!searchLoanOrPfdc, local!searchLoanOrPfdc ), local!selectedDataCorrections << index( _, "selected", null ), a!save( local!loanCount, count( local!selectedDataCorrections ) ), }, selection: true ), } ) }, {} ) } ) )