;;webscript fieldbrokerlist( Integer nodeId, Integer listLen, RecArray brokersRec, Integer libraryReference, Assoc template = Undefined, Record request = undefined ) // listLen, the length of pulldownn menu (Usually 1 for popup or 4 for multi-select) // recs, all brokers // nodeID is deprecated ;Dynamic rec ;List hilightList = { libraryReference } ;String locationName ;String withinQuery ;String locationId ;Boolean IsInList = False ;Boolean doPopup = ( listLen == 1 ) ;Integer i = 1 ;String key = 'collections' ;Object bsModule = $Kernel.ModuleSubsystem.GetItem("webbrokeredsearch" ) ;if IsDefined( template ) ;locationName = template.locationName ;withinQuery = template.withinQuery ;locationId = template.locationId ;if IsDefined( template.collections ) ;hilightList = template.collections.components ;end // try from request first ;if IsDefined( request ) ;if IsFeature( request,'collections_search_selected_list' ) || IsFeature( request,'collections_search_selected' ) ;hilightList =_GetBrokerListFromRequest( request ) ;end ;end ;end // try from request ;if IsUndefined( locationId ) && IsDefined( request ) ;if Length( request.locationId ) > 0 && request.locationName == 'TRUE' && IsDefined( request.withinQuery ) ;locationName = request.locationName ;withinQuery = request.withinQuery ;locationId = request.locationId ;end ;end ;if ( ( Length( locationName ) > 0 ) && doPopup ) ;if IsDefined( bsModule ) ;end ;else ;;end ;Function Boolean _WithinSelected( List hilightList ) ;Boolean retval = FALSE ;Dynamic d ;for d in hilightList ;if ( Type( d ) == StringType ) ;retval = TRUE ;break ;end ;end ;return retval ;end ;function List _GetBrokerListFromRequest( request ) ;List retVal ;String item ;Integer itemInt ;List collections = {} ;if IsFeature( request, 'collections_search_selected_list' ) ;collections = request.collections_search_selected_list ;elseif IsFeature( request, 'collections_search_selected' ) ;collections = { request.collections_search_selected } ;end ;for item in collections ;itemInt = Str.StringToInteger( item ) ;if IsDefined( itemInt ) ;retVal = { @retVal, itemInt } ;else ;retVal = { @retVal, item } ;end ;end ;return retVal ;end ;Function Boolean noDefaultSelection( RecArray brokersRec, List highlightList ) ;Record rec ;for rec in brokersRec ;if ( rec.DATAID in highlightlist ) ;return False ;end ;end ;return True ;end