Procedure errors when called from Code but not from Action menu

Should there be a situation where a procedure might error when called from the Code panel in a field, but not error if called from the Action menu (while in that same field that would error when called from the Code panel)?

The error is “(current field value here) is not a valid integer value.” If I trigger the procedure from the Code tab in an Integer field, there is no error. If I trigger it from any non-integer field, the error occurs. If I trigger it from the Action menu, I can do it from any field without any error.

is not a valid integer value

There’s no procedure error being displayed at all. Your procedure isn’t even running - Panorama didn’t get that far.

You’ve attempted to enter the value “San Francisco” into an integer field. Of course that’s not allowed. So Panorama is asking you to correct this input before it proceeds. This message has nothing to do with any code you may have put in the Code panel - that code doesn’t run until you’ve provided valid input.

Your description must be backwards. This message can only appear if an integer field is active.

Robert sent me his database, so now I have the specifics needed to answer the original question.

Yes, absolutely. When a procedure is triggered from the Action menu, Panorama is “at rest”. It’s not in the middle of doing anything, and is ready for any task.

When a procedure is triggered by data entry, Panorama is already in the middle of a task - finishing up data entry. It is not “at rest”, and you can only perform a limited set of actions without interfering with Panorama’s ability to complete the data entry operation. In particular you cannot

  • switch to another field
  • switch to another record

The second restriction, not switching to another record, also means that you cannot search, select, sort, fill, etc.

Basically any code triggered by data entry needs to leave Panorama in the spot it finds it in. It can change variables and other fields in the same record, but that’s about it.

The procedure that Robert is using breaks all of these rules. It jumps around from field to field, does selections, sequences, fills and finds. In the middle of that Panorama tries to finish up the data entry operation and becomes completely confused.

Bottom line Robert, your procedure cannot be triggered from data entry. Simply not possible, it has to be triggered separately.

Ok. But if the programmer wants to be lazy or just really, really, really wants the procedure to work after doing the data entry, they can use the Wait command. (This does work in limited testing.) I appreciate your reminding us of the limitations of that Code field.

It is unfortunate that Panorama can not finish the data entry, and then trigger the Code pane. It should know when the data entry work has completed, and then know it is ready and fully able to implement any other procedure next in the desired work flow. Essentially doing what I found I could accomplish by using the Wait command.

The wait command will probably work if you terminate data entry by pressing the Return key, but definitely will not work if you press the Tab key. That’s why I didn’t mention it.

Ok. There is that. :wink:

I guess we’ll wait till Panorama learns to do the multitasking by serially sequencing the Code after it has completed the data entry work (and mandating a pause in cursor/field movement, etc. until a procedure has completed.)

Have a safe Memorial Day weekend my friends.