Scripting a field

Posted on 2006-06-01
Medium Priority
Last Modified: 2010-04-27
I would like to script a field to automatically count the number of layout pages in existence for a particular serial number.
I am familiar with writing scripts for buttons that could accomplish this but how do you script a FIELD to automatically do this?
I tried the Get(Count) and it just gives me the count of ALL the records for this layout.

Question by:nravida
LVL 19

Accepted Solution

billmercer earned 500 total points
ID: 16813235
You can't define a field to be the result of a script, that's not possible in FileMaker.

>I would like to script a field to automatically count the number of layout pages in existence
>for a particular serial number.

Not exactly sure what you mean by this. If your goal is just to calculate the number of records that have a certain value in a field, then you can use the count() function to do this, by referring to the field you want to count through a relationship. Create a relationship between a field containing the value you want to identify, and the field you want to count. This can be a self-join relationship based on a global field. This is a standard technique for counting records which meet certain criteria.

If you're talking about counting printed pages in a report, you'll definitely need to use a script for that, as there's no way to do this with a calculated field. What you can do is create a script that counts the pages and stores that value in a field, and then use a third-party plugin to execute your script whenever some calculation is evaluated. This might be helpful in your situation. Here's a plugin you can try...

With FileMaker Advanced, there's also the option to define Custom Functions. These will allow you to do a limited form of "programming" in a field definition by using logical functions and recursion. It's quite powerful, however it's restricted to working with fields and values. It cannot interact with the user interface in any way, so it may not be helpful if you're trying to count pages.


LVL 28

Expert Comment

ID: 16814096
I think he means to count printed pages for a given found set.
the idea (2nd idea from Bill) is to search for the required found set of records, goto preview mode, goto last page, store the page number in a variable (there is a get function for this), then store it back in the field where you need it. no other way, and if that is 500 pages, I would not use the event plug-in to calculate it automatically because its gonna be slow, I would do it on purpose only.

Author Comment

ID: 16818692
OK, I guess I just wanted to make sure scripting a field was or was not a possibility.
Thanks for the other hints. I am almost finished with my database thanks to everyone's help :) and my boss is pretty happy with that.  

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Conversion Steps for merging and consolidating separate Filemaker files The following is a step-by-step guide for the process of consolidating two or more FileMaker files (version 7 and later) into a single file with multiple tables. Sometimes th…
Having just upgraded from Filemaker 11 to Filemaker 12 over the weekend, we thought we would add some tips for others making the same move.  In general, our installation went without incident. Please note that this is not a replacement for Chapter 5…
Integration Management Part 2
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question