Unique id for relationships

I need to create unique ids for records in databases that I want to make part of a larger relational database. I thought I found the answer the replies to the “Setting up relational database” post. See screenshot. However, the formula did not work. I got the same result to the formula no matter which record I was on.

Also, I read in the function description that while the id is guaranteed to be unique, that does not mean is is unchangeable. If that is true, it would not be helpful in this application to database relationships.

I don’t need this value now as I have unique ids from my imported FileMaker database. However, as I was trained, it is always good practice to create unique record ids, as well as creation and modification dates and users, in case one wants to make their database relate to others, and to have the needed security fields for multiuser environments.

Check out the Help file under “Field Properties”:

Look just past half way down for the section entitled “Creating a Unique Record Number”.

Thanks. My only issue with “Creating a Unique Record Number” is that it seems to only work for new records. I cannot find a way to create the unique id for existing records.

I did get the unique Id to work. What I have shown in the screenshot is a text editor with a formula pasted into the data window under the custom attributes. The value did not change from one window to the next until I clicked on the field in data mode.

I resolved that by creating a number field on the data sheet and pasting the formula in field property window. Then got the data in by recalculating the field. It does crate a unique record number however it is of little use as a key value if it can be changed by PanoramaX.

So, I still would like to know how to create a unique, unchangeable id for both existing and new records.

You can populate a field with unique ID’s using the uniqueID( functiion. If you only want to use numbers you could use a numeric field using uniqueid(“ID”,"") or use a text field for more expanded ID’s that include a root extension with the date, the user’s name or some other designation. Here is some code to populate the ID field of the existing records with only a unique ID number:

until info("stopped")

You would then add a .NewRecord procedure to insert a new unique ID number for any new record manually added with this code:

if info("trigger")="New.Add"
elseif info("trigger")="New.Insert"

Note that I have used a field named ID but it could be any field you want to use for this. If you are adding records via a procedure, you will have to also run a uniqueid( for the ID field of the new record since the .NewRecord procedure will not be triggered in that situation.

Thank you – just what I need. I assume the “.” in front of .NewRecord is there to keep it out of the Action menu.

Coming from FileMaker, I have a lot to learn about Procedure and Formula writing in PanoramaX. Any recommendations about learning coding?

Partially true, but this is one of the automatic procedures that must be named exactly this way with the capitalization as shown and the leading period. There are others like .ModifyFill, .ModifyRecord, CurrentRecord etc. All are executed automatically when certain conditions are met and all must be precisely named.

Thanks for the clarification.

I tried to find more information about the automatic procedures. In the PanoramaX help, I could only find NewRecord in Implicitly Triggered Procedures. This topic mentions some of the others you mentioned but I can find nothing specific on the .NewRecord code or the others. Nor can I find much on how to write PanoramaX code.

Check the “blue pill” in the Panorama X Help Search field. It contains a popup menu with the chapters of the Panorama X Help, besides others “Tutorial” and “Programming”.

Admittedly the documentation on the automatic procedures is rather thin at the moment but most are self-evident by their titles. Panorama has a full, robust programming language that includes hundreds and hundreds of various functions and statement. The way I learned to program in Panorama years ago was to start small and experiment with a few simple tasks and then build from there. Panorama’s language was much smaller at that point but still an upward climb.

The Help file has example code for use with almost all the various functions and statements and also allows you to copy and paste anything close to what you need and then you can alter it as necessary. You can also record many actions and have the code generated for you. Many things however are not recordable so you will still need to write some code from scratch. The more you learn and experiment the more you can accomplish. There are many videos that will certainly help your understanding if want to go that route.

These were documented in the Panorama 6 documentation, but there was a delay in getting this material added to the Panorama X documentation. However, the official documentation for these special procedures was added in Panorama X 10.1.

In Panorama 6 and earlier, all procedures were listed in the Action menu unless they started with a period. Since you generally wouldn’t want these implicitly triggered procedures to appear in the Action menu, they were all given names that start with period. In Panorama X procedures with names starting with a period are still excluded from the Action menu, but you can also use the Exclude from Action Menu option in the property panel. However, all of the implicit trigger procedure names remain the same (starting with a period) to maintain compatibility with previous versions, and we will probably continue this convention for any new implicitly triggered procedures in the future.

If you go to the main Panorama Help page and scroll down, you’ll find an extensive listing of topics under the Programming section. This is probably the best place to start. Actually, you’ll probably want to look at the Formulas section as well. In each of these sections the topics are divided into two groups, with a space in between. The top section is the more basic, general material. If you read those 18 topics that will give you a good foundation.

If you prefer video training, there is a lot of material in the Panorama Intensive Training Course, which is available for purchase or rent. Here is information about that course.

It’s a considerable investment in time and money if you do the entire course, but many users have raved about it. Some of the sessions are free, and you can rent or buy individual sessions if you wish.

I have reviewed all the videos I could find that seemed to be related to coding. Fundamentals of Procedures, Formulas, Form Programing and Basic Automation were very helpful, as were some of the Panorama 6 to X videos.

To understand at the level I’m looking for, the most helpful was the Opening Remarks video. From that, if I am clear, I understand the Panorama is its own language based on Objective-C. While the New Procedure, Formula Workshop and Relational Workshop are excellent tools, I’m looking for deeper understanding of Panorama’s grammar and syntax and how one works with it.

Any direction to resources would be much appreciated.

Panorama X is written in Objective-C. But the grammar and syntax of Panorama code really doesn’t have anything to do with Objective-C. It’s not based on any particular language, though it started out somewhat similar to BASIC.

It sounds like this is the help page you are looking for:

This help page deals with the grammar and syntax of formulas, which is important because almost every program will have formulas embedded into it.

Both of these help pages are listed on the main table of contents under the automation section.

There are a number of other pages listed there that you will find helpful.

Thanks for the suggestions; they are very helpful. I’ll be tackling working with the Script Editor soon.

I thought I recognized something about the language. It must be the similarity to BASIC. I had an introduction to that with my Apple IIe but gave it up, because fo time constraints, and used some of the available applications.

Clarification: When I said “based on,” I meant it in the sense of “written in” – my bad:)

There is a great deal of very useful information available in the old Panorama 6.0 documentation - I use it frequently (largely due to a dearth of neurons) and I usually start with the Formulas & Programming.pdf document. Much of it is still quite relevant.

There are a few topics that are in the Panorama 6 documentation that aren’t covered in the Panorama X documentation yet, but that is a lot of material to slog through for someone new to Panorama to sift through, and for a fairly small amount of unique content, at most probably a couple dozen pages out of thousands. But for anyone that is interested, you can find the old documentation at this link.

Panorama Classic Frequently Asked Questions

Thanks for the information. However, when I went to the above page to download the documents, only three of them are available. See screenshot. My supposition is that there is no relevant info in the others or the link is broken.

Sorry about that. All of the links should be fixed now, you should be able to download all nine of these PDF files.

Thanks. The Formulas and Programing are especially helpful.

Thanks - Jim Weber