Showing Number of Records in Table dynamically and not by preset number

Showing Number of Records in Table dynamically and not by preset number

  

Hello everyone,


I am running into an issue which I am trying to find a resolution too. To better explain the title, I am trying to show all the records on the page that are in the list. This seemed like a simple request, but I have been trouble getting this to work dynamically. We are using a list variable and because of the various combinations of lists that can be returned through filtering, it is impossible to know ahead of time a preset amount of records to return. The reason we need these all on one page without paging is a business request otherwise I'd just have paging and call it a day. An example of a problem is that one combination could return 102 records while the next returns 16. This creates a headache with OutSystems since the table needs a preset Line Count of the max number of rows. I wanted to pick some of your brains to see how some of you worked around this? 


Here are some solutions I have thought of and tried with little to no success or am trying to avoid if necessary:

1.) Make line count zero in hopes this would then default to the size of the list, but it still only returns the top 50 or 100 records (found this through testing).

2.) Returning the record count ahead of time and changing the table property before inserting the records. From my attempts, it does not seem this is possible.

3.) Made line count an extremely large number. I would prefer not to do this since there is still the chance that that number gets exceeded. If possible, I'd for this to be calculated dynamically and accordingly to the size of the list that's in the table.


Hopefully there is another solution out there that may help me with my problem. Thanks to all in advance who try to help! I am hopeful to hear from you soon!


Thanks,

Sean

Solution

Hi Sean,

Did you try <nameOfList>.Length? You can try to use a advance sql instead of an aggregate. not sure how Outystems behaves when this line count is dynamic but when is an integer and you use aggregates outsystems does some performance enhancements and only bring that number of records.

Hope this helps.

Regards,

Marcelo

Solution

Hi Sean, Since you always want to show all records, you could set the Line Count of the Table widget or List widget to 999. If, there could be 1000 records or more at some point, you probably don't want to show them all on a screen. 

You could also set the Line Count to YourAggregate.Count, but I don't recommend this. It would be better to set a high, but reasonable number, and show an appropriate message if the results exceed this number. 

The Count property returns the number of rows in the Aggregate regardless of any optimizations that might affect something like YourAggregate.List.Length.


Marcelo Ferreira wrote:

Hi Sean,

Did you try <nameOfList>.Length? You can try to use a advance sql instead of an aggregate. not sure how Outystems behaves when this line count is dynamic but when is an integer and you use aggregates outsystems does some performance enhancements and only bring that number of records.

Hope this helps.

Regards,

Marcelo

Hi Marcelo,


After reading your response I don't know why I didn't try this... I got hit with a DUH! moment right in the morning. This worked. Thanks for your response.


Cheers,

Sean


Marcos Galigarcia wrote:

Hi Sean, Since you always want to show all records, you could set the Line Count of the Table widget or List widget to 999. If, there could be 1000 records or more at some point, you probably don't want to show them all on a screen. 

You could also set the Line Count to YourAggregate.Count, but I don't recommend this. It would be better to set a high, but reasonable number, and show an appropriate message if the results exceed this number. 

The Count property returns the number of rows in the Aggregate regardless of any optimizations that might affect something like YourAggregate.List.Length.


Hi Marcos,


Thanks for the reply. This was going to be my next step (setting the value to a high number and sending a warning message saying not all records are returned), but Marcelo's solution worked for me. Good solution though!


Thanks,

Sean