Newbies Jim Johnson Posted April 13, 2019 Newbies Posted April 13, 2019 I've been using FileMaker Pro for some time now, but some move advanced concepts are a bit foreign to me. I'm pulling apart the FMSP more for academic purposes at the moment, and I'm looking to start purchasing some training in the near future. One thing that is a bit confusing to me is the id_constant field that seems to appear all over the solution. I'm not certain what purpose it serves.
bcooney Posted April 13, 2019 Posted April 13, 2019 It’s a utility field often used to filter a relationship.
Newbies Jim Johnson Posted April 13, 2019 Author Newbies Posted April 13, 2019 I sort of get why it's used, but what puzzles me is how it functions in certain situations. For example, when linking a contact with an account, it is what is responsible for the calculation to add the coloring and underline to the "Company" label. The field is a calculation with a "1" in it . . . I've walked through the linking process and can't find a single reference to how this field is set to empty . . . I also understand that this solution is provided for free and that a question such as this might be better received if I'm a paying customer of the training, but, I'm from the camp of "If you never ask, you'll never know the answer", so I thought I'd give it a go!!!
OlgerDiekstra Posted April 14, 2019 Posted April 14, 2019 The id_constant field is never anything but 1. Hence it's called 'constant'. It's used to create a relationship with another table. In the case of this id_constant field, the relationship would link every record where the field in the other table has the value 1. Which field that is depends on the schema. But, as a simple example, it could be used to return all invoices that have the field 'boolean_completed' (if there were such a field) set to true (which is 1). Or return all invoices where the field 'boolean_error' (again, if there were such a field) is true. That would allow you to quickly review all invoices with an error.
bcooney Posted April 14, 2019 Posted April 14, 2019 I dug up an old copy of FMSP I had on my Mac. So, what they're doing here is checking to see if this Contact has a related company. They needed to "ping" a field that they know is there if there is a valid relationship. Typically, I'd check for the related record's primary key since that field is certainly one that you can count on. Not sure why they didn't simply check for not isempty ( Account_Name).
Jonathan Hogle Posted May 30, 2019 Posted May 30, 2019 Jim Johnson, We use "id_Constant" as a static field that always has a value of "1". This is useful for a variety of reasons, but we typically use it for the following two reasons: 1.) We use that field to relate everything to the "Preference" table. Every record, no matter where you are in the solution, is related to the preference record because of this field. That way we can check different things without having to set variables, or go back to the record every time. A good example of this is the logo on the top right of the screen. That image is in a field in the "Preferences" table, so if we ever need to change it, we can update it in the filed in "Preferences" and it updates across the entire system! It's super handy! 2.) We also use "Id_Constant" to check if a record exists in the solution or not. Because it is always set to "1" if a check ever results in anything else, we no that there is no record on the other end. That's why we use it for the conditional formatting of the label you mentioned. Thanks, Jonathan Hogle
Recommended Posts
This topic is 2015 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now