No duplicates button not activated

I have used Panorama since its inception. I held off switching from 6 to X as I found it more confusing and preferred 6. With Mac OS Catalina coming out soon and not compatible with 6, I hired a tech to convert all my files and macros to X and have started using it. I discovered that the "no duplicates’ button does not work and after searching the Forum, found this has been an issue for over a year. Unfortunately, one task I use Panorama for is invoicing clients. We are now finding that we are duplicate billing clients for submitted subcontractor invoices causing our clients to be concerned about our bookkeeping. I don’t write programs, but this seems not too complicated to fix and hope it is done before I have to find another data base. Also would like to see when a prompt box appears, you don’t need to grab the mouse and click on it which did not happen in Panorama 6. Cheers!

Checking for duplicates is not too complicated. What is complicated is integrating this with the field editor so that you have the option to cancel if there is a duplicate, that is what has held up implementing this.

In the meantime, here is a simple 3 line program that will display an alert if the current field contains a value that is duplicated elsewhere in the database. You don’t have the option of cancelling and going back to the previous value, but it will alert.

if linecount(lookupall("",info("fieldname"),«»,info("fieldname"),cr()))>1
    alertsheet "This is a duplicate value"
endif

You could use this in a standalone program, or you can put it in the code panel of a field so that it runs automatically when the field is edited. Doing that makes a feature that is similar to how Panorama 6 worked, but without the option to cancel and go back. You would have to manually re-edit the field.

I have tested this on text, numeric and date fields – it works on all types.

Back in January, Gary posted a procedure that brings back the Pan 6 behavior and lets you decide to keep a duplicate or to re-edit it.

modify:

if arraycontains(listchoices(info("fieldname"),¶,2),«»,¶) and «» ≠ ""
    alertcancelok "Warning: You are attempting to enter a duplicate value. Click Ok to add anyway, or Cancel to re-edit cell."
    if info("dialogtrigger") = "Cancel"
        «»=""
        editcell
    endif
endif

You can enter this complete procedure in the Code property of your field, or you create a new procedure “.NoDuplicates” and enter the following line only in the Code property of the field:

call ".NoDuplicates"