Is there a way to refresh data that comes from a Rest API? I have an API that returns all Departments and after that I make count for those who are active. 

If I inactivate one department, after the action is executed the counter is not atualized, how can I update the total count from a value that comes from an API. Hopefully without using a variable to receive this total count.

Hello Marco.

To refresh you call it again. Don't try to take shortcuts or it can cause problems.

You can check the total number of records that are active with ListAll function. That returns the sublist with a given condition.


Nuno Reis wrote:

Hello Marco.

To refresh you call it again. Don't try to take shortcuts or it can cause problems.

You can check the total number of records that are active with ListAll function. That returns the sublist with a given condition.


Hi Nuno,

In my case I have the total values on an expression and the Rest API on preparation. I have not find a way to call it again and set the value without using a variable. On the OML file, I have it where I think it will not work using ListAll function.



Your refresh action needs a small change.

You filter the full list from Response and save the filtered list into the Departments that will feed the Table. Ideally, you'd call the service agfain, but you can use the one you got in Preparation.


Regarding the total count, you already have the quantities in GetAllDepartments.Response.Length (without filter) and in Deparments.Length (with filter). Unless you need something else, it is enough.

Nuno Reis wrote:

Your refresh action needs a small change.

You filter the full list from Response and save the filtered list into the Departments that will feed the Table. Ideally, you'd call the service agfain, but you can use the one you got in Preparation.


Regarding the total count, you already have the quantities in GetAllDepartments.Response.Length (without filter) and in Deparments.Length (with filter). Unless you need something else, it is enough.Hi 

Hi Nuno,

My problem is the Active departments count because if I click on IsActive column to inactivate ou active one Department the count is not refreshed. How can I update the count after doing that?

I have the OML with your changes.


Solution

I was looking to the other screen... It's not a good idea to have similar names.

The problem on this screen is that you save your changes to DB, but still read from the Web Service. Doesn't make sense to communicate with different protocols

Well, but focusing on your question:

For container ActiveCount you are reading from the call in preparation.

ActiveDepartmens(GetAllDepartments.Response)

That value hasn't changed.

You must feed it Deparments, the list that was updated.

Solution