But it looks like Panorama X cannot look up data from file with no windows open. Is that correct?
No. You may open a database as secret and then look up data from it. Windows not required.
Well, I have a file that opens another file in secret, and then looks up data in text display objects. If the data sheet of the secret file is open, it works, otherwise, no dice!
I cannot explain what you are seeing, but I do it all the time and have been doing so for two years in PanX.
Could it be that PanX databases save their window configuration when last saved and visible through times of being open as “secret,” ie the file being open but opening any windows suppressed. IIRC lookups on visible databases don’t work when the only open window is a procedure one; either the datasheet or a form needs to be open. So if a now secret file was last saved when only procedure windows were open perhaps it can’t be looked up.
It looks like what I am seeing is an error message if there is no match found, which differs from Panorama 6.
In Panorama X, the default parameter is optional. If there is no parameter, and no match is found, you get the error message. If there is a default parameter, it should simply return the default value, when no match is found.
In Panorama 6, commands could have optional parameters, but functions could not.
Okay, I have gotten past that glitch. It is disconcerting to see an error message, particularly one that could cause one to think that there is a different problem, for something that has worked for a long time, 25 years or so. There is still a lot more to do with this set of files. The user interface is usually in the file that calls the lookup, and the other is just a data sheet. It has been that hitting the close button in the second file would save it and make it secret, instead of actually closing the file. Since old habits are hard to break, I am going to have to make an entirely new interface for the second file in the first file, which I suspect will be a lot of work.
At least I have a lot more screen real estate since I made these files. I think they date back to my original Powerbook 140.
If you are using a lookup( function that has been unmodified from Panorama 6, it will work the same way. Panorama 6 required six parameters in the lookup(. In Panorama X, only 4 parameters are required, the last two are optional. You’ll only get the error message if you leave off the last 2 parameters, which would never work at all in Panorama 6 (it would cause a syntax error).
Well, it was a lookuplast, and the last two parameters are there in the Panorama 6 version. But they did not get transferred over to Panorama X.
At some point you edited this function and removed the parameters, even if you don’t remember doing that. If you take the Panorama 6 database and transfer it to Panorama X again, you’ll see that the parameters are still there. I just tested this to make double sure.
Panorama never modifies code or formulas in this way. To do that would require a super smart parsing/AI system that might be more complicated than all the rest of Panorama. I don’t think I’m smart enough to create such a system if I wanted to – you’re giving me too much credit to think that I could do that.
In testing this, however, I did find a difference between Panorama X and 6 in this area. If the database being looked up into isn’t open, Panorama X returns an error message saying that, instead of the default value. Maybe that is what is tripping you up.
Although this is a change, I think it is a significant improvement. Instead of silently failing and just returning the default value, the lookup( function is telling you what is going on. I think that is progress. If you do want to ignore the error, you can always use the
catcherror( function, like this:
I tend to use catcherror( a lot when using formulas in forms (not just lookups, but all sorts of formulas), since I don’t want the user to ever see any error message. The catcherror( function is one of my favorite new functions in Panorama X.
However, even if this is progress, it is a change. Perhaps I should reverse this and make it return the default value, like Panorama 6 did. What do you think?
- Return appropriate error message for lookup( error conditions like database not open, incorrect key field, etc.
- Simply return default value when these errors occur.
Note: I’m not promising to abide by the poll results, but I’ll take it into consideration.