This project is read-only.
2
Vote

Can't filter by Task Status field

description

Hi all
I have a problem with TST Content by Type version 1.2 & 1.3 when show Task list elements, i can't filter by Task Status field. This is because default task list have distinct InternalName for field Status that the Task Content Type, but both have de same ID.
I have seen that if i change the file FiltersToCAML.cs, GetCAML method, when it says
 
/*
                 * FieldRef: Het veld waarop we gaan zoeken.
                 */
                Guid id = Guid.Empty;
                if (GuidUtil.GuidTryParse(filter.Field.Id, out id))
                {
                    xw.WriteStartElement("FieldRef");
                    xw.WriteAttributeString("ID", id.ToString("B"));
                    xw.WriteEndElement();
                }
                else
                {
                    xw.WriteStartElement("FieldRef");
                    xw.WriteAttributeString("Name", filter.Field.Name);
                    xw.WriteEndElement();
                }
 
It must be say
 
/*
                 * FieldRef: Het veld waarop we gaan zoeken.
                 */
                Guid id = Guid.Empty;
                if (GuidUtil.GuidTryParse(filter.Field.InternalId, out id))
                {
                    xw.WriteStartElement("FieldRef");
                    xw.WriteAttributeString("ID", id.ToString("B"));
                    xw.WriteEndElement();
                }
                else
                {
                    xw.WriteStartElement("FieldRef");
                    xw.WriteAttributeString("Name", filter.Field.Name);
                    xw.WriteEndElement();
                }
 
, just replace filter.Field.Id by filter.Field.InternalId

comments

edwinv wrote Sep 16, 2010 at 9:07 AM

We experience the same problem.

edwinv wrote Sep 16, 2010 at 9:16 AM

A work around if you don't want to modify and compile the project yourself, is to add a calculated field to your task content type using the formula =Status
Then filter the webpart on your calculated field instead of the normal "Task Status" field.

wrote Feb 14, 2013 at 1:53 AM