Answered Programatic Filter

  • Friday, March 02, 2012 7:51 PM
     
     

    I have devized a screen

    What is wattermarked helps me filter future tables or it should.

    What is the best way to filter my 2 history tables that I get only records valid like the example below:

    DeLa.Year <= Anul <= PanaLa.Anul && DeLa.Month <= LunaID <= PanaLa.Month

All Replies

  • Saturday, March 03, 2012 7:40 AM
     
     Answered
    1. Create a query based on your history table
    2. Add two integer parameters for Month and Year to the query.
    3. Use those parameters in the Filter definition of the query.
    4. Add the query to the screen.
    5. Bind the query parameters on the screen to the month & year fields on the screen.

    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

  • Saturday, March 03, 2012 10:09 AM
     
     

    Thank you for answering me.

    I know how to do that but I want to expose the properties that I have set up in application to the server side so I can diagrammatically filter my tables

    Ex:

    result = from p in Entitati Where p.DeLa <= parData && p.PanaLa >= parData Select p;

  • Saturday, March 03, 2012 10:40 AM
     
     

    Then I have no idea what you mean.

    Could you explain it some more?


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

  • Saturday, March 03, 2012 1:31 PM
     
     

    Well I did what you said and it is working thanks I'll mark your answer as useful I wanted something else thow ...

    LightSwitch lets you programaticaly query the table on the

    MyEntity_All_Executed(IEnumerable<MyEntity> result)

    here it lets you write a linq expresion but for some reason it does not let me ... in VB it is working in C# I'm having problems ...

  • Saturday, March 03, 2012 1:42 PM
     
      Has Code

    If you want to use the filter parameters in code rather than in the query designer you should use the PreProcessQuery event, not the Executed event.

    you would write something like a lambda query:

    query = query.where(p => p.DeLa <= parData && p.PanaLa >= parData)

    This adds your where clause (filter) to the query before it is sent to the server. But with such simple filter conditions you can achieve what you want in the query designer without having to write any code.


    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.

  • Sunday, March 04, 2012 8:13 AM
     
     

    Yes meanwhile I discovered that.

    The BIG problem is that I did not yet find  a system that will expose the variables set from client user interface to the server side where the lambda expression is ...

  • Sunday, March 04, 2012 10:46 AM
     
     
    You have to pass all the data you need as parameters to the query. You bind the query parameters to the fields on the screen using the properties box.

    Simon Jones
    If you found this post helpful, please "Vote as Helpful". If it actually answered your question, please remember to "Mark as Answer". This will help other people find answers to their problems more quickly.