Query based on relationship tables RRS feed

  • Question

  • Hi,

    nb : I can't put image and links, sorry. an error is showed ("Body text cannot contain images or links until we are able to verify your account."). I have asked to be verified...

    I have a problem on geting a result for a Query based on two tables in relationship.

    http : / / www . casimages . com / img . php?i=130703115442418439.png

    That is a simple example.

    I want to create a Query with this result :
    Get all commercial where commercialState.EndDate is NULL and commercialState.IsCial is True.

    On the Query designer, on Filet, I can see commercialState to select parameters.

    I see this post about LINQ and Preprocess but I don't understand how to reproduce for me. The example is not clear for me (LINQ is obscur too for me).

    - link I see #1 : http : // social . msdn . microsoft . com/Forums/vstudio/en-US/001a01fb-a881-43d8-b949-c05ce8798522/why-cant-i-create-a-query-that-shows-my-relationship-tables
    - MSDN help #2 : http : // msdn . microsoft . com/fr-fr/library/ff852040.aspx

    Can someone can explain me how to get my data (to put them in a Screen) with an example.

    Thanks for help.

    • Edited by Alex Saesee Wednesday, July 3, 2013 10:16 AM
    Wednesday, July 3, 2013 9:52 AM

All replies

  • Problem solved by this Preprocess (I just begin to understanding LINQ...) :

    partial void qActivCommercial_PreprocessQuery(ref IQueryable<commercial> query)
        query = from cial in query
        from cs in cial.commercialStateCollection
        where cs.EndDate == null
        where cs.IsCial == true
        select cial;

    Wednesday, July 3, 2013 12:07 PM