Findselectdialog not as expected

I have a procedure using findselectdialog in which the ultimate goal is to select a single record.

I call up the dialog for the «Title» field CONTAINS
I type in the Title (or part) I’m looking for and it returns all the records with that Title. Usually this is just one, but sometimes multiple records appear, as expected.

If I double click on the record I am looking for, that record is selected, but whatever previous records were selected remains visible in the database

How do I get just the single chosen record selected?

What you are describing is exactly how it is documented to work, and Panorama 6 worked this way as well. If you double click on a record in the dialog, it finds that record. If you want it to select, you have to press the Select button, or press the Enter key. See Find and Find Next on this help page.

Yes, that’s what is happening.

When I get the dialog asking “Clicked record is not selected, select it?” I thought it was selecting that individual record, not just adding it to the selected records.

What I was asking is if there is a way to click a single record among those displayed in the dialog and have that single record selected and returned? Or is my only option to do a SearchWithin for a unique value in that record?

I am sure there are many ways to accomplish this. If I were doing it, I would not use the Find/Select Dialog. I would have the procedure prompt the user for the search term, make the selection, then test for an empty selection and test for more than one selected. If more than one is selected, then display a form showing the records in a text list. Clicking the desired row in text list would then perform a search to select the one that was clicked.

Trying double-clicking on your desired line in the dialog’s list. It might come close enough for your needs.

No, I need one record - it’s for an error check. Was hoping there was a built-in way to do it without doing what CooperT suggested.
Something like an Option-Click to do this may be a nice addition to a future version of PanX.

You can add some additional code to your findselectdialog statement to do the job. Definitely a hack but it seems to work. If the control key is held down when you double click the item in the find/select dialog or press any of the buttons, this will go back to the dialog library file and get the value returned by the liveSelectChoice variable which will still have the contents of the record that was selected in the dialog. At the very end of that value is the server record id which can then be used to select only that record.

let theRecord=0
findselectdialog 
if info("modifiers") contains "control"
    setactivedatabase "_FindSelectLib"
    theRecord=val(arraylast(liveSelectChoice,tab()))
    setactivedatabase ""
    select info("serverrecordid")=val(theRecord)
endif

If you click the Select button in the dialog it will go back to your data sheet and simple select the record you had selected in the dialog. If you double click the record in the dialog and it is not currently selected in the data sheet it will ask if you want to add it. Regardless, it will simply select only that record. This will treat everything as a Select including the Find and the Cancel buttons if the control key is held down. As I said it is a hack.

1 Like

Seems to do the trick. Thanks