locked
Query to display available Stock items. RRS feed

  • Question

  • Hi, I am trying to create a query called Available Stock based upon my STOCKS table.

    Basically I need it to display all items that are not included in any orders (ORDERDETAILS table) therefore meaning all items that are shown have not been sold and would be available to be included in any future orders.

    I have the following in the preprocessQuery:

    Private Sub AvailableStock_PreprocessQuery(id As System.Nullable(Of Integer), ByRef query As System.Linq.IQueryable(Of LightSwitchApplication.Stocks))
                query = query.Where(Function(e) e.OrderDetailsCollection Is Nothing)
            End Sub

    and an optional parameter for the where filter.

    I have created a screen based upon this query by when I run it I just get a small red cross and a message saying "Unable to load Data, Please check your network connection"

    Any ideas what I am missing?

    Many thanks

    Monday, November 18, 2013 3:55 PM

Answers

  • Hi, Whats the realation to orderdetails. If its one to many try e.orderdetails.count = 0 Just a suggestion Regards Sven

    Sven Elm

    • Marked as answer by jcsf1 Tuesday, November 19, 2013 8:29 PM
    Tuesday, November 19, 2013 6:11 AM

All replies

  • Hi, Whats the realation to orderdetails. If its one to many try e.orderdetails.count = 0 Just a suggestion Regards Sven

    Sven Elm

    • Marked as answer by jcsf1 Tuesday, November 19, 2013 8:29 PM
    Tuesday, November 19, 2013 6:11 AM
  • Thanks Sven, that worked a treat although I'm not sure I understand how?

    Tuesday, November 19, 2013 8:28 PM
  • You could also check for children with .Any().
    Tuesday, November 19, 2013 11:41 PM