Existing Field "Does not exist" randomly

I have an issue looking up fields in one database from another that is randomly, but mostly broken. Seems similar to staylor’s issue from Nov '16. Have spent many hours on it - something that worked flawlessly in Pan 6 for over 20 years.

If I click on the Calendar DB matrix, it figures out the date and time -> VisitDate and TimeSlot. It then goes to the Transaction DB in a secret window to see if that visit slot has been invoiced before to decide if it edits the existing or creates a new invoice. I carefully switch to Trans DB and try Select «24AVisitDate» or the full phrase: “Find «24AvisitDate»=VisitDate AND ApptTime=(TimeSlot-1)*900+lv1”

I get the error message “that field does not exist” - almost any version or statement to find info from that DB stops and doesn’t execute.

Testing a simple macro to look up those fields and couple other up/down record and display them in a message is erratic. If I open up the calendar, then open Transactions from secret to visible, this will execute the first message then stop, reliably. If I click on the calendar window and back to transactions, it will execute both messages once or twice then lock up after the first message statement. Once locked up, it will only return the first message.

Here is some more stable behavior

When called from the Calendar DB via FarCall this stops after the first message:
window “Mac DO Trans:Secret”
firstrecord
Message «24AVisitDate»
DownRecord
message «T2PtName»

But this one will work correctly repeatedly:
window “Mac DO Trans:Secret”
firstrecord
Message «24AVisitDate»
SetActiveDatabase “Mac DO Trans”
DownRecord
message «T2PtName»

Placing an info(“databasename”) statement after each step reveals that the active database switches from “Mac DO Trans” to Mac DO Cal" after the Message «24AVisitDate» statement and again after the message «T2PtName» statement.

It also reveals that the FarCall statement does not work with the fields and info in the DB where the FarCall procedure resides. Without making the "DB:Secret " immediately, it won’t work at all. I don’t believe this is the way the documentation says and not the way Pan 6 has worked.

If I get my test info from the Visitdate and ApptTime via lookups, it works perfectly: find lookup(“Mac DO Trans”,«26PtID»,CurrentPt,«24AVisitDate»)=VisitDate AND lookup(“Mac DO Trans”,«26PtID»,CurrentPt,«ApptTime»)=(TimeSlot-1)*900+lv1

I can do this from the Calendar DB or from within the Transaction DB looking up fields in itself.

I have noticed that my farcalls and secret window procedures sometimes seem to revert back to the calling or frontmost database after random commands, but haven’t been able to track it down as carefully as this.

Any ideas on what is going wrong?

Sorry for the long post, but this is critical - I grab data from different lookup databases to process regularly.

Scott

I just duplicated this with two new, empty DB’s. One has one form and button to do the farcall and one has two fields, three records, and one procedure:

this doesn’t work:
message Name
message IDNum

This works half way:
setactivedatabase “TestTrans”
message Name
message IDNum

And this one works all the way, repeatedly:
setactivedatabase “TestTrans”
message Name
setactivedatabase “TestTrans”
message IDNum

This also works fine called from the initiating button or in the procedure at the FarCall DB:
message lookup(“TestTrans”,«IDNum»,“003”,«Name»)
message lookup(“TestTrans”,«Name»,“Mary”,«IDNum»)

I have to remind the procedure at each step to go back to the correct database. To me this means the problem doesn’t come from prior steps or conflicting variable/field names in my large and complex database set. As I said before, it seems like some different commands do the same thing, but I can’t say for sure which right now. It stops the procedure cold when that happens.

Thanks in advance for any insight - Scott

First thing to mention is that farcall does not make the database containing the procedure active - the calling database remains active. If you need to make the other database active you need to use the setactivedatabase statement to activate it as you have done. This basically creates a secret window for that database which will disappear as soon as another window becomes active as what happened when you pop up a message window. Now you have to reactivate the other database again to continue on since it’s secret window has gone bye-bye.

I think the documentation for farcall should note that a farcall does not automatically make that database active so you would have to activate it yourself in the procedure that is called.

Thanks, Gary. I think that will explain some of the problems I have. I could swear - and back it up with procedures that work this way - that in Pan 6 I changed to a secret window and then ran FarCall, which would run everything in the secret DB until I brought it back or the procedure had a RTN statement. That does not appear to be working the same way in my Pan X imported version.

The difference is that, in Panorama 6 and earlier, the resource based alert windows, like message statements, weren’t treated like other windows. Opening one of them, while running in a secret window, didn’t cause the secret window to “close.” Opening a form, or other database window would cause it to close, and the frontmost visible window would then be active.

Thanks, Dave. Helps to understand why it’s happening. I’ll have to keep an eye out for other dialogs that I pop up to ask if I’m sure I want to overwrite that info and things like that.