Set filter for deleted in MariaSql (SOLVED)

Set filter for deleted in MariaSql (SOLVED)

Postby Marc Venken » Tue May 30, 2017 9:03 pm

Hello,

How can I show the deleted records in Ors ?

Code: Select all  Expand view
  FWCONNECT oCn HOST cServer USER cUser PASSWORD cPassword DATABASE cDatabase

   if oCn == nil
     ? "Failed to connect"
     return nil
   endif

   oRs   := oCn:RowSet( "SELECT * FROM ploegen" )
 


This set a filter correct
ACTION (oRs:SetFilter( "ploeg2017 = ?", { ::cCaption } )

But I also want a button that shows de deleted records? I have SET DELETED ON on top of the program.
Last edited by Marc Venken on Wed May 31, 2017 8:40 pm, edited 1 time in total.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Set filter for deleted in MariaSql

Postby Marc Venken » Tue May 30, 2017 9:20 pm

Oeps,

I just notised that when you delete a record in Xbrowse and MariaSql, the record is totaly deleted !! So it can't be shown again with a Filter.

Do I have to proceed a other way than ?

I want to deleted the records from the Browse so that they don't show up, but also that I can get them back for some actions.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Set filter for deleted in MariaSql

Postby Adolfo » Tue May 30, 2017 9:27 pm

First, this was the behaviour of DBF's when you mark a record for deletion, now you hace to use a field for this kind of filter or whatever, lets say a "ACTIVE" field, so you can Activate it or Deactivated as will. So when you "delete it " from xbrowse you just change "ACTIVE" to .F., and all the way around when you wanted it back.

My 2 cents.

From Chile
Adolfo
;-) Ji,ji,ji... buena la cosa... "all you need is code"

http://www.xdata.cl - Desarrollo Inteligente
----------
Asus TUF F15, 32GB Ram, 2 * 1 TB NVME M.2, GTX 1650
User avatar
Adolfo
 
Posts: 860
Joined: Tue Oct 11, 2005 11:57 am
Location: Chile

Re: Set filter for deleted in MariaSql

Postby Marc Venken » Tue May 30, 2017 10:07 pm

Yes, I realise now that it has to be done like that.

A extra field for the deleted record set to on and off.

Thanks.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Set filter for deleted in MariaSql

Postby nageswaragunupudi » Wed May 31, 2017 10:30 am

In ALL the databases in the World, except DBF, once a record is deleted it is gone.
More than 99.9% of the programmers in the world do not know DBF.
We need to start thinking like them.
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Set filter for deleted in MariaSql

Postby Marc Venken » Wed May 31, 2017 10:46 am

I Agree.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Set filter for deleted in MariaSql

Postby Maurizio » Wed May 31, 2017 12:32 pm

You cann use TRIGGER before delete ( or update ) , and popolate a table .

Maurizio
User avatar
Maurizio
 
Posts: 824
Joined: Mon Oct 10, 2005 1:29 pm

Re: Set filter for deleted in MariaSql

Postby nageswaragunupudi » Wed May 31, 2017 12:36 pm

Maurizio wrote:You cann use TRIGGER before delete ( or update ) , and popolate a table .

Maurizio

This is what we do generally for highly secure software. For every deletion and also modification we create log files with userid, programid and datetime stamp
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Set filter for deleted in MariaSql

Postby Marc Venken » Wed May 31, 2017 3:30 pm

I did some lookups.

A trigger is a SQL command that will do a append in a file if there is a delete in a other file.

But in my specific case, (the old dbf way) I wanted to not show deleted items or show them.
I best make a fieldname with deleted, BIT 1 and than trie to make a sql filter to show or not show this.

ACTION (oRs:SetFilter( "ploeg2017 = ?", { ::cCaption } )

But than for a fieldname deleted = .t. or delted = .f. (How in SQL)

Thanks.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: Set filter for deleted in MariaSql

Postby nageswaragunupudi » Wed May 31, 2017 3:35 pm

Add a new field
Code: Select all  Expand view

oCn:AddColumn( tablename, { "DELETED", "L', 1, 0 } )


Then use this
Code: Select all  Expand view

ACTION (oRs:SetFilter( "ploeg2017 = ? .AND. deleted = ?", { ::cCaption, .f. } )
 
Regards

G. N. Rao.
Hyderabad, India
User avatar
nageswaragunupudi
 
Posts: 10632
Joined: Sun Nov 19, 2006 5:22 am
Location: India

Re: Set filter for deleted in MariaSql

Postby Marc Venken » Wed May 31, 2017 7:05 pm

Thank you.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1431
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 109 guests