locked
Query is not always returning data in the screen with the HTML Client (VS 2012.4) RRS feed

  • Question

  • I made a simple query to return the patient current (today’s) visit and it’s not always returning the data when used in a screen. If the screen is set as the home screen it always return the data but if the screen is open from another screen it is not always returning the data. I made a test going back and forth from the home screen to the visit screen and it shows the data about 1 time out of 5. I also made some test to get the data from the dataWorkspace and it work well but when I use the visual collection instead the data is not always returned.

    Here is the code of my query:

    Private Sub Current_Visit_PreprocessQuery(Patient_ID As System.Nullable(Of Integer), ByRef query As System.Linq.IQueryable(Of LightSwitchApplication.Visit))
        query = query.Where(Function(Entity) Entity.Patient.ID = Patient_ID And EntityFunctions.TruncateTime(Entity.DateTime) = Today).Take(1)
    End Sub
    
    Thanks!

    Tuesday, January 14, 2014 10:17 PM

All replies

  • HI VAlain

    You can find and fix errors that occur in the code that you write by debugging your application, and enable diagnostics in your apps, and it will give some hints why it happens.

    To enable client tracing at design time

    1. In Solution Explorer, double-click Properties to open the Application Designer.

    2. On the Application Type tab, in the Client section, select Web.

    3. On the View menu, click Other Windows and then click Output to display the Output window.

    4. On the Debug menu, click Start Debugging.

    5. In the address bar of the browser, add client tracing arguments to the end of the URL as follows:

      • To display an error-level trace, type LC=Microsoft.LightSwitch,E.

      • To display a warning-level trace, type LC=Microsoft.LightSwitch,W.

      • To display an information-level trace, type LC=Microsoft.LightSwitch,I.

      • To display a verbose trace, type LC=Microsoft.LightSwitch,V.

    hope it helps.

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    • Edited by Angie Xu Friday, January 17, 2014 1:50 AM
    Friday, January 17, 2014 1:49 AM
  • Hi Angie,

    I enabled client tracing and didn't see any error in the output window.

    Alain

    Friday, January 17, 2014 5:37 AM
  • Hi VAlain

    Please take a look at Michael's blog about Understanding The LightSwitch HTML Client Visual Collection , it's useful to use Visual collection.

    Regards

    Angie


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, January 21, 2014 7:49 AM
  • Hi Angie,

    I have already read that article and understand well the Visual Collection and the Promise Object.

    I have since found the source of the problem, I don't know if it's documented somewhere but I didn't found any information about that particular issue yet, here is what I found out:

    When a parametrized query is bound to an other query it appear that the parametrized query can be exectuted before the bound query in wich case the results of the parametrized query will be wrong of course...

    Regards,

    Alain

    Tuesday, January 21, 2014 3:44 PM