none
Query returning inconsistent results RRS feed

  • Question

  • Hi

    I have a query that is generating strange, inconsistent results and I cannot figure out what is going on!

    In my application there is a text box where a user enters a string to search for a record. There is only one search box, and the field being queried in the database is a string as well. Sometimes the query returns correct results (displaying the tile) and other times it displays nothing (in spite of the record existing, as shown by running a SQL query). Checking the console in the browser shows the server is returning an empty data set when there are no results being shown on the screen.

    I tried using the built in LightSwitch search as well, and it is returning results in a similar fashion as my query. As far as a I can tell all of the records being searched for are similar (similar fields populated in the DB, etc.). 

    At this point I'm not really sure where to even begin looking for the issue, since it works sometimes..

    Thanks in advance for any advice.

    Friday, December 14, 2018 9:20 PM

All replies

  • Have you looked at the query that is being sent to the server when you run a search? I think they are in Linq format. I used the browser console to grab it similar to how you were checking the server response.

    As an example, I have a search box on one of my apps that is searching a string field. If I start capturing Network traffic and perform a search for the string 'test' the "URL" looks like this:

    /My_App_Name/AppData.svc/vwMySQLView?$filter=substringof('test'%2C%20Column_Name)&$top=50

    I would be curious to see if there were a difference in what was being sent up when you get good results vs when you get no results.


    Jeremy

    Wednesday, December 19, 2018 6:34 PM
  • Thanks for the thought Jeremy. When I look at what is being sent up it is exactly the same (other than the string entered by the user). 

    I also built a new LightSwitch application from scratch, just to see if it would behave the same with the same DB, and it does. So, it seems I have an issue somewhere in my DB, but I'm not sure what it would be. Perhaps I will start be deleting some relationships and go from there.

    Friday, December 21, 2018 6:57 PM