How to use Refresh Data on a list of record

How to use Refresh Data on a list of record

  

Hi Guys,


So I have these server action which handles the searching and pagination of my page. In this page, I display a list of records and the source is from a server action which is from another module. The server action outputs a list of record.

Now, the problem is the Refresh Data widget is working well when using Aggregate from the Preparation action but if I made use of the List of record coming from my server action, the server action is not visible on the list of option when  using Refresh Data widget.


Hoping for a positive response. Thanks!

Hi JaySmooth,

The Refresh Data tool only works for queries (Aggregates or SQL).

If your data source is the output of a server action, you will need to call it again on the screen action. You accomplish this following these steps:

  1. Create a Local Variable on your Screen (I'll call it ActionOutput);
  2. On the Preparation, after calling your server action assign it's output to the ActionOutput local variable;
  3. On your Screen, use the ActionOutput local variable as the Source Record List of your TableRecords/ListRecords widget instead of directly the output of your server action from the Preparation;
  4. On the Screen Action, instead of the Refresh Data you were trying to use, execute your action again, assign it's output to the ActionOutput local variable, and Ajax Refresh the TableRecords/ListRecords.

Hope this helps!

Jorge Martins wrote:

Hi JaySmooth,

The Refresh Data tool only works for queries (Aggregates or SQL).

If your data source is the output of a server action, you will need to call it again on the screen action. You accomplish this following these steps:

  1. Create a Local Variable on your Screen (I'll call it ActionOutput);
  2. On the Preparation, after calling your server action assign it's output to the ActionOutput local variable;
  3. On your Screen, use the ActionOutput local variable as the Source Record List of your TableRecords/ListRecords widget instead of directly the output of your server action from the Preparation;
  4. On the Screen Action, instead of the Refresh Data you were trying to use, execute your action again, assign it's output to the ActionOutput local variable, and Ajax Refresh the TableRecords/ListRecords.

Hope this helps!


Thanks Jorge for your quick response!

I did try your example but my list consist of very large data set - 600, 000 records which means that every time I paginate, I ended up getting again all the records, store it in a local variable which is a very slow process. Wherein if I use the Refresh Data (using Aggregate), it is quite efficient and mostly effective.

Hi,


If you server action is calling any External REST API or Webservice to getting data, then there is no other way to use Aggregates, you have to use the same procedure as Jorge told.


If you server action have any Aggregate inside getting data in some other module then, you can make related tables as public in other modules, so you consume in your current module, and execute them in your local preparation, so you can able to manipulate data easily.


Thanks,

Balu

JaySmooth wrote:

Thanks Jorge for your quick response!

I did try your example but my list consist of very large data set - 600, 000 records which means that every time I paginate, I ended up getting again all the records, store it in a local variable which is a very slow process. Wherein if I use the Refresh Data (using Aggregate), it is quite efficient and mostly effective.

Hi JaySmooth,

the behaviour you are experiencing is because the platform optimizes the Aggregates from the preparation by only fetching the data that is actually going to be displayed (number of records and which attributes).

If you want the same kind of functionality, your server action needs to be told which records to return (for instance, first record to return and how many records after that one). Then you can still use the approach I described, passing the values from the pagination widget and table records to your server action. But you need to implement these optimisations (only fetch from the database records 25 to 49 of the result set) on your server action.