Checkbox - Can't find "content" to use in update function.

Hello all, I am trying to update an entity's attribute (a Boolean) to be true or false depending on a checkbox. Pretty simple. The twist is that it is inside a table records and I can't seem to reference the "content" of the checkbox. Here is what it looks like: 


I figured I couldn't just use a variable since it depended on which "row" was being clicked.

How can I do that?

Hi Vinicius,

Give your Table a name and then you can use TableName.List.Current.YourRecord.YourFlag to get the specific value.

You don't need a local variable as an intermediary.

If a column with the 'is verified' boolean already exists in your database table or List, you can bind your checkbox directly to that value:

YourTableName.List.Current.RecordName.IsVerified

You see guys, that's what I thought too initially, but if I do that like you guys suggested this is what happens:

I have an "on change" function set to the checkbox. Once it changes, it updates the entity using the update function. I have linked it like you suggested, using the table name and the existing one. 

However, once I flip these: 


and I refresh the page, they do not get updated. When I debugged it, it didnt' even update in the database, so I don't think it's working.

Just checking a few things:

- When you debugged using the debugger, did you check the state of the record in the OnChange Action before the database update, and was the boolean flipped correctly in that stage? 

- Did you refresh the whole page (like you would with F5) or did you use Ajax refresh?

When you say they didn't update in the database, are you saving them yourself? What do you see when you're debugging - are the correct values being read but not being written to the database?

Could you share your espace file?

I am using the update function to change the value of IsValid in the entity to the value stored in the Table1. 

Here is the espace. 

Monique de Vos wrote:

Just checking a few things:

- When you debugged using the debugger, did you check the state of the record in the OnChange Action before the database update, and was the boolean flipped correctly in that stage? 

- Did you refresh the whole page (like you would with F5) or did you use Ajax refresh?

Hi, I posted the OML file here, and I used an Ajax refresh on the table widget, where the checkbox is.


Solution

Add a Query refresh alongside your AJAX refresh. The changes you do in the table are lost when you AJAX refresh, and just updating the database does not make it so new results are fetched:

Solution

Afonso Carvalho wrote:

Add a Query refresh alongside your AJAX refresh. The changes you do in the table are lost when you AJAX refresh, and just updating the database does not make it so new results are fetched:


Perfect! Thank you kind sir!

No problem. Another remark: unless you're doing very specific things with your data, you don't usually need to use a GetForUpdate - you shouldn't be having concurrency problems in a Form.

Yeah I was not using it initially, but someone suggested that I did, maybe they meant in another usage. Thank you for the suggestion!