How to edit a part of a table

How to edit a part of a table

  

So, I have got in the cloud a table like this imported:

I do scan a code, like Betatest#4st2907. I find it in the database, and I want to change the 1 on the last column to a 0. But I can only use the delete and insert actions in a client side action, not in a server side action. How can I still change the 1 on the end to a 0?

Hi Michaèl,

You can use the AjaxRefresh statement. When you use it on a TableRecords it will ask you for a Row Number. If you put something there, it will only refresh that row:

Before that you will have to change the values in the current row of your table.

Was this what you wanted?

Cheers,

José

Hi Michael,

Editable Table Widget would be full fill your recruitment. Editable Table widget allows you to create and edit multiple or single records of an entity at once.


Thanks,

-HM-

José Costa wrote:

Hi Michaèl,

You can use the AjaxRefresh statement. When you use it on a TableRecords it will ask you for a Row Number. If you put something there, it will only refresh that row:

Before that you will have to change the values in the current row of your table.

Was this what you wanted?

Cheers,

José

This seems like a good solution. But where is this statement hidden? After looking in some menus I cannot find it anywhere...


Hi Michaèl,

In the Toolbox on the left when you are editing an screen action flow:

Cheers,

José

José Costa wrote:

Hi Michaèl,

In the Toolbox on the left when you are editing an screen action flow:

Cheers,

José

Somewhy in this menu I don't have the AjaxRefresh statement. Is the feature available if you are creating a mobile app, or is it just for if you create a website? Or is it a very recent adition (I work with something like Outsystems 10.0.5xx) where it isn't yet implemented?

Hi Michaèl,

Since you are developing a mobile app that changes things a little bit... :)

The Ajax Refresh is only available in Web apps. Mobile apps use React and thus the moment you change a value of a variable that is on the screen the screen changes to reflect the changes in the values of the variables.

Thus, getting back to your original post, you want to change a value in a Server Action and you want it reflected on the screen. Is that it? 

If that is it, where do the values on your screen come from? Because there (the variables from where your values come) is where you have to update to see the values change in the screen.

Cheers,

José

I'll try to explain this a little better:

First, I get all codes from this database to check or the input is in the datababase. If it is in the database,

there is an integer that says how many times the code may be used. If the integer is 0, I give an error that the code is invalid.

Here comes the tricky part:

I must change this integer I used to check or the code was legal to itself -1. Directly changing the code in the table did not work (assignment 2) so I tried to save it to a variable...

and insert it like this into the table.

But for that I need a code record, so this method does not work as well to edit the table.

So my question is: how to edit this record in this table? I hope I made it now easier to understand.


Cheers,

Michael

Hi Michaèl,

What List are you iterating in the for each? Is it the same that you are doing the update?

I'm asking this because you can not update a list that is being iterated. To work around that, you have to use the ListDuplicate action to create a copy of the list, iterate the copy and do the update in the original list.

If that is not the issue, could you share an oml with what you are doing?

Also, I still did not understand if you are working in a Mobile app or a Web one...

Also, are you trying to display that list in the screen?

Cheers,

José

Solution

Hi Michaèl,

You need to make sure the Aggregate that is being used as the source for your List widget gets updated.

I'd suggest you:

  1. Update the FindCode.List.Current.Code.Got like you show in the assignments screenshot (middle assignment)
  2. Use the UpdateCode Database Entity Action (find it by expanding the Code entity, on the Data tab) to update the FindCode.List.Current.Code record on the database.
  3. Once that is done, you can use the Refresh tool to re-execute the screen Aggregate that is being used as source for your List widget.
  4. This will trigger the screen to re-render the list and reflect the changes you've done to the Code record
Solution

Jorge Martins wrote:

Hi Michaèl,

You need to make sure the Aggregate that is being used as the source for your List widget gets updated.

I'd suggest you:

  1. Update the FindCode.List.Current.Code.Got like you show in the assignments screenshot (middle assignment)
  2. Use the UpdateCode Database Entity Action (find it by expanding the Code entity, on the Data tab) to update the FindCode.List.Current.Code record on the database.
  3. Once that is done, you can use the Refresh tool to re-execute the screen Aggregate that is being used as source for your List widget.
  4. This will trigger the screen to re-render the list and reflect the changes you've done to the Code record

Thanks! I got it to work!