Strange behaviour by the findnth statement

I have this database:

With the cursor in the position shown, I run this procedure:

findnth 4,A contains "123"
message A

I get the message “12345” even though there is no fourth occurrence of the string. I double-click on the empty cell and it displays:

I click elsewhere and the highlighted display disappears. I double-click again on the empty (?) cell and it now appears to contain the “12345” string. But find and findnth can’t find it. I repeat the test once or twice and Panorama crashes.

I think this might be a bug.


I should have tested it with exportline() contains "123". I did this and got the same results.


It looks like it might be two bugs. The first is that it doesn’t seem to have any way of communicating that there weren’t that many matches. The second is that ShowPage doesn’t appear to be highlighting the current record, when it has changed since the NoShow. Here is the code for FINDNTH.

local searchFormula,ordinal,n,ns
statusmessage boolstr(ns)
execute {find }+searchFormula
    stoploopif n=ordinal
    //growlmessage "next:"+str(n)
while info("found")
if ns=true()
    //showother «»,2

The 3rd time through the loop, the next command fails to find a match, so the active record just stays where it is, in the record that contained “12345”. That’s the record you are really looking at when you open the cell.

The findnth statement was written for use in the Find/Select dialog. The way this dialog uses it, it will never be called with a number that doesn’t exist in the database. Basically the Find/Select dialog has already done a pre-search and is just using findnth to jump to the actual record. So this wasn’t a problem for this application, and these problems were never discovered. I should probably add this to the issue tracker, but I think this would be a pretty low priority item to devote resources to fixing.