• Introducing Dark Mode! Switch by clicking on the lightbulb icon next to Search or by clicking on Default style at the bottom left of the page!

How to detect if a row in a grid has been modified?

Andrew2009

Well Known Member
I have a grid in a headlerless detail form. I let users modify data right in the grid itself instead of having a detail screen for editing.

How do I know if users modify a row so when they click on the OK button up on top then I only loop through the grid and update the updated records only?

So if a grid has 10 records and they updated 2 records. Once they click on the OK button, I only need to update 2 records instead of 10.

Thanks
JDE 9.2
 

johndanter

Legendary Poster
2 ways

1) If they use a Row Exit to do the update, make them slect the records then do this:
Get Next Selected Row(FC Grid, <Before First Row>, evt_iLineOut_INT01)
While evt_iLineOut_INT01 is greater than evt_iLineIn_INT01
Get Grid Row(FC Grid, evt_iLineOut_INT01)
// do something with the GC
evt_iLineIn_INT01 = evt_iLineOut_INT01
Get Next Selected Row(FC Grid, evt_iLineIn_INT01, evt_iLineOut_INT01)
End While

2) Set a grid level flag in grid event Row Exited and Changed Asynch (set it to 1)
clear the grid each time you write a new grid row or if they click find

When they click OK or your button etc, just loop through and check that flag is '1' then do your stuff

Depending on the form you may want to disable all the events that normally do the DB update

But I think the Update Grid Rec to DB-Before kind of does what you want anyway. E1 knows which grid records have been changed behind the scenes
 
Top