views:

3

answers:

0

I'm trying to filter a BDC list and my filter returns multiple values. When the BDC list is filtered it filters based on the first item and then ignores the remaining values. Has anyone run into this and how did you resolve it?

#region ITransformableFilterValues Members

        public bool AllowAllValue
        {
            get { return true; }
        }

        public bool AllowEmptyValue
        {
            get { return true; }
        }

        public bool AllowMultipleValues
        {
            get { return true; }
        }

        public string ParameterName
        {
            get { return "Ejemplo"; }
        }

        public ReadOnlyCollection<string> ParameterValues
        {

            get
            {

                List<string> regions = new List<string>();
                SPListItemCollection coleccion;
                using (SPSite site = new SPSite(SPContext.Current.Web.Url))
                {
                    using (SPWeb web = site.OpenWeb())
                    {                      
                        web.AllowUnsafeUpdates = true;
                        web.Update();
                        SPList list = web.Lists["Categorias"];
                        SPQuery query= new SPQuery();
                        query.Query= "<Where><Contains><FieldRef Name='Tags'/><Value Type='Note'>" +                HttpContext.Current.Request.Params.Get(0).ToString() + "</Value></Contains></Where>";

                        coleccion= list.GetItems(query);//this is the CAML query

                        debugger.Text = debugger.Text + "Items encontrados:" + coleccion.Count + "<br>" ;                                      
                        int i=0;                       
                        foreach (SPItem item in coleccion)//all the items i want i get them
                        {
                            try
                            {
                                regions.Add(item["Title"].ToString());
                                debugger.Text = debugger.Text + item["Title"].ToString() + "<br>";
                                i++;
                            }
                            catch (Exception ex)
                            {
                                debugger.Text = debugger.Text + item["Title"] + " Excepcion : values[" + i + "]" ;
                                i++;
                            }
                        }                                                         
                    }
                }
                ReadOnlyCollection<string> result = new ReadOnlyCollection<string>(regions);//i add the values to the collection to filter
                return result;

            }    
        }

        [ConnectionProvider("Filtro de ejemplos", "ITransformableFilterValues", AllowsMultipleConnections = true)]
        public ITransformableFilterValues SetConnection()
        {
            return this;
        }

    #endregion

related questions