none
FilterDescriptor blow up

    Question

  • Hello everyone, 

     

    I have a strange problem with the Filter Descriptor.

     

    I want to filter something like this:

      

                ControlParameter searchParamter = new ControlParameter()
                {
                    ControlName = "MitarbeiterFilter",
    
                    PropertyName = "Text",
    
                    RefreshEventName = "TextChanged",
    
                };
    
                FilterDescriptor fd = new FilterDescriptor()
                {
                    PropertyPath = "firstname",
    
                    Value = searchParamter,
    
                    Operator = FilterOperator.IsEqualTo
    
                };
    
                dds.FilterDescriptors.Add(fd);
     

    The only thing is, I use the Include Attribute in the Metaclass for my Entitties.

    But If I start my application, Visual Studio blows up without an error message.

     Dows anyone knows what it can be?

     

    Best regards and thanks

    Patrick

    Friday, October 23, 2009 6:25 AM

All replies

  • You have an additional comma after RefreshEventName = "TextChanged",

    Friday, October 23, 2009 6:43 AM
  •  Thank you for this fast answer, but it didn´t solved the problem.

    Without the same happen, Visual Studio blows up, if I start my application with this Filter Descriptor

    Friday, October 23, 2009 6:59 AM
  •  
    Friday, October 23, 2009 7:01 AM
  • Have you removed the FilterDescriptor to see if Visual Studio works without it?

    Friday, October 23, 2009 7:02 AM
  •  Yes, I without it, it works fine. And the datagrid and the forms works fine too.

    But only with the Filter Descriptor it blows up.

    The same happen, if I do it in the XAML. The only difference is, if I do it in XAML Visual Studio only blows up, if I type something in de Filter TextBox.

     Do you have any idea?

    Friday, October 23, 2009 7:10 AM
  • Try chaging the Operator to Contains, rather than IsEqualTo.

    Friday, October 23, 2009 7:15 AM
  • I tried to use another operator, but it doesn´t helped.

     

    Do you have another idea?

    Friday, October 23, 2009 7:23 AM
  • Have you tried to move both Control Parameter and Filter Descriptor to XAML?

    Friday, October 23, 2009 7:28 AM
  •  Yes, I moved both to Xaml, then the application works. But if I typed something in my textbox it blows up too

    Friday, October 23, 2009 7:32 AM
  • Are you setting a LoadSize in your DomainDataSource?

    Friday, October 23, 2009 7:35 AM
  •  Yes, of course, I have set a LoadSize, is this not right?

    Friday, October 23, 2009 7:48 AM
  • No, that is good :o)  Have you tried creating a new project with just these details in getting that to run?  Like a stripped down version.

    Friday, October 23, 2009 7:51 AM
  •  Of couse, this is only the project with just this feature.

    Friday, October 23, 2009 7:53 AM
  • So, it doesnt matter whether you start a new empty project or whether you have an existing project, it still crashes VS?

    Friday, October 23, 2009 8:18 AM
  • Of course, it crashes even if i´m using the filter descriptor.

    But only if the datasource has foreign keys which i assigned with the Include Attribute.

    On a datasource without relations it works

    Friday, October 23, 2009 8:20 AM
  • What sort of data volume are we talking about when you use your includes?

    Friday, October 23, 2009 8:23 AM
  • It is only a 1:N Relationship and the type is Integer for the ID.

    But the seaching has directly nothing to to with the ID, I only want wo search at the firstname. 

    Friday, October 23, 2009 8:38 AM
  • And the FirstName column only exists in one of the tables?

    Friday, October 23, 2009 9:14 AM
  •  Of course, only in one column. And with table_workers.firstname it also crashes;)

    Friday, October 23, 2009 9:29 AM
  •  Hi,

    now, I have reinstalled whole Visual Studio and its components.

    Now it doesn´t blow up anymore.

    But If I want to filter something the activity control is showed, but the records are the same as before.

    Only If I set a standard Text to the TextBox, if I start the application, no record will be displayed.

    But never the right records I want to have with the filtre.

    At the Starting- > no records with an active filter

    and during the Running - > all records with no affect from the filter.

     

    Does anyone knows something because of that?

    Monday, October 26, 2009 4:38 AM
  • Which Operator are you using?

    Monday, October 26, 2009 4:50 AM
  •  I´ve tried Contains, IsEqualTo, or IsGratherTanOrEqualTo

    Monday, October 26, 2009 4:58 AM
  • And the filter has been added to the DomainDataSource?  I mean, you can see the filter applied to the DomainDataSource in debug?

    Monday, October 26, 2009 5:31 AM
  •  I think so, I did it in code:

     

     <riacontrols:DomainDataSource x:Name="dds" QueryName="GetTable_worker" AutoLoad="True">
                <riacontrols:DomainDataSource.DomainContext>
                    <ds:TCSContext/>
                </riacontrols:DomainDataSource.DomainContext>
                <riacontrols:DomainDataSource.FilterDescriptors>
                    <riadata:FilterDescriptorCollection >
                        <riadata:FilterDescriptor PropertyPath="number" Operator="IsGreaterThanOrEqualTo" >
                            <riadata:ControlParameter ControlName="MitarbeiterFilter"  RefreshEventName="TextChanged" PropertyName="Text" />
                        </riadata:FilterDescriptor>
                    </riadata:FilterDescriptorCollection>
                </riacontrols:DomainDataSource.FilterDescriptors>
            </riacontrols:DomainDataSource>
      
    Monday, October 26, 2009 6:14 AM
  • Can you default the MitarbeiterFilter text to 0 on the load and this should bring back lots of results?

    Monday, October 26, 2009 6:16 AM
  • Also, try adding a SortDescriptor.  I've just tried mine without the SortDescriptor and it stopped working.

    Monday, October 26, 2009 6:18 AM
  •  I added a SortDescriptor like this:

      

    <riacontrols:DomainDataSource.SortDescriptors>              
                    <riadata:SortDescriptor PropertyPath="number" Direction="Ascending" />   
                </riacontrols:DomainDataSource.SortDescriptors>
     
    But then no one record will be displayed any more 
     
    Monday, October 26, 2009 6:53 AM
  • Did you default the Text?

    Monday, October 26, 2009 7:30 AM
  •  No, no default Text

    Monday, October 26, 2009 7:36 AM
  • So, if you did default the Text to a 0 (zero) you should get all of your results back?

    Monday, October 26, 2009 7:39 AM
  • I should get all, but i get nothing

    Monday, October 26, 2009 8:32 AM
  • When you debug the code, are you getting any results back?

    Can you post your query?

    Monday, October 26, 2009 8:42 AM
  •  How can I debug the code, it is in the XAML.

    I thought I have to set a stop point, but I did it in XAML?

     

    Which Query do you mean?

    Monday, October 26, 2009 9:04 AM
  • The Linq query that your executing from your DomainDataSource.

    Monday, October 26, 2009 9:24 AM
  • ah ok,

     

    this is the Query:

     

    return this.Context.table_worker.Include("table_actiongroup");

      

     

    When I debug this, all records are there, but the datagrid will be empty

     

    Monday, October 26, 2009 9:50 AM
  • Can you post your latest version of the DomainDataSource?

    Monday, October 26, 2009 10:21 AM
  •  

     <riacontrols:DomainDataSource x:Name="dds" QueryName="GetTable_worker" AutoLoad="True">
                <riacontrols:DomainDataSource.DomainContext>
                    <ds:TCSContext/>
                </riacontrols:DomainDataSource.DomainContext>
                <riacontrols:DomainDataSource.FilterDescriptors>
                    <riadata:FilterDescriptorCollection >
                        <riadata:FilterDescriptor PropertyPath="number" Operator="IsGreaterThanOrEqualTo" >
                            <riadata:ControlParameter ControlName="MitarbeiterFilter"  RefreshEventName="TextChanged" PropertyName="Text" />
                        </riadata:FilterDescriptor>
                    </riadata:FilterDescriptorCollection>
                </riacontrols:DomainDataSource.FilterDescriptors>
                <riacontrols:DomainDataSource.SortDescriptors>              
                    <riadata:SortDescriptor PropertyPath="number" Direction="Ascending" />   
                </riacontrols:DomainDataSource.SortDescriptors>
            </riacontrols:DomainDataSource>
      
    Monday, October 26, 2009 10:42 AM
  • Add a LoadSize of 20 to see if you get any results.

    Monday, October 26, 2009 10:44 AM
  •  Now I added a LoadSize of 20, but there are no records in my datagrid.

     Only if I remove the SortDescriptor, all records will be displayed, but not filtered.

     

    Best regards

    Tuesday, October 27, 2009 2:52 AM
  • Are you loading a DomainDataSource in code as well?

    Are you amending the context in any code?

    Tuesday, October 27, 2009 4:35 AM
  •  Not a new one.

    I give the DomainDataSource.DomainContext to my AddRecord Child Window for the list for the foreign key list.

    Tuesday, October 27, 2009 6:34 AM
  • This might be your issue.  When is this getting called?

    Tuesday, October 27, 2009 6:35 AM
  •  I call this at the beginning, becuase I need the Foreign key list for my combox, because if i use a new Context, the foreign key entry will be created twice, because it have to be the same context.

     And without the sortdescriptor it works fine, only the filterdescriptor doesn´t work

    Tuesday, October 27, 2009 6:46 AM
  • Have you commented out the line to see if it works without the foreign key information?

    Tuesday, October 27, 2009 6:50 AM
  •  Ok, i tried this a few minutes ago,

    But it didn´t changed anything.

    Tuesday, October 27, 2009 7:21 AM
  • Sent you a private message.

    Tuesday, October 27, 2009 9:47 AM
  • Patrick,

    Did you solve this? I couldn't tell from the preceding, but what type of control is MitarbeiterFilter? I know you are trying to pass an int.

    I have a similar situation were I can get my records via code but not thru XAML. The difference is that I pass a long via code and i am not sure of which type of control to reference as the examples principally show textboxes. I have seen a checkbox which might be good for a boolean. But what do you use for a long?  I tried using a text box, but is not working and there are limited other examples which show other controls that might it.

    I am wondering if there is something other binding than a control which can be used is set the items in the FilterDescriptorCollection. There is scant details about the class atleast in regards to Silverlight.

    Was the private message that in the RIA beta that this hasn't been addressed?

    Marc

    Friday, October 30, 2009 8:56 AM
  • The private message was asking for the source so I could take a look.

    Friday, October 30, 2009 8:58 AM
  • Thanks for the clarification. I take it that nothing seemed wrong?

    Marc

    Friday, October 30, 2009 9:12 AM
  • I never got the code.  You mentioned you were having problems.  You still having them?

    Friday, October 30, 2009 9:40 AM
  • Yes, but I somewhat certain that I has to do with how to pass a numeric parameter via the FilterDescriptorCollection without it being attached to a ControlParameter.

    A textbox ControlParameter requires a PropertyName attribute, but for others I am not sure which; I suspect either Value or SelectedItem. I am thinking about the need for some generic controls to just pass variables other than visual controls.

    Marc

    Friday, October 30, 2009 10:27 AM
  •  Hi Ardman,

     

    thank you for the message, to send you the code. It is very nice.

    I will do this, this weekend.

    Sorry, that you still not got the code, but i was not at home the last week.

     

    Regards

    Patrick

    Friday, October 30, 2009 3:58 PM
  • Hi Patrick,

    Thanks for the code.  I've sent you an email response.

    Tuesday, November 17, 2009 6:28 AM