Scripting a field

Posted on 2006-06-01
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

    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

    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

    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

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    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…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor ( If you're interested in additional methods for monitoring bandwidt…

    730 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

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now