locked
Filter Related Additional Screen Data - HTML Client RRS feed

  • Question

  • I have a four tables:

    Customer

    Products

    CustomerProductLinks

    Quotes

    I have a detail screen that displays the Customer and Product information successfully and actually even displays the related Quotes successfully.  So one Customer/Product can have multiple quotes.

    However, I would like to apply an additional filter, a toggle, that would simply filter the quotes to only those that are expired or not expired.  The Expired field is actually a date field, but simply want a toggle of yes or no to filter for those that have a value for expired or not.

    When I create a QuoteQuery and attempt to add that to the Customer/Product Detail screen, I am shown all quotes instead of those that are related to the Customer/Product.  How to get this to filter from the toggle switch and only display those related to the Customer/Product?

    Thanks in advance!

    Wednesday, November 5, 2014 6:49 PM

Answers

  • Try the following:

    1. Add a parameter to your query to take the toggle setting (e.g. a boolean ShowAll)

    2. Implement the Query_PreProcess() event which will take the above parameter as a one of the parameters tinto the method

    3. Depending on the value of that parameter passed (e.g. True or False) you can conditionally implement filter logic on the passed query

    Hope this helps


    Regards, Xander. My Blog

    • Marked as answer by Angie Xu Monday, November 17, 2014 5:25 AM
    Thursday, November 6, 2014 7:24 AM

All replies

  • The Query Designer helps you construct queries sent to the backend data source in order to retrieve the entities you want. You use the designer to create filter conditions and specify sorting options. A query in LightSwitch is based on an entity in your data model (for example, a Contact entity). A query can also be based on other queries so they can be built-up easily.

    Sorting and Filtering Data with Queries see:

    http://blogs.msdn.com/b/bethmassi/archive/2013/11/27/beginning-lightswitch-in-vs-2013-part-4-too-much-information-sorting-and-filtering-data-with-queries.aspx

    Thursday, November 6, 2014 2:54 AM
  • Been there but that didnt really help me for what I need...at least I didnt think it did.  I will look through it again just in case I missed something but I looked at it several times previously.

    Thanks!

    Thursday, November 6, 2014 3:24 AM
  • Try the following:

    1. Add a parameter to your query to take the toggle setting (e.g. a boolean ShowAll)

    2. Implement the Query_PreProcess() event which will take the above parameter as a one of the parameters tinto the method

    3. Depending on the value of that parameter passed (e.g. True or False) you can conditionally implement filter logic on the passed query

    Hope this helps


    Regards, Xander. My Blog

    • Marked as answer by Angie Xu Monday, November 17, 2014 5:25 AM
    Thursday, November 6, 2014 7:24 AM