I have a database with customers, some I have marked inactive, but I would like to 'hide' them, I do not want to delete them. Suggestions?
Are you accessing your Customer's List via scripting? If so, you could just insert a FIND to OMIT those inactive records. Something like this:
Got To Layout [customer List]Enter Find Mode [ ]Set Field [inactive, 1] <--- or whatever value that marks them inactiveOmit RecordPerform Find [ ]
Sort Records [restore]
Hope this helps!
Don WielandDW Data Concepts
thanksbut...(sorry to be a pest) will i lose that customer, can I 'un-hide' them at a later date?Thanks again for your helpPatrick
On Thursday, March 14, 2019, 12:12:07 PM EDT, dwdata <firstname.lastname@example.org> wrote:
Re: I have a database with customers, some i have marked inactive, but I would like to 'hide' them, I do not want to delete them. Suggestions?
reply from dwdata in Discussions - View the full discussion
Got To Layout
Enter Find Mode
Set Field <--- or whatever value that marks them inactive
DW Data Concepts
Reply to this message by replying to this email, or go to the message on FileMaker Community
Start a new discussion in Discussions by email or at FileMaker Community
Following Re: I have a database with customers, some i have marked inactive, but I would like to 'hide' them, I do not want to delete them. Suggestions? in these streams: Inbox
Learn more about the Workplace Innovation Platform • https://www.filemaker.com/workplace-innovation/
Yes! You can simply do a Show All Records or if you want to have a script to find INACTIVE that is similar to my example but your would remove the OMIT script step.
Duplicate the Customers table.
Rename as "CustomersArchive".
Back in "Customers" do a FIND for inactive.
Go to "CustomersArchive" and import from "Customers".
Capture this into a script "Import Records" step.
Back in "Customers" you can now delete your inactive.
Then you can wire up a script to find inactives, import to archive and delete from Main table.
Likely would not hurt to build a reverse script to return a Customer when they become active again.
I have put a global check box on the layout 'Show Inactive'. Attach a script trigger OnObjectModify:
When the box is checked, show all, sort.
When the box is unchecked, do the find as mentioned above.
You can also use constrain and extend if you are working with or don't want to disturb your found set.
Part of a larger script...
Set Variable[$Status; Value: Case(not IsEmpty (CUSTOMERS::gFilter_List View_Status);1)]
Enter Find Mode [ ]
If [ isempty( $Status ) //Hide InActive
Set Field [CUSTOMERS::Status; 1]
Perform Find [ ]
I hide records instead of deleting them by multiplying their primary / foreign key with -1 or by adding a Z at the beginning of the UUID.
Using dwdata's script suggestion as a model, here is a simple demo file illustrating this idea further.
Instead of an inactive field however, I created a simple checkbox field simply named 'active' with an auto-enter default value of 1 so that all contacts default to having an active status.
The reason I choose to use a boolean checkbox (ie only 0 or 1 values) rather than a string like "inactive" is because it becomes much easier to consistently search against and is generally considered a best practice for simple true/ false evaluations across multiple platforms. Also, if you ever decide to change your field name you don't have to worry about multiple searches or trying to retroactively update existing data to use the new label.
Then a simple search script triggered via an onLayoutEnter script trigger (or button) that defaults to ONLY showing users the active contacts (and thus hiding) all of the inactive ones.
Hopefully, you can find it of use. As always please let me know if I can help with anything else.
Web & FM Developer
Codence | www.codence.com
I use a very simple 6 line script in my dB for this, using a 0-1 Count Marker Field and a Summary Field:-
Sort (Marker Field:- 0 or 1)
Omit Multiple (Total of Summarry Field)
Sort ( As req)
Retrieving data ...