Clearing a table records results in odd results

Clearing a table records results in odd results

  

Hi 


I hold a table records which is fed by SQL. It has a search box to seek for some data and a CLEAR button to reset the filters and to update the table. Nevertheless, if I press twice or thrice the clear button we can see different results in the table every time. It has a random behavior! In the debugger mode it is clear that the structure is always filled with random data coming from the database... very odd.. is this the typical behavior? 

Does this should happen? I am not figuring out what's going on even using the debugger. Any hints would be great. Thank you. 


Jorge

Hi Jorge,

I already saw this behavior, and it was something related to the properties of the widgets involved (pagination/Table/List records and aggregate/SQL), but I don't remember what was. I think it was something was missing(should be defined but it wasn't.

You can check if everything is ok and pointing to the right place, and for sure you will find the problem :)

Cheers,

Eduardo Jauch

Hi Jorge,

Let me ask you something:

Do you have a variable in the "Line Count" property of the TableRecords that gets its value from the number of records in SQL list? Or a variable in the "Start Index" property?...

Cheers,

José

Hi José


Line Count is set to 50 and Start Index is set as 

SyntaxEditor Code Snippet

List_Navigation_GetStartIndex(TableRecords1.Id, True)


Solution

Hi Jorge,

Does your SQL has an order by to ensure that the results will always come on the same order?

In some specific scenarios I have seen queries returning different order of results based on the optimizations automatically done...

Ana Reis

Solution

WOW!! THAT did the trick Ana!!!

/dancing! 

Now the table is always fixed. Without an order By the SQL delivers random results when pressing the CLEAR button several times in a row (it will not happen but it is nice to have the fixed table)... I forced the Order bY and that's it. It is working like a gem. 


"You cannot be sure how Query Optimizer will read data unless you explicitly force to sort result in specific way using ORDER BY [attribute(s)]."


Thanks! :)