=load( local!locations: DCMIFS_GetLocation(), local!companyData: rule!DCMIFS_GetAllCompanyInfo(), local!gridSelection: a!gridSelection( pagingInfo:a!pagingInfo ( startIndex:1, batchSize: 5, sort:a!sortInfo( field:"CompanyID", ascending:true ) ) ), with( local!searchResults:rule!DCMIFS_SearchCompanyFromManageCompanies( companyName: ri!companyName, AddressLine1: ri!AddressLine1, AddressLine2: ri!AddressLine2, AddressLine3: ri!AddressLine3, CityName: ri!CityName, StateProvince: ri!StateProvince, ZipCode: ri!ZipCode, companyData: local!companyData), local!datasubset: todatasubset(local!companyData,local!gridSelection.pagingInfo), a!formLayout( label:"Company Search", firstColumnContents:{ a!sectionLayout( label:"Company Search Fields:", firstColumnContents:{ a!textField( label:"Company Name", value: ri!companyName, saveInto:ri!companyName ), a!textField( label:"Address Line 1", value:ri!AddressLine1, saveInto:ri!AddressLine1 ), a!textField( label:"Address Line 2", value:ri!AddressLine2, saveInto:ri!AddressLine2 ), a!textField( label:"Address Line 3", value:ri!AddressLine3, saveInto:ri!AddressLine3 ), a!textField( label:"City", value:ri!CityName, saveInto:ri!CityName ), a!dropdownField( label:"State/Province", placeholderLabel:local!locations[1], choiceLabels: local!locations, choiceValues:local!locations, value:ri!StateProvince, saveInto:ri!StateProvince, required:true), a!textField( label:"Zip Code", value: ri!ZipCode, saveInto:ri!ZipCode ) }), a!sectionLayout( label:"PSA Company Details", firstColumnContents:{ if(rule!COMMON_IsNullOrEmpty(local!datasubset), {}, a!gridField( label:"Unregulated Cases", instructions:"Displaying all unregulated cases associated with this company", totalCount:length(local!companyData.PendingCompanyID), selection: false, identifiers:if(rule!COMMON_IsNullOrEmpty(local!datasubset), null, index(local!datasubset.data, "PendingCompanyID")), columns: {a!gridTextColumn(label: "CompanyName", field:"CompanyName", data: { index(local!datasubset.data, "CompanyName", {})}, alignment:"LEFT", links:apply ( a!recordLink( recordType: cons!DCM_COMPANY_RECORDTYPE, identifier:_ ), if(rule!COMMON_IsNullOrEmpty(local!datasubset),null, local!datasubset.data.PendingCompanyID) )), a!gridTextColumn( label:"Address Line 1", field:"AddressLine1", data:{index(local!datasubset.data, "AddressLine1", {})}, alignment:"LEFT" ), a!gridTextColumn( label:"Address Line 2", field:"AddressLine2", data:{index(local!datasubset.data, "AddressLine2", {})}, alignment:"LEFT" ), a!gridTextColumn( label:"Address Line 3", field:"AddressLine3", data:{index(local!datasubset.data, "AddressLine3", {})}, alignment:"LEFT" ), a!gridTextColumn( label:"City", field:"CityName", data:{index(local!datasubset.data, "CityName", {})}, alignment:"LEFT" ), a!gridTextColumn( label:"Zip Code", field:"ZipCode", data:{index(local!datasubset.data, "ZipCode", {})}, alignment:"LEFT" ) }, value:local!gridSelection, readOnly:false, saveInto:{ local!gridSelection } )), a!buttonLayout( primaryButtons:{a!buttonWidget(label:"Add New Company", style:"NORMAL", value:"AddNewCompany", saveInto: ri!button)}) } ) } ) ) )