How to compare the old value and new value of a cell

hi,
i need to compare the first value of the cell and changed value to run my query, but i do not know how to write the code... only run when...

{{table1.selectedCell.value !== table1.changesetArray[0].value}}

thanks in advance.

Use a CASE statement if running postgreSQL or in JS use an if statement

i want to define a rule for my query, which will check the condition and if the condition is provided, then trigger my query. is it possible to do that in only run when place?
puttingConditionToRunTheQuery

Yes, so use
{{table1.selectedCell.value !== table1.changesetArray[0].value}}
in the field you highlighted...though what is the event you want the query to check to logic?

1 Like

if there are many changes in changesetArray, which one is right one, how can you determine?

table1.changesetObject[1].find(each =>{
  if(each === table1.selectedCell.columnId){
  if(table1.changesetObject[1][each] !== table1.selectedCell.value){
    return true;
  }
  }
return false;
  })

i have no idea, what i am doing :wink:

Hello @halil (Hoşgeldin),

You can basically find changeset array by selected row id.

{{ !!_.find(table1.changesetArray, { id: table1.selectedRow.id }) }}

If changeset array has value with selected row's id, bum!

1 Like

hi Enver(hoşbulduk)

there could be more than one change in a single row, since we allow to user to change a couple of column data.

or i can put that condition for every column, but we have almost 40 column in single table.

It doesn't matter how many columns are changed in a row. It will work even if the condition changes 1 or 30 columns.

1 Like

many thanks @edurmush

1 Like

hi Enver again, when user changes a cell then press enter, then the selected row will be next row. is it possible to prevent it? this code can catch the changes in every rows?

The existence of changesetArray already tells that there has been a change in the table and which rows have changed. Can you give some more details about the scenario?

for example i have customer table
it has 4 columns, like id, name, lastName, city. and worker wants to change the city names for the customers, whose id are 4 and 5. But after worker changes the city name for the 5th customer and presses enter, selected row is now the 6th customer. i want to ask, when i use selectedRow like the upper code, can this code cathch the changes in 4th and 5th row, despite the pointer shows 6th row?