Recent

Author Topic: inserting new record while dataset is filtered  (Read 2213 times)

kito

  • New Member
  • *
  • Posts: 37
inserting new record while dataset is filtered
« on: August 01, 2021, 12:31:27 am »


Hello

here is the thing :
employees dataset filtered by a selectable department name and displayed in  dbgrid
I am trying to insert than edit  the  new record directly on the dbgrid (filter is ON) it ends
usually by corrupting the database .  :(
and no wonder because the department field is null, so I decided to set the department Value once the record is inserted to avoid the mess .


my question is: how bad is applying this method?  what do you recommend in similar situations where the client demand that inserting data must be in the dbgrid while the list is limited to employees in the same department!

mangakissa

  • Hero Member
  • *****
  • Posts: 1119
Re: inserting new record while dataset is filtered
« Reply #1 on: August 02, 2021, 11:40:09 am »
It's the only possible way. Because the dataset is filtered you know the value of the department. So filling the field before the record is saved is normal.
Lazarus 2.06 (64b) / FPC 3.0.4 / Windows 10
stucked on Delphi 10.3.1

kito

  • New Member
  • *
  • Posts: 37
Re: inserting new record while dataset is filtered
« Reply #2 on: August 02, 2021, 05:08:25 pm »
It's the only possible way. Because the dataset is filtered you know the value of the department. So filling the field before the record is saved is normal.
I thought that I was the owner of the invention  :D  :D  :D  , yet it is nice to be on the right path despite its difficulty. Thank you very much for your time in reading and responding to the topic.

 

TinyPortal © 2005-2018