ListRecords - if you set linecount with an expression maximum of 50 records are shown

ListRecords - if you set linecount with an expression maximum of 50 records are shown

  

Hi,

I have a list record widget. I set the source record list and the Line count: 

When debugging the line count has the right value (259) but on the screen I only get 50 records.

If I set the LineCount  directly to 259 I get all the values. Is there something I am not doing right here?

Hi ileana,

Create an expression on the screen set its value to be GetCountriesCount.List.Current.Count and check that the value is actually what is expected.

Maybe you have a connected paging item on the screen which limits the record count of the GetCountriesCount to 50? Also the brown surrounding of the box means there is an warning of outsystems your doing something not completely right, what is the warning (it's shown when you hoover with the mouse over the box)?

Hi,

Thanks for your suggestions,

I added an expression on the screen and i set the value to the getcountries.....Count and I have the right value, also I do not have a paging item on the screen. I will try to make an example and attach it here.

Maybe the datatype of your count item isn't an int but text, thus OutSystems reverts back to its default of 50 ? 

It seems you are using an agregate for this count, maybe its better to use an SQL block to just get a count?

Solution

Looks like a problem with the order that the query optimizations are occurring. 

Just guessing: Queries that are used as table/list sources are optimized to match the line count, but since both queries were not executed yet when it is determining the optimization it falls back to a lower value.


From that screenshot what you are trying to do is always show all the lines, right? Why don't you set the line count to a very large number?


Regards,

João Rosado

Solution

Hi,

I attached here an example of what I am doing, I also tried the sql version but i get the same thing.

Thank you

Hmm .. Joao is right .. if you try to set the number of records fetched by the agregate to a fixed number like 1000 it says it should be set to the number of records set by the list widget, so the screen optimizer is using the list widget to get the number of records to retrieve, but you did set is to the number of records the query will get .. so outsystems sets it to the default of 50.. the idea of Joao works, if you set the list widget linecount to 1000 it will get all the records from the country table, and limit the rows to the number of records in the table. 

If this is just an example, and your page list should be much longer as 1000 then I advise to a different architecture, the screen would be way too big and maybe even cause memory problems for the client or your server.. 

Hi,

Yes indeed I can use a very large number in there. It is not a functional likely scenario that the user will have in there hundreds of records. It was just something found during testing and I was expecting setting the linecount to work :) Thank you for your explanations and help!

He ileana oltean.

Can you try with GetCountries.List.Length? Or maybe GetCountries.Count? Note that you don't need to perform a different query just to obtain the number of rows of the GetCountries query.

Hi Leonardo,

With both getcountries.list.length and getcountries.count I get only 50 records shown.