In lieu of "onEvent" handlers


#1

i am learning/evaluating Panorama X as a replacement for a complex relational database application in Filemaker.

Is there, in Panorama X, an equivalent of an “onAddEvent” that is triggered when a new record is added to the dataset and can execute a procedure that is attached to that event. (In other languages there are numerous onEvent handlers such as onFieldEnter, onFieldExit, onMouseDown, onMouseUp and so forth).

My need is to populate the primary key (with the GUID that I was shown last week) and enter a fully functional timestamp (YYYY-MM-DD HH:MM:SS) in both a createdTimeStamp field and modifiedTimeStamp field. The modified TimeStamp field is subsequently updated with an onRecordChangeEvent.

The code in the Automatic Field Code (I have tried Formula and/or Code) and neither seems to be triggered until something is entered into the field.

Just clicking the “Add” button on the Tool bar apparently does not trigger or run this code.

However, when I write a procedure that starts with addrecord and then populates these fields with the GUID function and timestamp, a new record is added with fields populated as expected. For testing purposes, I have this function connected to a pushbutton on a form.

So how/where can I call this procedure to add a new record when, for example, a whole new set of .csv records are imported and each record needs these primary keys and timestamps immediately applied?

It would be very helpful to have a tutorial or data exchange example of a simple relational database example that has full CRUD capability for both the parent records and the child records. Or perhaps this is true database capability that Panorama X is not an ideal solution for and I should be sticking with FileMaker and/or MS Access.

Thank you for any advice.


#2

Their is a whole family of procedures, generally known as ‘triggers’ which run in response to particular events, including adding a record. The one you want is .NewRecord. Create a procedure with this name and enter whatever code you want run when you add a record (it will respond to the ‘Add’ icon in the toolbar and when you press the RETURN key). The quirk is that no new record is actually added unless you specifically include an addrecord statement in the procedure. This allows you to forestall the addition if the procedure determines that you don’t want one. You could also check out ‘303: Data Entry Helpers’ in the Help wizard where you will see how to establish default values for fields.

The Panorama X Help wizard is deficient in its documentation of all of these procedures for the time being. On the other hand, the old Panorama 6 documentation is pretty good.

You can download the relevant Panorama 6 PDF document from here and see the entire collection:

I’m sure they will at least match FileMaker’s offering and Panorama X has the advantage that if what you want doesn’t exist, somebody will probably be able to write one for you.


#3

Is there a list of hidden triggers that work in PanX? I just tried to use .CloseWindow but it is not triggered when I click the red button in the Toolbar.


#4

Last time I checked I found these automatic procedures to be implemented:

  • .CustomMenu
  • .Initialize
  • .ModifyFill
  • .ModifyRecord
  • .NewRecord
  • .CurrentRecord
  • .DeleteRecord

None of the handler procedures (those starting with a double dot like ..ActivateForm) are implemented as far as I know. However, both ..ActivateForm and ..OpenForm can be replaced by using the info("formevent") function in the Form Event Procedure of the Form Properties pane.


#5

Thanks. Tom


#6

Thank you.
I found Panorama X on 29 December 2017 and have been pretty well immersed in it for these three weeks. My only exposure to Panorama 6 was the references in the training videos, but I had no idea of the depth and scope of that edition. The Formulas and Programming pdf is an eye-opener. I can see there are a lot of advances in Panorama X but I now wonder if/when it will also catch up with Panorama 6 with things like all of the Wizards and like, and have the documentation resources like the above.