[MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

classic Classic list List threaded Threaded
13 messages Options
Reply | Threaded
Open this post in threaded view
|

[MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
Hi All,

Does anyone know how to keep showing deleted records  in a dbgrid?   

Regards.

Med


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
When I  confirm the deletion of a grid.row this one disappears. I expect status usDeleted, but the status of the dataset returned usUnmodified.

procedure tfrmBasePagefo.upDateRowData(const sender: tcustomgrid;
                                       const arow: Integer; const adataset: TDataSet);
begin
  case adataset.updatestatus of
    usInserted:sender.rowcolorstate[arow]:= 0;
    usModified:sender.rowcolorstate[arow]:= 1;
    usDeleted: sender.rowcolorstate[arow]:= 2;      <------ no break here when I delete record ?
    else
      sender.rowcolorstate[arow]:= 255;
  end;
end;





De : mohamed hamza <[hidden email]>
Envoyé : mardi 24 septembre 2019 21:05
À : General list for MSEide+MSEgui <[hidden email]>
Objet : [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Hi All,

Does anyone know how to keep showing deleted records  in a dbgrid?   

Regards.

Med


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Hello Med.

>     usDeleted: sender.rowcolorstate[arow]:= 2;      <------ no break here
> when I delete record ?

What fpc version are you using?
Do you have problems with fpc 3.0.2 / 3.0.4 too ?

After a quick investigation, "usDeleted" is defined in
/mseide-msegui/lib/common/fpccompatibility/mdb.pas

So, if it appends with fpc > 3.0.4, this must be related with the new
fpc-inventions.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Re-hello Med.

Like explained earlier, I did not jump into mse-db yet.

But if you add, in attachment,  a simple example of what you want to show,
it would be much easier for me to investigate.

Fe;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
Hello Fred,

  There is some code concerned in msebufdataset also. 

 Try to test my prj
 
 Ex:
  Insert  applyUpdate then 
  edit    applyUpdate    
  delete to see the result.
 
  You can also use cancelupdate,  the project is  attached.

Thank you for trying to help 

Med.

NB:There are some comments in main source.

De : fredvs <[hidden email]>
Envoyé : jeudi 26 septembre 2019 12:15
À : [hidden email] <[hidden email]>
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Re-hello Med.

Like explained earlier, I did not jump into mse-db yet.

But if you add, in attachment,  a simple example of what you want to show,
it would be much easier for me to investigate.

Fe;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk



_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk

mseskin.rar (11K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Hello Med.

>  Try to test my prj

OK, I did it.

Hum, indeed, with your wishes, there should be a option in the navigator to
only "mark as deleted" a row in the db-grid.
(and not delete the row completely).

But because Martin did add "updatestatus =  usDeleted", sure there must be a
trick to no delete the row in the grid but only mark it as "on the way to
delete".

And only if "tlocaldataset1.ApplyUpdates" is called, then the row may be
deleted.

Re-hum, I am totally new in mse-db, I will jump deeper into it asap.

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
Hello,

   I think to: 
   Add a calculated field  to the dataset ( bdel)
   Abort the deletion in  afterdelete event of dataset  
   Set bDel  field to true.
  
   But how to set status to uDeleted ?

    What do you think ?

    Med.


    
Envoyé : jeudi 26 septembre 2019 22:43
À : [hidden email] <[hidden email]>
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
Error : abort  delet  in beforeDelete event  

De : mohamed hamza <[hidden email]>
Envoyé : vendredi 27 septembre 2019 13:18
À : General list for MSEide+MSEgui <[hidden email]>
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Hello,

   I think to: 
   Add a calculated field  to the dataset ( bdel)
   Abort the deletion in  afterdelete event of dataset  
   Set bDel  field to true.
  
   But how to set status to uDeleted ?

    What do you think ?

    Med.


    
Envoyé : jeudi 26 septembre 2019 22:43
À : [hidden email] <[hidden email]>
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Re-hello Med.

It seems that it is a common problem with lot of databases:

https://forum.lazarus.freepascal.org/index.php?topic=25153.0

https://stackoverflow.com/questions/7671205/statusfilter-on-clientdataset


Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
In reply to this post by mohamed hamza
Hello Med.

> Add a calculated field  to the dataset ( bdel)
 >  Abort the deletion in  afterdelete event of dataset  
 >   Set bDel  field to true.

Huh, it is exactly what I was thinking.
If you have access the dataset and may add a new column/boolean:  "Mark as
deleted", this will be the best.
And before dataset.ApplyUpdates" is called, first delete all the rows that
have "Mark as deleted" = true.

But if you are not allowed to add a new column in dataset, I do not see how
to do.

>   But how to set status to uDeleted ?

IMHO, adataset.updatestatus (usInserted,  usModified or usDeleted) is
read-only.
You may not change it manually.
(But maybe I am wrong, I did not check it).

> Error : abort  delet  in beforeDelete event  

Sorry, I dont understand, please explain better.

Fre;D




--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Re-hello Med.

>> Error : abort  delet  in beforeDelete event  
> Sorry, I dont understand, please explain better.

Ha, ok, I think I understood.
With the trick to add a "Mark as deleted" field, you should NOT use the
"Del" button of the mse-db-navigator.

You should create a custom "Del" button that only will set ""Mark as
deleted" to true for the row selected.

And use adataset.delete for all the rows with Mark as deleted" = true, just
before calling dataset.ApplyUpdates.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

mohamed hamza
We can find many tricks to solve the problem.  Looking for an universal way and integrate it   in msegui lib is better if we want to give a more to martin's project.

Martin's project is not only MseLang but also this great RAD is'nt it ?

Med.

De : fredvs <[hidden email]>
Envoyé : vendredi 27 septembre 2019 20:02
À : [hidden email] <[hidden email]>
Objet : Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery
 
Re-hello Med.

>> Error : abort  delet  in beforeDelete event  
> Sorry, I dont understand, please explain better.

Ha, ok, I think I understood.
With the trick to add a "Mark as deleted" field, you should NOT use the
"Del" button of the mse-db-navigator.

You should create a custom "Del" button that only will set ""Mark as
deleted" to true for the row selected.

And use adataset.delete for all the rows with Mark as deleted" = true, just
before calling dataset.ApplyUpdates.

Fre;D





--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk
Reply | Threaded
Open this post in threaded view
|

Re: [MSEide-MSEgui-talk] BufDataSet, tmsesqlquery

fredvs
Hello Med.

Of course you are more than welcome to contribute to make mse better.

And dont hesitate to have your own Github account!

Fre;D



--
Sent from: http://mseide-msegui-talk.13964.n8.nabble.com/


_______________________________________________
mseide-msegui-talk mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/mseide-msegui-talk