navigate site menu

Start learning with our library of video tutorials taught by experts. Get started

FileMaker Pro 12 in Depth

FileMaker Pro 12 in Depth

with Cris Ippolite

 


Learn advanced FileMaker Pro development techniques to help you take your databases to the next level. In this course, author and FileMaker database expert Cris Ippolite walks you through how to secure your databases; share your databases on the web or network; and create intermediate scripts, calculations, and reports. The course also discusses using the Web Viewer to extend your databases, and more.
Topics include:
  • Managing access to your database
  • Parsing text with calculation functions
  • Using calculations in field validation and auto enter options
  • Creating nested subsummary and crosstab reports
  • Creating user-driven and multi-criteria relationships
  • Working with intermediate script techniques
  • Extending Web Viewer using HTML5 and data URLs
  • Sharing databases on a network using FileMaker Server
  • Publishing your databases to the web using the Instant Web Publishing or PHP

show more

author
Cris Ippolite
subject
Business, Databases
software
FileMaker Pro 12
level
Advanced
duration
7h 33m
released
Mar 19, 2013

Share this course

Ready to join? get started


Keep up with news, tips, and latest courses.

submit Course details submit clicked more info

Please wait...

Search the closed captioning text for this course by entering the keyword you’d like to search, or browse the closed captioning text by selecting the chapter name below and choosing the video title you’d like to review.



Introduction
Welcome
00:00(music playing)
00:04Hi! I'm Cris Ippolite and welcome to FileMaker Pro 12 In Depth.
00:08In previous FileMaker titles, we've talked about the fundamentals of building
00:11FileMaker databases.
00:13But now, I'm going to put-on my developer hat, and show how to control access to
00:17your databases, and how to share them with other users.
00:20We'll dig deeper into calculation functions and the various ways that you can
00:24use them throughout the FileMaker application.
00:26I'll show you how to build compelling and advanced reports, and we'll take a
00:30closer look at scripts and some of the key scripting techniques.
00:35I'm also excited to introduce you to some of the options for sharing your
00:38databases with other users either on the network, or by publishing your
00:41databases to the web.
00:43And now, without further delay, it's time for us to dive into FileMaker Pro 12 in depth.
Collapse this transcript
What you should know
00:00FileMaker 12 in depth builds off of fundamental skills that we've covered in
00:04FileMaker 12 Essential Training.
00:07If you're not comfortable with concepts like building calculations, scripts, or
00:10even relationships, please take a moment to go back, and watch the FileMaker 12
00:14Essential Training, or, even the Relational Design with FileMaker Pro titles.
00:20In this course, I cover several core tools and techniques that will help make
00:24your FileMaker databases more robust.
00:27I'll also cover sharing your databases on the network or web, so if you find
00:31that some of the early techniques are too familiar, stick with it to the second
00:34half where I discuss sharing options in depth.
00:37I also have several movies based on techniques that I've never shown anywhere before.
00:41So please take the time to check out each chapter even if some of the concepts
00:45are familiar to you.
Collapse this transcript
Using the exercise files
00:00If you are a premium member of the lynda.com online training library,
00:04you will have access to the exercise fles used throughout this title.
00:07The way that the exercise files are laid out is that they all come in one
00:11exercise files folder, broken down into each one of the chapters.
00:15And if you look inside each chapter, you'll see that there's a folder for each movie.
00:21So for example, if you want to watch the movie for 01_04, just go into the
00:2601 folder, and down to the 01_04 subfolder, and open this file.
00:31Each of the movies has its own dedicated FileMaker file, so you can start from
00:35any point in this title by just finding the correct folder, and opening the
00:38correct Exercise File.
Collapse this transcript
1. Managing Access to Your Database
Creating accounts
00:00Security is primary concern for both developers and end users of databases.
00:05It governs whether a person can open a given database and determines what
00:09functions and data are accessible to the user once they do open it.
00:12The topic of security is often overlooked though when you're developing in
00:15FileMaker because it's not just something that's there to limit access to
00:19the entire database;
00:20in fact, there are some very sophisticated ways to set up security within your
00:24database system that will allow you to limit access to certain functionality or
00:28maybe just to the whole file itself.
00:30However, you should be looking at setting up security as not only determining
00:34who can log in, but what they can do once they log in.
00:38So it's also a way to identify users for other tasks that are not related to
00:41restricting access, like taking them to certain layouts or showing them certain
00:44font sets and stuff like that.
00:46So think of security as identifying who your users are.
00:50Administrators of FileMaker Pro databases will work primarily with two security
00:54elements and both can be managed under the File>Manage>Security dialog and those
01:01two elements are Accounts and Privilege Sets.
01:03We're going to talk about Accounts in this movie and Privilege Sets later in this chapter.
01:07In the Manage Security dialog, you see you have a tab here for Accounts and
01:12you'll see your accounts in list view and it lists all the accounts that are
01:15already set up in your system.
01:16FileMaker recommends that the best practice is to establish a unique account for
01:20every individual user of the database.
01:23This practice is more secure than having multiple users just share one account
01:27and it also enforces the concept of identifying your users so that you can
01:31customize their user experience.
01:33User accounts will then be associated with one and only one of the Privilege Sets.
01:38We're going to talk about Privilege Sets here in an upcoming movie, but you'll
01:41notice here that we've got a list of Accounts and there is a column here for
01:45Privilege Sets, so one account can only be assigned to one privilege set.
01:48By default, any new FileMaker file or a starter solution or a freshly converted
01:53FileMaker file is set up in what's called a permissive state.
01:57This means that it's got an Account set up already and this account has
02:01the Account Name of Admin and the Password of blank and it's set up with Full Access.
02:06So this account will allow users to log in to the file and do anything they
02:10want inside the file.
02:11This permissive state that I'm talking about is enforced by the fact that under
02:16the File menu, you'll notice there is an option for File Options.
02:20You'll see here that there are two selections that you have in the first screen
02:23for the Open tab, that's Log in using and then the Admin account is actually set up that way.
02:30So that's why when you open up this file, you'll see when I close the file, and
02:34can go back into the file, you'll see that I'm not prompted for a password.
02:38That's because each file is set up to automatically log in with the Admin account.
02:44Nowwe can override that, as you'll see when I open up the File>Recent.
02:50On Windows, I can hold down the Shift key at this point or on Mac, I can hold
02:53the Option key down and this will prompt the Open dialog to appear, which allows
02:59me to enter in a new Account Name and Password and at this point, I could just
03:03enter in the Admin account.
03:04So it's really a good practice to go under the File menu to File Options and
03:10disable this account.
03:12In the exercise files, throughout the rest of this title, I'm going to leave this on.
03:16But in your actual real-world production databases, I advise you to turn
03:19this off and give all your users a password so that they are prompted when they login.
03:24Now back under the Manage>Security dialog, you'll also notice in the Account
03:29list by default there is a Guest Account set up.
03:32It's set up to be inactive, but if you turn it on and make it active and then
03:37log out of the database, you'll notice that we're getting prompted anytime
03:40we make a change in Manage Security to enter in the Full Access account. This
03:44is just FileMaker's way of making sure that you don't lock yourself out of the database.
03:48Now notice when we go to log into this database, I'm going to hold down the
03:52Option key again here, again, it could be Shift on Windows, you'll notice now
03:56that there's a Guest option that's available and when users select this, they
04:00can get into the database, but you see by some of the grayed out options that
04:04they have limited access to the database that they're opening up.
04:08Log in back into the database now and log in using the Admin and blank.
04:16So back under Manage>Security, under the Accounts tab, you'll notice that if
04:21you create a new account by hitting the New button, or if you were to
04:24double-click on one of the existing ones that will open up the same dialog,
04:28you'll see that you really only have a few different options to select here.
04:31You've got how you're going to authenticate, whether it's FileMaker's internal
04:35authentication, which is what the default is, or External Server which we'll
04:40cover in the next movie.
04:41You can leave that at its default FileMaker authentication and then you're
04:45prompted to enter an Account Name and a Password.
04:47You should know that it's best practice to provide both an Account Name and a
04:51Password, even though you can leave the Password blank and that you should know
04:55that the Password is case-sensitive although the Account Name is not.
04:58So if you just sort of commit yourself to knowing that both they are
05:01case-sensitive, that'll be a discipline that will allow you to not get yourself
05:05into trouble there, but it's important to provide an account and a password for
05:08every individual user of your system, at which point you can then turn this
05:12account on, meaning it's active or make it inactive if you plan on not using it
05:16till later. and then you just simply select one of the Privilege Sets.
05:19So you're going to have to select your Privilege Sets before you set up your accounts;
05:23we're going to talk about Privilege Sets later in the course.
05:26Now FileMaker Pro will require that at least one account that's set up in the
05:29system is associated with a Full Access Privilege Set.
05:32Now you can remove the Full Access Privilege Set as long as you have configured
05:37another Privilege Set that does have Full Access, but there must be at least one
05:40account set up in the system to allow this.
05:42This is of course so that you can get in and do stuff inside the database or
05:47change other accounts if you don't have a Full Access account, for example here,
05:50if I go in and I edit and I make this Data Entry and hit OK and hit OK again,
05:55FileMaker is prompting me with a message that basically says I need to have one
05:58of these accounts allow Full Access into the system.
06:02But before we set up our accounts, we must first have Privilege Sets configured
06:07and the accounts themselves will allow you to identify who your users are.
06:10So each user gets a unique combination of a username and a password.
06:13And once you know who is going to be accessing your database, you can not only
06:17restrict them from certain data and functionality, but you can also make their
06:21user experience more customized by showing them only data and functions that
06:24might be specific to them.
Collapse this transcript
Using external authentication
00:00FileMaker Pro databases can be authenticated in one of two ways;
00:04by FileMaker Pro itself where an account name and password credential are stored
00:08within the file in an encrypted form, or in another way which is called by
00:12External Authentication.
00:13External Authentication is another means by which user's credentials can be verified.
00:18It's still managed under File>Manage>Security.
00:22And although when you set up a new account, you'll notice that 'Account is
00:26authenticated via' is an option inside the Edit Account window.
00:30FileMaker is the default, but External Server is another option.
00:34So let me talk for a second first about what External Authentication really is.
00:39When you choose External Authentication, that means that the log in into the
00:42file or the username and the password access to the file is going to be managed
00:46by another system completely.
00:48And although there's very little to do inside your FileMaker database, really
00:51all the heavy lifting happens over in these other systems.
00:54So what you will you do before you even get to this point in your
00:58FileMaker database is coordinate with whomever is in your IT department or
01:01maybe it's yourself.
01:02You will have to go into either active directory, or open directory and set up
01:05a series of groups.
01:07And then once those groups are set up in your external authentication system,
01:10you can set up each group inside of FileMaker as if it's an account.
01:14But really what you'll end up doing is just bridging the group in the external
01:18authentication system with a privilege set inside your FileMaker database.
01:23So External Authentication requires a lot of coordination between the
01:26FileMaker Pro developer, you;
01:28and the network administrators.
01:30So in that case, the naming of the groups in your authentication server
01:33environment, and in FileMaker Pro must really be managed in parallel.
01:37So by the time you get to this screen in the Edit Account dialog, you will have
01:41already had a group name or a series of group names set up in your
01:44authentication system.
01:45So what you're going to do then is open up a new account and choose External
01:50Server, and then type-in the Group Name with the exact syntax as was provided by
01:55your network administrator; for example, GroupName, if that's the exact syntax
02:01and spacing and everything that was given to me.
02:03You can either choose to turn them on or inactivate them, so that they can be
02:06turned on or activated later, and then you'll pick the Privilege Set.
02:10And that's really all you have to do to set these up inside of FileMaker.
02:14However, External Authentication requires FileMaker server.
02:17Because of this, a single-user file cannot be externally authenticated.
02:20So you need to be able to host a file on server in order for this to work.
02:25For FileMaker server to interact with an authentication server, it needs to be
02:28properly configured.
02:29And we'll talk about the couple of different steps that are required to
02:32configure it later on in this course in the server chapter.
02:35So the way this works is that when a member of one of these external
02:38authentication groups logs into their database or let's say they log into
02:42Windows and they enter a username and password, then when they open up a
02:45FileMaker Pro database, his or her account name that they use to log into
02:49Windows, for example, will be passed to the authentication server.
02:53And then once that server determines that the proper credentials have been
02:56provided, it returns to FileMaker server a list of all the groups to which that user belongs.
03:02This list is then compared to the group names that were set up inside your
03:05FileMaker Pro database file, and the first valid match in the account list
03:12determines the privilege set that's available to the user.
03:15So here, you'll see the type of external server if you have many different ones in here.
03:19You'll have a group name, and the first group name it encounters, that has
03:23the correct syntax.
03:24So in this case, if there's a group name called GroupName, it will provide any
03:28user who logs into that group using external authentication with the privileges
03:32allowed by the Privilege Set called Full Access in the FileMaker file.
03:36Nowkeep in mind that authentication is determined on an account by account basis.
03:41A single FileMaker file could contain accounts that are authenticated by
03:44FileMaker Pro, mixed in with accounts that are authenticated by an external server.
03:49And you could have one user with a FileMaker authenticated account and an
03:53externally authenticated account depending on whether or not they're accessing
03:56from within their network or not.
03:58The biggest benefit of using External Authentication is that your users can
04:02log into their system one time, and then not be bothered by FileMaker to log in again.
04:06This way, they don't have to remember a separate set of usernames and passwords
04:09just to be able to access your FileMaker database.
Collapse this transcript
Understanding the default privilege sets
00:00The bulk of the work that you'll do inside your FileMaker database to set up and
00:03enforce security is actually going to be done before you even get to FileMaker.
00:08It's going to be done in your planning stage.
00:10This is where you're going to identify all of your users and each one of those
00:14users gets their own account that we've talked about in previous movies.
00:17But then also those users who need to be part of user groups or they need to
00:21have similar functionality and once you've defined what those different
00:24groups are, those get set up in your FileMaker database in something that's
00:27called a Privilege Set.
00:28And you can find Privilege Sets and manage Privilege Sets under the
00:31File>Manage>Security dialog on the tab right next to the Accounts one.
00:37Accounts will allow users to log into your database, but these Privilege Sets in
00:41FileMaker Pro determine what aspects of the database like database features,
00:45operations and data that a given user class may view, create or edit.
00:50This is where developers will have a wider range of tools with which to work.
00:55The separation between Accounts and Privilege Sets allows developers to
00:58define Privilege Sets without being concerned with the individual user
01:01passwords themselves.
01:03It's a good practice to look at all of the different users of your database and
01:06then put them into groups of users.
01:08When I say groups, I'm not talking about groups like Sales and Accounting and
01:12Production and that type of thing.
01:13But rather, one group may only be able to access customer and phone
01:16cannot delete records.
01:17Well, let's say another group can access only product data and so on.
01:21So once you've defined what these groups are, you're going to go in and set up Privilege Set.
01:25Now you may have determined that you have certain user groups and they fall
01:28into pretty general classes.
01:30And in that case, possibly the three default Privilege Sets that are already set
01:34up in your database, which are the Full Access, Data Entry and Read-Only
01:37Privilege Sets may suffice.
01:39So by default, any new database or converted database or even starter solutions
01:43that you might use will have the Full Access, Data Entry and Read-Only Access
01:47Privilege Sets already assigned.
01:49And you'll notice that the Admin Account, that's the default account, and even the
01:53Guest Account are already assigned to two of those three Privilege Sets.
01:57These default Privilege Sets cannot be deleted.
02:00Anytime you see brackets around something in FileMaker that means they can't be deleted.
02:03You'll notice that when I select it, the Delete option or the Duplicate option
02:07are not available to me.
02:09But developers can create their own custom Privilege Sets when necessary.
02:12Nowyou'll notice a Full Access Privilege Set if I select it and hit Edit,
02:17everything is grayed out, but essentially it allows you to access all the
02:21Records in the database, Create, Edit and Delete them, all the Layouts, all the
02:25Values Lists and all the Scripts.
02:27You'll notice that your access sort of cascades down a bit.
02:30For instance, Data Entry allows you to create, edit and delete in all tables,
02:35but then only view the Layouts and view the Value List and view the Scripts.
02:39Then finally, down at Read-Only Access when you hit Edit, you've got the ability
02:44to view only all the records, and then view only all the other elements like the
02:48Layouts, Values and Scripts.
02:50So again, you may have evaluated all the different users that are going to
02:54access your database and they may fit into one of these three categories.
02:57But if you do need additional access or more customized access for these user groups,
03:01then you can move on to creating customized Privilege Sets.
Collapse this transcript
Customizing privilege sets
00:01FileMaker Pro provides three default Privilege Sets, under the Manage Security
00:06window, and sometimes those three default Privilege Sets do not address all of
00:10the security requirements a given database solution may call for.
00:14So you may need to create your own customized Privilege Sets and take
00:18advantage of some of the real granular level of security that's available on
00:22these Privilege Sets.
00:23So the way that you create a customized Privilege Set is by going into the
00:27Privilege Set tab and hitting the New button.
00:29So here we're going to creating new one just to that I can give you a tour of
00:33all the different options that are available to you.
00:35Once you know all the different options that are available when configuring a
00:39Privilege Set, this might help you further define what those actual user access
00:43groups are going to be when you're in the planning stage of your database.
00:47So first you want to give your Privilege Set a name, this of course will allow
00:50you to differentiate the different Privilege Sets in your list, and a little
00:54Description can help maybe other users or administrators of the system know what
00:57this Privilege Set is intended for.
00:59Here's where you can really define who the user group is.
01:02So customizing any Privilege Set really boils down to these aspects here,
01:06Records, Layouts, Value List and Scripts.
01:09You'll notice that in each one of these you've got a series of dropdown
01:13options, and they kind of match the Full Access, Data Entry and Read-Only
01:18options that you saw in the default Privilege Set.
01:20So you see here, this is really the Full Access, this is the Data Entry and
01:25this is the Read-Only.
01:27And the same is true for Layouts, Value Lists and Scripts.
01:32So you could just emulate the default ones by just picking all the top options
01:37for a full access, and all the middle options for a data entry, and so on.
01:42But what I really like to show you is the options that you have available in
01:46each one of these Data Access and Design categories that allow you to really
01:50customize the accesses.
01:51So for example, under Records if you choose Custom Privileges, you'll notice
01:55that you invoke another window that's called the Customer Record Privileges and
01:59what this allows you to do is go table by table within your database and
02:03determine what rights to either the records in that table or the fields in that
02:07table your users are going to have.
02:09So here for example, I could say, I determine that there's a user group that
02:13only deals with Customers; let's say I have a customer service group, and any
02:16member of this Privilege Set can only interact with Customers.
02:20So in that case, I would leave all of the different tables as they are.
02:25You'll notice in any new Privilege Set in FileMaker that everything is turned
02:28off, it's in what's called a pessimistic state. This way you don't inadvertently
02:32setup a Privilege Set that allows full access to a system, instead you have to
02:36go from no access at all and build up the access.
02:38So when you're looking at this window here, what this tells us is that no tables
02:42have any View, Edit, Create, Delete or Field Access whatsoever.
02:46So what I can do is pick the different tables I want, in this case let's just
02:49say I pick Customer, and I can say all right, can they View records in this
02:54table, I can say either yes or no.
02:56Can they Edit records in this table, either yes or no.
02:59Can they Create records in his table, we'll leave that at no, and let's say Delete no as well.
03:04Now the Field Access allows us to choose either all of the different fields that
03:08are defined in that table are then available to users in this Privilege Set or
03:11not, or I can pick this limited option, which brings up a list of all the fields
03:17in the table, and I can select them individually, and allow them to be either
03:21modifiable or view only, if I'd like, or I can hold down the Shift key and pick
03:25groups of them and change them all to view only or modifiable if I'd like to.
03:31Modifiable of course means the user can click into the field; and view only
03:35means they can just see the contents of the field; no access, means they cannot
03:38click in, nor see the contents of the field.
03:41So basically you can go through different combinations of tables and records
03:45within tables or even fields within those tables and create a real
03:48customized group of access.
03:51So with this level alone allows you to control, View, Edit, Create, Delete and
03:55Field Access on all of the tables or different groups of tables.
03:59So this right here shows you how really granular these different levels of
04:02access can be within your Privilege Set user groups.
04:06Layouts have a little less depth. Here when going to Custom Privileges, you
04:11see all the different Layouts that are defined. You can see over on the
04:14right-hand side you see these are Layouts already in your file and which table
04:18they're associated with, so some of this you're already managing when you
04:21setup access the tables.
04:22But for example, you can say the Company Info field for this group is not
04:27accessible, but anything dealing with Customers, I'll hold on my Shift key
04:31to select them both.
04:33I can say they're view only, and if I say modifiable, that actually means I'm
04:37allowing the user to go into Layout mode to make changes to the Layout.
04:41So likely in most cases unless it's a developer group, you're going to allow
04:44them to view Layout, and then any records within that Layout can either be
04:48viewed, modified or no access whatsoever.
04:52So I'll say they can view any amount of the Customer Layouts, basically a
04:56layout based on Customer table, and then they can actually modify data within the records.
05:02Value Lists; if you don't choose one of the three default options, you can go into Custom
05:06Privileges and you can say, this Value List is not accessible, this one is
05:10and so on and so forth.
05:11And the reason you might do this because sometimes your Value List might be
05:15based on the contents of a field and you don't you want users to see the
05:19contents of the field or the index of that field, so you might turn it off.
05:22If you have a Value List assigned to a field and you select no access, the user
05:27will not see dropdown lists or pop-up menus.
05:30But in the case of a checkbox or radio buttons, they're going to see no access,
05:34next to each one of the values that were previously there inside your Value List.
05:38So you can go through all of them, of course, this is set for
05:41pessimistic settings again.
05:43And Scripts are very similar to Value Lists, in that you can pick individual
05:48Scripts, you can go into each Script and pick it and say, whether or not it can
05:53be executed, which means it can be triggered and run, or there is no access
05:56whatsoever, or even modifiable, meaning that they can actually go into the
05:59Manage Scripts window and modify the script if you allow them access to.
06:03As a matter of fact, you should be aware that that under the Manage Scripts,
06:08if you choose one of the Scripts in your database, almost close to the bottom
06:12left-hand corner, you'll see an option for run the script with full access privileges.
06:16This will supersede any Settings that you've set up in the users Privilege Set
06:21and allow them to run it, as if they had full access Privileges.
06:24Of course they'll sent back to their Privilege Set defined level of access to
06:29the database, once the script is over.
06:31But this will allow you do things like maybe set the values in a field in a table
06:35that maybe they don't have access to during their normal user session.
06:40So back in the Manage Security,
06:44the only other options that you might want to configure are over here on Other
06:48Privileges. They're pretty self-explanatory, for the most part, you'll notice
06:51you've got either the ability to Allow printing or Allow exporting. Keep in mind
06:55that choosing Allow printing, means not only to print hard copies to printers,
07:00but also to save records as PDF. Allow exporting not only controls your
07:06exporting options available under the File menu, but in addition also allows you
07:10to control whether or not users can save as Excel.
07:13So you can't separate exporting features from Save As Excel, those two are fused
07:17together by either turning them on or off, by checking the box here.
07:21You can also allow them to Manage their own extended privileges, which
07:24we're going to talk about in the next movie, or Allow the user to override
07:28data validation warnings.
07:29So if you setup fields with data validation, you can allow entire Privilege
07:33Set or all the users assigned to your Privilege Set to override those
07:37validation warnings.
07:38This might be one that you might just want to reserve to you, the developer, or a
07:42Privilege Set that you setup with Full Access.
07:44You'll also notice your Disconnect user from FileMaker server when idle. That is
07:48something that is also controlled on the server side, so if you setup a time out
07:52of 15 minutes, any user that has this checkbox checked, will then be kicked off
07:58the server or their user session terminated after that 15 minutes, let's say,
08:03time has been achieved.
08:04Now you as a developer, you might want to allow user to override data validation
08:09warnings and maybe uncheck the disconnect, so that you can leave your system
08:12idle and not get kicked out.
08:13But one thing I want to quickly point out if you go into the Accounts window and
08:19hit New or Edit, you'll notice there is an option here for User must change
08:23password on next login.
08:24Now if you select this on an account, you have to make sure that account
08:29is assigned to a Privilege Set that has the Allow user to modify their own password.
08:33Because of course you could be requiring them to modify, and then not allowing
08:37them to do so, that could be problematic.
08:39Now finally don't forget the Available menu commands, its in a pessimistic state
08:43when you first create a Privilege Set and it's often overlooked.
08:46You'll see here that it's set to Minimum, which means that most of the menu
08:50values, very similar to what you see as I scroll over these, are not
08:53available to the user.
08:54So you're going to want to make sure to either allow them all of the different
08:58options or editing only which is copying and pasting stuff like that, or Minimum
09:02which is basically just allowing them to open and close the file.
09:05So make sure that I you don't forget the available menu commands.
09:09Implementing a proper security model often goes well beyond controlling whether
09:12or not someone can just log in to the database or not.
09:15FileMaker Pro includes a robust set of features for controlling which users have
09:19access to which information, and then also what they can do with that
09:22information, and that's all done by setting up Privilege Sets for each user that
09:27was previously defined in a user group.
Collapse this transcript
Applying extended privileges
00:00When you're going through the exercise of determining what users are going to be
00:03need to be access in your database, and then of course what groups they belong to,
00:07you also want to take into consideration during that exercise that you want
00:11see what types of technologies they're going to be using to access the database.
00:15We've already talked about the different options under the Manage Security
00:19window for setting up accounts, which you want to have each user have their
00:23own individual account and password combination, and then you'll have to
00:26assign those accounts to an existing Privilege Set, which I like to refer to as User Groups.
00:31You can use one of the default Privilege Sets or go on and create your own
00:35customized Privilege Set.
00:36Once you have a Privilege Set created and accounts assigned to it, you'll notice
00:40that under the Edit Privilege Set, you'll see in the bottom left-hand corner
00:44there's a section for Extended Privileges, you'll also see Extended Privileges
00:49under the Extended Privilege tab. Now what is an Extended Privilege?
00:52Well, think of them as nothing more then on and off switches that will allow you
00:56to turn on different technologies that users can use to log into the database
01:01and access your data.
01:03So for example, as you see here we've got iwp, which stands for Instant Web Publishing
01:07and what that means is if you turn on the fmiwp Extended Privilege
01:14within a Privilege Set, that means that any account that logs into this
01:19Privilege Set, can login using Instant Web Publishing.
01:24You'll also notice that we've got options for xdbc, which means that external
01:28applications or user accounts that you setup for those applications that might
01:32be accessing file FileMaker data via an ODBC connection, they would need to have
01:36the extended privilege for the xdbc Privilege Set enabled.
01:41And the most important one, this FileMaker Network, this means that if you
01:45want to share your database on FileMaker server, you're going to need to make
01:49sure that you have at least one Privilege Set with the fmapp Extended Privilege enabled.
01:55Otherwise you can upload this file to FileMaker server, and turn it on and make
02:01it available on the network. But no users will be able to see it.
02:05You'll notice that there are some other types of technologies that are specific to the web.
02:09If hit Cancel and go over in to Extended Privileges window, you'll see that
02:12we've got a web technology and Instant Web Publishing and we've also got PHP.
02:18So if you want users to be able to access your database via a PHP application,
02:22you need to make sure that you have at least one Privilege Set with the fmphp,
02:26Extended Privilege active.
02:29Same is true for XML, so if there's another application or another series of
02:32users that want to extract data from your database via XML, then there has to be
02:37a Privilege Set with the fmxml, Extended Privilege activated.
02:41And the two new ones that you may not be familiar with, even if you've seen
02:45Extended Privileges in pervious versions, are the re-authenticate, which are
02:49specific to FileMaker Go. We'll talk about these later in the course when we
02:53have the discussion on FileMaker Go.
02:55But what they do is they manage whether or not a user can access your
02:59database through the FileMaker Go application on either an iPad, iPod Touch or an
03:06iPhone, and then the authenticating the number after it determines how long
03:10before a user has to be prompted to log in again.
03:14Now keep in mind that you can select multiple technologies for a single
03:17Privilege Set as you see here; you can select them all, if you'd like to,
03:21doesn't really present much more of a security risk. That's allowing users
03:25to access the database using various technologies, but they would only use one account.
03:30Now keep in mind also that, if a user can login to a database that's hosted on
03:35the network, but that same account can't be used for let's say, logging in to a
03:39web application or via FileMaker Go, the place you want to look to make sure
03:43that all those are enabled is going to be under the Edit Privilege Set.
03:47So I can into Edit Privilege Set and choose which different technologies or
03:51Extended Privileges will allow access, or I can go under the Extended Privileges
03:57tab and I can choose for example, access via FileMaker Network and select which
04:04Privilege Sets I want to have those turned on. You'll notice then, when we
04:08go into the Privilege Sets, you'll see that those are turned on.
04:12So you can manage these by Privilege Set or by Extended Privilege.
04:16Now this might be an obvious point, but of course you want to make sure to test
04:20your database under every Privilege Set.
04:21You also want to them under all the technologies that you're allowing access to.
04:25This will help you shake out any problems that you might have where you turned
04:29on an Account or Privilege Set combination under one technology but didn't turn it on under another.
04:33FileMaker Pro allows users to access their database from a variety of different
04:37technologies and the Extended Privilege Sets allow you control those for each
04:42user group that you've defined in your system.
Collapse this transcript
2. Calculations: Extending Text Functions
Exploring the PatternCount, Position, and Length functions
00:00Given the wide range of uses for Calculation formulas within FileMaker Pro,
00:05establishing a solid familiarity with them is essential to becoming a proficient
00:08FileMaker developer.
00:10Now if you're new to Calculations in FileMaker, I strongly urge you to go back
00:14and watch the FileMaker 12 Essential Training title and specifically the
00:18chapters on Calculations, and then the other one on Calculation function basics.
00:24For those of you that are familiar with Calculations, I'm going to introduce you
00:27to the Calculation functions that I find to be the most useful.
00:30I'm going to start first with the largest group of functions in FileMaker and
00:34those pertain to investigating and manipulating text strings.
00:37Unlike some groups of functions in which only a few are used on a regular basis,
00:42nearly the half of the Text functions are frequently used in FileMaker Pro solutions.
00:46In this chapter I'm going to focus on about a half dozen or so of these.
00:50And I'm going to start first with the PatternCount Position and Length functions.
00:55In order to understand the purpose of these functions, first we have to define
00:59what a text string is.
01:00I am going to be talking about text strings and manipulating those or evaluating those.
01:05A text string is really nothing more then a sequence of characters.
01:08It could be anything like this value in the Part Number field or it could be
01:12this entire value and the Description field or a single word or a single
01:16character, whatever it might be.
01:17FileMaker doesn't really know the difference between a series of
01:21characters and a word, so for instance when it sees a word REPAIR, it doesn't
01:27now the difference between that word and just the character R E P A I R, all strung together.
01:33The contents of this Description field can be thought of in the same way. When a
01:37computer processes a string it treats it simply as an ordered set of characters
01:41devoid of any meaning or value.
01:43Punctuation and white spaces are merely other types of text characters that
01:47are processed by FileMaker, so things like this little comma we see here, and
01:52the spacing between those words, those are all characters and those will be evaluated as such.
01:57So the text functions that I want to review here are those that give information
02:01about a text string. In three that I've chosen for this movie, PatternCount
02:07Position and Length, all result in a numeric value.
02:11The first of which is PatternCount. PatternCount returns the number of times that
02:15the specified search string is contained within a give piece of text.
02:19So basically, it counts patterns and a pattern can be as small as a single
02:24character, as long as a phrase.
02:27So let's use our imagination a little bit and say that someone has asked you to
02:30determine how many times the word Bike is used inside the Notes field that you
02:34see down here, on the bottom left-hand corner of your screen.
02:37Sure you could do research, find all the records with the word Bike in the Notes
02:40field by simply going into Find mode and searching for that as your criteria.
02:44But you'd have to manually count all the number of words from there.
02:47Bike could be in the field for 5 times and it would only show up as one
02:51record in your file count.
02:53So instead, let's say we want to create a Calculation field that we're going to call BikeCount.
02:57So as with any other field, we go under File>Manage>Database and I'm going to
03:03use this in the Products table, so we see that it opens up to the Products table
03:08context, and we type in BikeCount. As I mentioned before, I'm going to make
03:13this a Calculation field.
03:15But keep in mind that Calculation functions can be used widely throughout
03:18FileMaker, not the just in fields, but in the next couple of movies we're going
03:22to focus on using Calculation functions and Calculation fields.
03:25So now when I hit Create, we see our Calculation dialog and up in the upper
03:29right-hand corner we can see all the different functions.
03:31They are broken down by groups, so if I pick the Text functions, you can see
03:36all the different ones that either Count or Result and Text.
03:40Now we're looking for the one called PatternCount.
03:42PatternCount is pretty simple because it's only got a couple of parameters.
03:46You see that's some of these other functions have several different parameters all
03:48strung together by semicolons.
03:50But PatternCount is easy, it just says;
03:52what's the text that you want to make your observation on, and what is it that
03:57you're searching on.
03:58So here the text is actually going to be the Notes field I described earlier.
04:02So let's pick our Notes field, and the search string that we're looking for,
04:08is going to be word Bike.
04:09Any time you reference text inside of a Calculation function you have wrap
04:14it in quotes, so that FileMaker doesn't think it's a field name or a function
04:18that you're referencing.
04:19As with the any other Calculation field you want to pay attention to result.
04:22In this case we're going to result in a number, because we want to know how many times
04:26the word Bike appears in that field.
04:28So now let's hit OK, I'm going to hit OK again.
04:31You'll notice that the field was automatically added to the Layout.
04:36If I go into Layout mode, I can scroll down and see it on the bottom.
04:43I'll hold down my Shift key and grab those too and move it above the bottom of our screen.
04:50If your field didn't automatically show up on screen, that's because you have
04:55wisely turned off the FileMaker Pro Preference under the Layout section that
04:59says Add newly defined fields to the current Layout, we'll go ahead and turn
05:03that one off as well, for the rest of these exercises.
05:06Now in Browse mode, we've saved that.
05:09Now we can see as we go through, we can see which records in our database have
05:15the word Bike inside the Notes field. I can actually go into Find mode now.
05:19Find, and even enter in greater than zero, and this tells me that three records
05:25contain the word Bike in the Notes field.
05:27And it tells me how many times that pattern or the characters B-I-K-E were found.
05:32Now you'll notice in some of these fields there's actually the word Bikes.
05:36You'll see here for example in the Men's Mountain Bike, minimum for all Bikes
05:41is in here, we're still just looking for the text string B-I-K-E, not the word
05:46Bike, so this actually does count as one of the PatternCounts.
05:51By default the PatternCount function is not case sensitive, so even though I
05:55capitalized the B in our Calculation function that you see inside the field
06:01for BikeCount, you'll notice that it still finds a match when it's either a capital
06:07or lower case B, so PatternCount is not case sensitive.
06:10But now for more practical example, let's open up the Manage Scripts.
06:14You'll notice that there's a bunch of scripts already created in here.
06:17And if you look at the On First Window Open, you'll notice that this script has
06:22a series of different if functions; and of course, an if function in a script is
06:27another area where you can use the specified Calculation dialog.
06:29And you'll notice that there are several of them in here that use the
06:33PatternCount option. What it's looking for there, it's using a get
06:37function called Get(ApplicationVersion) and looking for the occurrence of the different device.
06:42So here we're saying count how many times the word iPad shows up in the
06:45Get(ApplicationVersion) result, or Pro or iPhone for example.
06:51And this is a way that the PatternCount can be used to extrapolate which
06:55different device or which client is being used to access this database.
07:00Sometimes you might not want to find out just number of occurrences of a
07:03value in a text string, but perhaps a location of those characters within a
07:07text string as well.
07:08So for example, you might want to find out where the comma is inside of a text
07:13string, so later on in this course we're going to be using a technique where
07:18we're going to parse out the city and state and zip, from a city state zip field.
07:22And in that case its very important for us to find out for example where the comma is.
07:27So in that case, you're going to use a function, you'll notice if I just use the
07:31BikeCount, you'll see that there's a another function under Text that's called Position.
07:37Position has various different parameters.
07:41It basically says within which text do you want to find a string and what is the
07:45text string that you're looking for?
07:47So PatternCount tells us how many different occurrences of it occur.
07:51Here we're saying give me the character Position and we can start at
07:54the very first character and give the character Position of the very first
07:58occurrence of such.
07:59So Position just slightly different from Pattern; not doing the counting, but
08:03actually giving us back a number value that represents the character Position.
08:07We'll use this in an example later on in this course.
08:11But for example, let's say I want to create something that tells me in any
08:16part number that has a dash in it, tell me what character position that dash is in,
08:19we could then use this later to maybe parse all the values out after the dash or
08:22parse all the values up before the dash, or whatever. So if I create a field called
08:28Dash make it a Calculation, hit OK.
08:33First I can determine by adding a condition, my test is going to use PatternCount.
08:41So the test is going to be if, and I'll just type in PatternCount, so in the
08:47Part Number field, If there is a Dash
08:57and if the number of those Dashes (-) is greater than zero;
09:00that basically means that if the Part Number field has a Dash (-) in it,
09:03then what we're looking for is the Position. So here I'll go down a Position again
09:13in the Part Number field.
09:16So I want to know the Position of the Dash, so we do quote dash quote, "-"
09:21and I want to know starting with the very first character in that Part Number,
09:26give me the first occurrence, and otherwise if it doesn't have one, don't give a number back.
09:33This will tell me result in a Number, so I know I hit Number and hit OK.
09:38In Layout mode, just for example purposes, we'll throw this Dash let's say right there.
09:45So now we're going to back into Browse mode, you'll see that it's the sixth
09:49character in this one, so we've got 123456 and next one, number 4, 3 and so on.
09:59And in some of these cases, if we do Show All, we'll see that there's no value
10:03because there is no Dash in that Part Number field.
10:06So this way if we wanted to extract all the numbers before the Dash or after the Dash,
10:10this tells us which character number we can start with.
10:13Also in this case, it might be useful to know the full number of characters in this text string.
10:17So for example we could subtract the Dash Position from the full Length of the
10:21characters, and that would tell us how many characters we need to extract.
10:24That function is a very simple one, it's called the Length function.
10:29I'll show you a simple calculation we can create, and we'll type in Length.
10:38So in the case of Length, we'll go to Part Number, this will tell us, for every one of
10:47these, how many different characters there are in this field.
10:52Now of course we won't usually be putting these fields on the Layout,
10:57but this is just to kind of visually give you a demonstration of finding the different values,
11:01and that you could do some math here.
11:04So for example, I could tell, I could subtract one value from the end of this,
11:08which is the difference between Length and the location of the Dash,
11:11and that would help me trim off any character after the Dash.
11:14So some text functions, like the three we've discussed here, can return numbers
11:18telling us the location or a number of occurrences of certain elements within a text string.
11:23Establishing a solid familiarity with them is essential to becoming a
11:26proficient FileMaker developer, as they can help us with doing things like
11:30extracting text or adding conditions to our programming.
Collapse this transcript
Understanding the Left, Right, and Middle functions
00:00We talked about text functions that provide a numeric result when used in a
00:04formula, and in this movie I want to show you a family of functions that return
00:08a text value as the result of the text function.
00:11These families of functions are commonly used to extract or parse text out of
00:16another text string and we like to call them the left, right and middle
00:20functions, sort of a group or a family of functions together.
00:23Let's take a look at these.
00:25First, the Left function has two different parameters the text that's going to
00:29be parsed and the number of characters that we want to extract from the left.
00:33So it returns a string that contains the first left, however many numbers that we indicate.
00:38So example "Hickory, dickory, dock" returns H-i-c-k or the word "Hick."
00:44Now writes the same thing conversely, it will return the
00:47Right number of characters that we specify.
00:50So for example here we might say "Hickory, dickory, dock" again, number 4,
00:54meaning the number of characters we want to extract and that will give us "dock"
00:58so the last four characters from the right.
01:00Now Middle is a little bit different, because middle is used to slice
01:03information out of the middle.
01:05So we don't get it from the beginning, we don't get it from the end, but
01:08instead we take it out from the middle.
01:10So for example we might say "Hickory, dickory, dock", we see that we've
01:13got an additional parameter, we have to tell it at which character do we want to start.
01:15So here we can see in "Hickory, dickory, dock" we are going to start at the
01:19fourth character and give us the next three characters.
01:23So in this case in Hickory H-I-C-K are the first four characters, and starting
01:28on the fourth character we want to take three characters out of the middle and
01:31that's where we get our KOR.
01:34Now let's say in our example database where we have already created this
01:37calculation for the dash field.
01:40If we go into Manage>Database and look at the dash (-) field, we see that we
01:46added an if condition.
01:48So we say if there are more than 0 dashes inside the Part Number Field, then we
01:55want to extract the position or the character number that represents the
01:59location of the dash.
02:00So let say we what they wanted to do is extract all the Part Number characters
02:05from the left of the dash.
02:06So in that case we could use the Left function, make some space for it, and I
02:13just click down the L, so I can get to down the Ls and there is my Left.
02:17So the Left function tells me, I want to know what text we are going parse.
02:22So in this case we are going to be parsing the Part Number field.
02:29So first in the text we'll put the Part Number field. Now the parameter for
02:32the numbers of characters isn't just going to be a number, but instead it could
02:37be a different number from record to record.
02:39So this is what we want to insert a formula that will then tell us the number
02:44of characters dynamically.
02:45So instead of hard coding in however many numbers we want to extract,
02:49because we don't know if we look at the Part Number; in this it happens to be
02:52extracting the first three, the next one, it could be the first ten, the next
02:56one can be five or so on.
02:58So instead of putting a hard coded number into numberOfCharacters, we are
03:00going to put a formula in there that will result in a number and that will
03:03actually be the correct number of values that we want to extract from the Left record-by-record.
03:09This is where the Position function that we created earlier, we copy and paste
03:17that here, now that will dynamically produce the numberOfCharacters that we need
03:21to extract from the Left in order to pull everything from the Left of the dash.
03:26So let's take a look it what that will look like and we have Number and in this
03:32case we want to change our result to Text, hit OK and hit OK.
03:36Now we look in the dash, we notice that it is including the dash
03:42and any relevant record, so that of course is because we've said take everything from
03:47the position of the dash to the Left.
03:48So what we can do is move that a bit and we'll simply do there as we say the
03:56result of this formula, will give us our number, minus (-) 1 character.
04:02So let's say for example it gave us a 4 that would be the Position of the dash,
04:06give us 4-1, so it always shave one of them off dynamically and you'll notice now,
04:12by doing that you see that dynamically where appropriate, it just give us
04:16all the values to the Left.
04:18This is an example of nesting different text functions together to do some parsing.
04:23There are some very common uses of these functions for the purpose of parsing text.
04:28So here you can see some examples: pull the first character of a string,
04:33everything except the first character, everything but the delimiter, which is
04:36the one we just did with the dash. These might be things that you might want
04:40to try out within your own applications just to kind a get some practice at to
04:44nesting different functions together.
04:46You see all of them use Left, Right and Middle.
04:48So on almost every text parsing exercise, you are going to see Left, Right, or Middle up here.
04:52Now you'll notice a lot of these functions use the Left or Right, but we haven't
04:56talked about the Middle function yet.
04:59Let's go back into our Database and instead of in Product Details,
05:03let's navigate over to the Customer Details Layout and I am going to show an example
05:07of using the Middle function to extract data out of the Middle of a text string.
05:11So for example, let's say that we've got the website field here, each one of
05:16these customer records has a website in it, some of them don't, some of them do.
05:21But what I want to do is pull the domain, and what I mean by domain, it's the
05:24value that comes in between the www., and the dot whatever .com or .net or
05:30.org, or whatever it is.
05:31And this might be something that you need to do in order to be able to
05:35dynamically generate email addresses from within a customer or do different
05:39searches, or see if you've got the same domains for different customers across
05:43the group, whatever it might be.
05:44So this case what we want to do is we want to splice out the middle just
05:48anything in between the first occurrence of a period (.)
05:51and the second occurrence of a period (.)
05:53and anything in there, we will consider the domain.
05:56So let's go into File>Manage>Database create a field called Domain, and we will
06:03make a Calculation and hit Create.
06:06So in this example we are going to be using the Middle function, so I'll click
06:10into the All functions by name, type in M to bring me down to the Middle and
06:14double-click Middle.
06:15Now I am going to use some spaces here, it won't effect the outcome of our formula.
06:20So on the first line, I am going to just indicate what field we are going to be
06:26parsing out and that's website.
06:28And now here I need to know where I am going to start pulling data,
06:33so that's going to be the Position of the period (.) inside websites.
06:36So what we want to do there, we'll click into functions again, type in P, and
06:41go down to the Position.
06:43So here we'll say in the website field we are looking for the period (.),
06:50which is text, so we'll wrap that in quotes ("") and we want the very first
06:55Position, so we'll start at the very first Position that's the first one and
06:59then we want the first occurrence.
07:01So this is going to tell us the position of that period (.).
07:04That's where we want to start extracting data and then now we have to tell it
07:08how many characters we want.
07:09So in this case what will we really want is anything that's in between the
07:13character positions of the second period (.)
07:15and the character position of the first period (.)
07:17So here we can do a little copying and pasting, and say this character position
07:25of the second occurrence of the period (.)
07:30minus (-), if I paste in the character position of the first occurrence of the period (.)
07:35and in this case our result is going to be Text, we'll hit OK, we'll hit OK again.
07:41Now if we go into Layout mode and drop our Domain field on the Layout,
07:51we can take a look at this in Browse mode.
07:52So let's see what we get.
07:54So you'll notice here that we have almost extracted all the data that we want to,
07:58but again, this is important, we're counting the first characters, we want
08:02to trim off that period (.) in there in order to get the proper Domain.
08:05So to fix this, we'll go into our Calculation and will move our starting point over by 1.
08:12So here we will say 1 plus (+) the first position; we are going to move our
08:18start over, then we are going to subtract one less character.
08:22So now you see we remove our starting position over one to compensate for the period (.)
08:27and then we splice off one less character as a result.
08:32So there you see how the Middle function can allow us to extract data
08:35dynamically from within the middle of a text string.
08:38So you do not always get the data in the format that you prefer if you are
08:42getting it from other sources, but using a Calculation function for parsing out
08:45text, you can really solve that problem.
08:47So the Left, Right and Middle functions can be used in combination with
08:51other text functions to help you parse out data, just the way you need it
08:54from any text string.
Collapse this transcript
Understanding the LeftWords, RightWords, and MiddleWords functions
00:00In a previous movie we saw how the Left, Right and Middle functions can allow
00:04you parse out characters from within text strings.
00:07Now FileMaker also provides you with similar functions to parse out entire words
00:12from within Text strings rather than just the characters. These functions are
00:16similarly named, they just have 'Words' at the end of them.
00:20So in the case of LeftWords we see we still have two parameters, the text and
00:24the numberOfWords in this case, not Characters.
00:26And it will give the first numberOfWord.
00:28So for example if we had to sentence ("the mouse ran") and we say give us two
00:33words, it we give us 'the,' and the 'mouse.'
00:35Conversely RightWords returns the x-numberOfWords from the end of the text
00:41so ("up the clock") 2 would be "the clock."
00:43Now in the case of MiddleWords of course, we do have that third parameter here,
00:46we've got the text that we're parsing, the word where we want to start and
00:50then the numberOfWords.
00:51The difference between the Left, Right and Middle of course is where we want to start.
00:55So in this case let's say we wanted to do ("the mouse ran up the clock"),
01:00starting at the 2nd word, give me one word, and that of course would be "mouse".
01:06Now back in our database, let's say for example we wanted to be able to create a sort field.
01:12So you notice here in Item, we've got a couple of different products that have
01:16the word Men's or the Women's at the beginning.
01:19But when we sort these in our catalog, we don't want it to sort by the M or the W;
01:23we wanted to sort by whatever the actual product is.
01:25So we are going to use a couple of things, we are going to first identify
01:29whether or not the word Men's or Women's actually exists, and if it does we just
01:34want to show whatever the remaining words are.
01:37So this involves a couple different things. First we have to detect or put
01:41a if statement in to say, how many occurrences of the word men's or women's are there.
01:47And if they are greater than (>0), then strip off the first word, and then give
01:50us however many remaining words there are.
01:52So let's go Create a new field for this. We will call it ItemSort,
02:01and of course it's going to be a Calculation.
02:04And now in this case the first thing that we want to do is ask a question:
02:08Are there any occurrences of the word Men's or Women's? So in that case
02:12we'll create an if statement, and will use PatternCount.
02:17So PatternCount can not only be used just to detect certain text characters, but entire words.
02:22So here if I say inside the Item String, look for -- and I am pasting this,
02:29because I have to have copied earlier, and I copied it by the way, because of the
02:33apostrophe ('). Sometimes apostrophes (') can be recognized differently,
02:36just as a little tip there when you're identifying certain text.
02:40So if the PatternCount of the occurrences of the word Men's is greater than >0,
02:46Or -- and now I can add another criteria to my test, just copy this instead of Men's,
02:54I'll say Women's. So basically what I have said here is, if the value inside
02:59Items has either the word Men's more than zero times, or the word Women's more
03:05than zero times, then we want our function to kick in.
03:09So I'll put the delimiter at the end here, to indicate that my test is done
03:13on the if statement, and give myself some space. Here's where I will use MiddleWords.
03:18So we'll see MiddleWords, very similar to the Middle, and parse out Item, and we
03:25want to say which word, do we want to start with.
03:28So we have determined that, If Men's or Women's occur more than zero times
03:32in the ItemField that is the only time then that this sequence here will even be evaluated.
03:39So in this case what I want to do is say the second word will be our
03:42StartingWord, because here we have already identified that the first word is
03:45either Men's or Women's. So now the tricky part here is to determine how many
03:51different words we want to extract, because in this case it could have three,
03:57in another case it could have five, or two, or whatever it is.
04:00So there's another function I want to introduce you to, which is
04:02called WordCount, which tells us how many different words there are
04:07inside the ItemFields.
04:08So it tells us the total number of words and of course, if we've gotten this far,
04:12we've determined that one of the words is either Men's or Women's.
04:16So I will subtract one total word from the WordCount. So now what we are
04:22telling it to do is when we detect Men's or Women's at the beginning of our Item,
04:26start at the second word, thus skipping over Men's or Women's and give me
04:31all the other words, minus the Men's or Women's, thus then being able to sort by
04:36the actual product name, rather than the prefix of the word, Men or Woman.
04:42Now we'll add my closing parens () and my result is going to be Text and
04:48let's take a look at how this thing looks.
04:51So now in Layout mode, let's change dash to ItemSort
05:04and now in Browse mode, let's see what we get.
05:06So this one has Men's and it just stripped off Men's and has just given us Mountain Bike.
05:10Here it hasn't stripped anything, because it determines that the value doesn't
05:14need to be sorted, same here.
05:19So you will look and we'll see if we have Men's or Women's, there's Men's or Women's.
05:24So you can see that it's only performing this function when we need it to.
05:28And it's doing it dynamically no matter how many different words there are inside the ItemFields.
05:32Now a quick note, since we are talking about words here, I want to tell you a
05:36little bit about what FileMaker actually considers a word.
05:39The four Word functions that we've been talking about: WordCount(),
05:42LeftWords(), MiddleWords(), and RightWords() all depend on FileMaker knowing
05:47what constitutes a word.
05:49This logic is driven by a list of Characters that FileMaker Pro considers word delimiters.
05:53So you can assume things like spaces, or tabs, or carriage returns, and most
05:59punctuation marks are considered word delimiters.
06:01So FileMaker Pro considers characters between those delimiters words.
06:06Note however, a very interesting exception to that.
06:10Punctuation marks that serve as a valid date and time separators are not
06:14considered word separators when the characters on either side of the
06:17separator are numbers.
06:19So for example in ("x-y-z") if we did that wrapped in WordCount that will tell
06:26us that's three different words, they happen to be one character words here,
06:29but it's three different words.
06:30But if I did numbers on each side of the dash, so for example, in 12-31-2012
06:37that tells us that that's one big word.
06:40So FileMaker, the rule is anytime a punctuation is surrounded on both sides by
06:47a number, it does not consider that a word delimiter. And that comes into play
06:51when it comes into dates and phone numbers, Social Security numbers, all those
06:55types of things that you would want to treat as one single word, FileMaker has
06:59this rule kick in so that it doesn't separate them, as it would, here in the
07:03("x-y-z") circumstance.
07:05So once again, you don't always get data in the perfect format, but if you're
07:09familiar with using Calculation functions for parsing out the text, then you
07:13can solve that problem.
07:14The Left, Right and MiddleWord functions can be used in combination with
07:18other text functions to help you parse out just the data that you need from any text string.
Collapse this transcript
Creating a list of values using the List function
00:00We've discussed how FileMaker can extract characters or words from
00:04different text strings.
00:06The FileMaker also has a family of functions that will allow us to extract
00:09values from a list of different values.
00:12But first, what are a list of values?
00:16In FileMaker, list of values are determined by a return delimited list of data.
00:20In other development environments, these are commonly referred to as arrays.
00:24The functions that we're going to discuss here operate on a return delimited
00:28list of data and each item in a list is referred to as a value.
00:33Return delimited list are encountered frequently in FileMaker Pro, so knowing
00:37how to manipulate this kind of data is imperative.
00:40If you look inside the exercise file, you'll notice that I've created a layout
00:46where I gave three different examples of functions within FileMaker that create lists.
00:52The following functions for example generate return delimited lists.
00:55So you see here we've got the GET ExtendedPrivileges. We talked about
00:59ExtendedPrivileges before; and there is a GET function in FileMaker that extracts
01:04whatever the ExtendedPrivileges are from the Account that I use to login.
01:08So in my account I clearly have the Instantweb, PHP, FileMaker go authenticate0
01:14and the XML ExtendedPrivileges active.
01:17Due to the nature of that GET function, it gives me those in a return delimited list.
01:23So that is one way to create a list.
01:26We also see GETWindowNames.
01:28This is another GET function that will give me return delimited list of all the
01:32different windows that are open.
01:33So each time you open a window, you'll see that you've got 02_04 - 2,
01:38these haven't changed the name, so I don't have a new name for those.
01:42But if I open these up in a script and I name them something different,
01:46I am going to get a return delimited list of window names.
01:49Also you'll see the ValueListItems.
01:51So I can create what's called a Value List inside FileMaker. Here you see
01:57we've got a Company Value List that points to the field in the customer
02:02table called Company.
02:03Now what we're actually doing here when we use a field to create a Value List in
02:11FileMaker is that we're using the field's index.
02:13So one way that you can extract and work with the index of a field is to create
02:18a value list, in this case the company one I just showed you.
02:21And then what it will do is show me all of the different values inside that
02:25value list, but it's actually showing me all the different values inside that field index.
02:29It's a very valuable tool in case you're ever trying to extract different values
02:33from a field index or even display a field index that's available to you from a
02:38programming standpoint.
02:39Also though you can create lists inside FileMaker by attaching what's called a
02:44checkbox control style to a field.
02:47You'll notice in Layout mode in the Inspector, when I select Preferences, you
02:52see that I've got what's called a Checkbox set Control style; and attached to it
02:57is another value list where I've gone in and typed in the different values.
03:01Value Lists are very common in FileMaker.
03:04And in this case you can see it's used to provide your users with different
03:08options on items that they can select within certain control styles.
03:11Here with the checkbox you'll notice that when I check on something, it
03:15is actually creating in the background a list of values or an array of
03:21return delimited values.
03:22It's the same field, this one just happens to have the checkbox set to it and
03:28this one is just showing me the values inside the fields.
03:31So you can see that as I click these values, they are not only showing up in
03:35a return delimited list, but they are also showing in the order in which I'm selecting them.
03:39So you can use this for Preferences or which items would you prefer, and click
03:43them in the order that you'd prefer them, that type of thing.
03:45So all of these are different ways that you can construct a return
03:48delimited list of values.
03:49However, my favorite way to construct a list of values is to compile a list
03:54using what's called the List function.
03:56The List function really just has one parameter.
03:58So in FileMaker anytime you see those squiggly brackets inside the parameters of
04:03a calculation function, those means that those are optional parameters.
04:07So in this case we could put one field inside the parentheses or we can put a
04:10series of different fields that are all separated by the semicolon.
04:14And we'll take a look at a couple of examples of those. But the idea is that it's going to return a list.
04:19So if you look at some of these examples, they are not too compelling.
04:23For example we could take FullName; Street1; Street2; CityStateZip.
04:27All of these together would give us one big list of really just the same thing
04:31that we're seeing there but return delimited.
04:33Same thing here, if we just did the words Hello and then the word, World, it
04:37would just give us Hello and World with return delimited.
04:41The reason that I like the list function so much is because we can reference
04:44fields or a related field inside the function as my field parameter.
04:49So this will create a list of related values in a parent record that has
04:54related child values.
04:56So it will show you nothing if there are no related child records, let me give
05:00you an example of this.
05:01So if we go back into our file and we navigate over to the Customer record,
05:08you can see that some of the customers have Invoices and some of them do not.
05:17But in the cases of the ones that do have invoices, this is what's called the
05:20customer record and these are called the related invoice records.
05:24We're showing these inside of a portal which is something that you're
05:26probably familiar with.
05:27But what it's doing, it's showing us records from the related invoice table.
05:32So In this case what I could do is I could construct a calculation field that
05:36shows me an array of all the different invoice dates, so I'd get a return
05:40delimited list of invoice dates.
05:42So let's say we'll use that as our example.
05:44So what I want to do is I want to go in and define a field. The list function
05:49concept that I am sharing here with you only works if I'm defining the field in
05:53the parent table in the relationship.
05:55So the parent table is the term that's commonly used to refer to the table that
05:59acts as the one, in a one to many relationship.
06:03And if you want to brush up a little bit more on those concepts, you can watch
06:07the FileMaker Pro 12 Essential Training title on the Chapter on Relationships
06:12or even in the Relational Design With FileMaker Pro Title,
06:16also here in the online training library.
06:18So here I am in the parent, in customers, and I am going to call this
06:22InvoiceDateList, make it a Calculation, hit Create. All I am going to do is
06:30pick the List function and instead of all of these parameters. I am just going
06:38to put one field parameter in it. Not a field from the customer table, because
06:42of course, that would only give me one value.
06:45Instead, I'll go down into a field from the related table, pick Date and so
06:50now even though I am putting one field reference in there, it actually will
06:53represent a return delimited list of all the different invoice dates that I do have.
06:59So if this one customer that we see in the background has two related invoices,
07:03I'll see two dates with a return delimiter in between them.
07:06And this result is going to be text, and we hit OK, hit OK again.
07:12Let's go into Layout mode and drop this one on the layout.
07:23And in InvoiceDateList, I'll go back into Browse mode and you'll see now
07:30that where there are customers that don't have related values, nothing shows
07:34up inside that field.
07:36But in customers that do have related values, you see that it takes the dates in
07:40the same order that we see them here in the portal, and I'll explain that in a
07:44moment, but we see them here with a return delimiter in between each one.
07:48So we can get a list of all the different dates for this particular
07:51customer's invoices.
07:53Now note that the order of the fields matches the order that they are displayed
07:56in the portal, but this is because the relationship used in both the portal and
08:00the List function is one that's called Invoices.
08:04See here Invoices, and you'll also notice in the field that I just created,
08:11I am using the Invoices relationship.
08:14And if we look at the Invoices relationship in our Manage Database window,
08:19that's this one right here, and by clicking on the equal sign in between these
08:23two table occurrences, we can change some of the parameters.
08:26And you'll notice that one of the parameters is that I'm sorting the child
08:30records, or the invoice records by the date.
08:34So when I am constructing a list or I am displaying something in a portal, I can
08:39be deliberate about the order in which these values are going to appear,
08:41because of the sort order inside the criteria of the relationship.
08:45So as you can see, FileMaker provides a bunch of different ways that you can
08:49construct lists dynamically by using the FileMaker Calculation engine inside
08:55of your database.
Collapse this transcript
Parsing lists of values
00:00A FileMaker provides various different ways that you can construct lists or
00:04arrays of data within the FileMaker platform.
00:07Now once you have lists constructed or if you are pointing to lists that are
00:11constructed elsewhere, FileMaker also has mechanisms that allows you to extract
00:15values from those lists.
00:17But the key there is that you should look at the different words in a list as values.
00:22So for example if you look on screen here in the calculation we did in the
00:26previous movie for the InvoiceDateList, each one of these dates is what's called
00:31a value; and really they're just delimited by return characters at the end of
00:35each value, thus showing them in a list like you see here on screen.
00:40FileMaker has a series of functions and these might look familiar to you,
00:44because they are LeftValues, RightValues and MiddleValues.
00:48LeftValues has two different parameters;
00:50the text, and this text of course has to be a list or a return delimited list of
00:55values and then the numberOfValues that you want to extract.
00:58So for example LeftValues from Red, Green and Blue, number 2 it gives you
01:03Red and Green, keep in mind you're also getting the return characters.
01:07And of course if you have another field that you're referencing, in this case
01:11myList, tell it how many different values that you want to extract.
01:15Now Left, when we're talking about lists means from the top.
01:19So in Red, Green and Blue you see that I get the first two values from the top
01:23of the list, or from the left if you just flatten it all out, but if you're
01:27looking at it from top to bottom, it's the top ones. Then in the case of
01:31Right, it gives me the bottommost values, so in this case the bottom two values
01:36are in my list, it gives you the last three values from that list.
01:39There is also MiddleValues, which of course has the additional parameter.
01:43It's the text which represents the list.
01:46Then the startingValue, so if you want to pull the last two you can start from
01:50the second last value and pull a number of two values.
01:53So Red, Green or Blue in the case that I just mentioned.
01:56We would start at the second value and give us two values, that gives me green
02:01and blue for example.
02:02Or myList; 3; 1 returns the third value from the list.
02:05Well let's use these inside of our database.
02:08So let's say that we've got this calculation field here already, but what we
02:12want to do is we want to have another field that just tells us what the oldest
02:17invoice date is for each customer.
02:18This could be very compelling information for us to do searches in the database
02:22and find out if there are customers who haven't placed an order with us for over
02:26a year or a quarter or a week or whatever it is.
02:29So in order to do that we want to isolate from this list of related invoices
02:33what the oldest most invoice might be.
02:35And of course we already talked about in the previous movie how the relationship
02:39that's used between customers and invoices, which is called Invoices;
02:43already has a sort value on here that is sorting the invoices in ascending
02:47order based on date.
02:50So in this case we're going to use LeftValues as a function because we want
02:53to get the top date from the value of the list that tells us what the oldest one might be.
02:58So you can see here the newest one is on the bottom or the right in our list and
03:03the oldest one is on the top or the left.
03:05so basically we just want to extract the leftmost value from this array.
03:08So let's go and create another field in the Customer table.
03:16We'll call this FirstOrder, make it a Calculation and I will find the LeftValues function, there it is.
03:28And instead of text really what we're looking for is which formula will result
03:32in a list or which field contains a list and that of course is the
03:35InvoiceDateList field. I want how many values, in this case just the one.
03:42I would like FileMaker to treat it as a date, so why don't we pull this as a
03:47data and see what we get.
03:48We'll hit OK, we'll hit OK again and now I'll go into layout mode and drop
03:55this field right there, FirstOrder, alright. Let's take a look at what we get in Browse mode.
04:04So now we see that in this record, it dynamically pulls the oldest invoice date
04:10from the list. That of course, is a combination of us creating a list or an
04:14array of invoice dates using the list function and then extracting the leftmost
04:19value from that list, because we know based on our sort order that the top or
04:24the leftmost value is the oldest invoice.
04:26Now we can do searches on date ranges and find out when the first time somebody
04:29ordered what this was, or I could reverse this and find out when the last time
04:34they ordered where this might be. We could create a LastOrder field that just
04:38simply does the opposite. So FirstOrder, Duplicate,
04:48and change that name and all I have to do here is just type in Right, okay.
04:59When I go into Layout mode, now I've got the first time they ever ordered
05:05and then the last time they ever ordered as well.
05:10Both of those I can use in searches. I don't have to go in and manually
05:14update these fields, because if we look at other records in our found set,
05:19it does it dynamically based on the related values in the unstored calculations.
05:23Let me show you some of the other value functions inside FileMaker.
05:28We've got one that's called FilterValues so we show the text that we want to
05:31filter and then the FilterValues.
05:33So in this case what we'll actually get -- we'll return all the items in the
05:37textToFilter that are also in filterValues.
05:40So we'll tell it which ones we want to filter out.
05:42So better example is, here we want to filter out Red, Blue or Green and if the
05:48values that we're planning to say White, Blue and Red, then you end up with Red and Blue.
05:52So we're basically telling it only extract out values that match the certain
05:56criteria that I am providing.
05:57And here there might be a list of fields for Departments, and in this case we've
06:02got one that's called User Privileges (UserPriv) and return a list of all the
06:06items in the Department field that also are items in the User Privilege
06:09(UserPriv) field, so you can compare two different list together and show
06:13which items in a return delimited list each list has in common.
06:17There is also Value Count.
06:19So just like we add length, which counts all the characters or word count, which
06:23counts all the words, this one simply counts all the different values in your
06:27array, whether it's a calculation that constructs a list or a list that you put
06:32in by yourself like the Red, Blue and Green.
06:33There is also GetValue.
06:36Now you may have noticed in the calculation that I had before over in our
06:42database, that I was using LeftValues.
06:44Now I'm getting the date, I am getting the first date which was the FirstOrder
06:48date or the LastOrder date, but I'm also getting the return character after it.
06:51now if that's something that I don't want, because it could be a little bit
06:55sloppy data or if I am not expecting that to be there because it's invisible
06:58to the user, I can instead use this function called GetValues.
07:02let me show you how that might work.
07:03So what you are actually seeing here, you might not notice, but you are getting
07:07the value and a return character after that value, so it's kind of hidden to the user.
07:12But instead what I can do is go into Manage Database and in FirstOrder,
07:17I can instead construct this to say GetValue, which is under the Gs,
07:28and my listOfValues is going to be InvoiceDateList.
07:36And then now I have to tell it which number I want to grab.
07:39So based on the sort order I can tell it I just want to grab the first one.
07:46So now you'll see that we still have the FirstOrder, but it's nice and clean.
07:50I'm not gathering anything in here but you'll see were my cursor goes, I am only
07:54grabbing the value not the return delimited value after it.
07:58So GetValue as an alternative to Left, Middle or Right value will help you grab
08:02the value itself not the return character.
08:04And one last little tip that I'll give you is that if you want to create an array,
08:08like we did with the List function, I could do something like FirstOrderComma.
08:17I could instead of showing a list with the return delimiters, I could instead
08:21show it with comma delimiters; pretty simple, I would just say list and then in
08:27this case I would pick, let's just pick the ID.
08:32But what I would do is I would use another text function that's called substitute.
08:38So here is my List and the search string I am looking for.
08:46You might wonder why there is this return character in FileMaker, right there.
08:51I am going to replace it instead with some other text, a comma and a space and
08:57make that result in text, hit OK. Now let's look at that in Layout mode, FirstOrder.
09:09And we go back into Browse mode and just take a look at that, you'll see.
09:13So there is a way to show a list of IDs and in this case I pick the customer ID,
09:20but we could have picked something more useful, like for example,
09:27something that not every record has in common, how about the InvoiceID, there we go.
09:32So now basically we can create a list and use any delimiter that we want
09:35by substituting out the return delimiter with whatever we want to use,
09:39in this case I used the Comma.
09:41The functions discussed in this movie operate on return delimited lists of data.
09:45Each item in a list is referred to as a value, and return delimited lists are
09:49encountered frequently in FileMaker Pro, so knowing how to manipulate this kind
09:53of data can be very powerful.
Collapse this transcript
3. Calculations: Logical Functions
Reviewing the If and Case functions
00:00Thus far in this course I've used the If calculation function.
00:04And if you've not yet worked with either the If or Case functions, you'll
00:08probably want to review those and you can do so by going to the online
00:11training library and reviewing the FileMaker 12 Essential Training title for more details.
00:16Several of the logical functions, including If and Case, are used for performing
00:21what are referred to as conditional operations.
00:24In other words, the value returned by these functions depends on whether one or
00:27more of those conditions that you specify are true or not.
00:30For example, if such and such is true then return X, if not, return Y. The basic
00:35concept behind conditional function is that you provide a test and if that test
00:39is true, then you get one result, otherwise if it's false, you get another.
00:43So in plain English I like to say, it's raining, I bring an umbrella,
00:46otherwise bring sunglasses.
00:48So if it's raining is the test, umbrella is true, sunglasses would be false.
00:53So the case function, which I have an example of here under Customer Name,
01:00you'll notice that there already is a Case function here. Case function provides
01:04multiple different tests and then a corresponding true whenever one of those
01:08tests comes back with the true.
01:10So for example, here we're saying show in the Customer Name field the Company
01:16value if this is true.
01:18So if the First and Last name fields are empty, then show Company. If this
01:23is false then move onto this test, and so on and so on, until you reach a true statement.
01:28The moment you reach the true statement, the Case function stops processing.
01:33Some of the core elements that we're going to talk about moving forward,
01:36and in the conditional functions, they are really the most useful that
01:39are available to you.
01:40You can use them inside calculations;
01:42you'll use them inside scripts and other areas where you can find
01:45calculation dialogs.
01:46But be careful not to confuse the If function with the If script step, which we
01:51will also be talking about later in this course.
01:53Both are tools that involve conditional tests, but they serve two different
01:56purposes within FileMaker Pro.
01:58The If function evaluates a test and returns one of two possible results,
02:03while the If script step is used for conditional branching within a script.
02:06I'll talk about that more when we get into our discussion on scripting
02:11later in this course.
02:12So again, if you feel like you need a refresher or some more information on this
02:16or if you haven't looked at these at all before, I urge you to check out the
02:20FileMaker Pro 12 Essential Training title in both the scripting section and
02:23calculation section under Logical Functions.
02:26Understanding how to integrate conditions into programming using either the
02:29If or the Case function are one way to really take your FileMaker programming to the next level.
02:34The conditional functions are among the most useful functions available to a
02:38FileMaker Pro developer.
Collapse this transcript
Using the IsEmpty logical function
00:00While conditional functions are among the most useful functions available to
00:03FileMaker Pro developers, another set of logical functions perform specific
00:08tests and return a Boolean result.
00:11These functions include IsEmpty and IsValid.
00:14Boolean results simply mean you will either get a true or a false answer to your
00:19question, so to speak.
00:21With conditional functions you can determine what your test or question will be,
00:25and also what your response will be if true. That's the case in the If function,
00:29as well as the Case function.
00:31With Boolean, in the case of "IsEmpty" or "IsValid" you're simply a going to get
00:36a true or a false answer to your "question."
00:39So for example, IsEmpty tests whether or not the data passed to it is empty.
00:43If you pass it a blank string, it returns of a 1, or a true statement, otherwise
00:48it returns a 0 or a false statement.
00:50Most often this function is used to determine whether not specific fields
00:54have been left empty.
00:55So IsEmpty is commonly used as a test within a conditional function.
00:59Let's take a look in the Manage>Database for example, to show you a field called
01:04Customer Name. I showed this in the previous movie, but what we are going to do
01:08here is turn Customer Name from a Text field into a Calculation.
01:13Now let say for example we need the Customer Name field to have a value,
01:18because we need to print it off into different reports and we can't have it be blank.
01:22But we've discovered that even though we need this field to contain a value that
01:26we get weird different types of information for each customer.
01:29Sometimes we have names, sometimes we don't, sometimes we have companies,
01:32and sometimes we don't.
01:33So this a classical conditional logic and we can address this by using a calculation.
01:39So let me first change this to a Calculation field, and by the way this will
01:45blow out any data that was in the field prior to this,
01:49now that I am turning it into a calculation. Anytime I am using a
01:53Calculation, it's just going to show the result of whatever formula that I'm adding.
01:56So the rule here that we will employ is, if both the First and Last name fields
02:01are empty, we will display the Company Name field value.
02:03So for example, if we don't have a Contact to show the Company Name.
02:07But if only the First is empty, then display the Last name field by itself, otherwise
02:11if the Last is empty, we will display a First name field value.
02:14I'll go over all these again, but the idea is we are adding all these different
02:18conditions, and of course, some of them we would rather see happen.
02:21So if we have both the First and Last name fields, that would be great.
02:24If not, then we'll go to Company.
02:25So there's some logic to the order of which were putting these conditions
02:28into our Calculation.
02:31This is a classic conditional argument and it also has multiple tests.
02:34So what we are going to use is the Case function here to accommodate our
02:37multiple test, because of course, the only other alternative to put a condition
02:40into a calculation is the If function, but that only allows us one test.
02:45So let's put a Case function in here. A lot of optional information in the
02:49Case is not necessary, so, we'll just open up the parenthesis and give
02:54ourselves a little bit of space to work with. So now on the first line what
02:58I am going to do is put in our first test.
03:00So based on the rules that I mentioned before, I am going to use a function
03:04that is called IsEmpty. All it does is ask whether or not the field that
03:08I reference using this function or this parameter in the function, is empty or not.
03:12What I can do, is I can include more than one field if I would like.
03:16I can say First and I'll concatenate (&) that with Last.
03:21So really I am creating a concatenated field with the two together, but I'm
03:25really asking it, are both of them empty?
03:28So if I combined the two together and it's still empty, that means that both
03:30fields are empty, that's the logic that I am using here.
03:33So that's our test. If these are in fact empty, then based on the rules
03:38I indicated earlier, we are going to show the value in the Company field.
03:42So if this will say Scott or Lightningfast, it will show Lightningfast Racing Co.
03:46So that's our first test and our first true. I am going to put at the end of that line the semicolon (;)
03:52so that it delimits where I am going to next test.
03:55In the Case statement -- and this is important to understand -- the case statement will
03:59only evaluate the second test, if the first test is false.
04:04If the first test that I have was true then it's just going to stop evaluating
04:08and it's going to show whatever we've told it to show when it's true.
04:11But in this case what I'm doing is I'm writing something that'll happen if it
04:15determines that the first test is false.
04:17So with that in mind I want to provide all possible scenarios as a test.
04:21So the next one that we are going to do is see whether or not the First or Last
04:25name are empty, and if so, provide a different value.
04:28So for example, if the function already passed IsEmpty First and Last, that
04:32means that those two are not empty, so I have to determine which one of the
04:37two is in fact empty.
04:38So let's use IsEmpty again, and we will say IsEmpty First, and if that's true,
04:45then let's show Last name field.
04:50And if that's false, we will go down to the next test. We will just switch
04:57them up, we will say if the Last name field IsEmpty, show the First.
05:03It might seem like we're getting a little redundant here, but this is what we
05:06know by the order of operations. We are doing this on purpose.
05:09We are saying, if these fields are empty, so we know for sure that the fields
05:13aren't empty if you make it this far.
05:15Now we are checking to see if the First name field is empty.
05:19But if this is true, and this is true, that means that the third one has to, in fact, be true.
05:24So the order of operations are very critical here. We've selected the tests
05:29in a specific order on purpose. So the first one we're saying if both of those
05:33fields are empty, then put in Company.
05:35But if both of them are empty that means that one of the two of them isn't,
05:39so that's what the next test is all about.
05:41Is the one that's not empty the First name field? If so, put in Last, otherwise
05:45if that's also false, then we can narrow it down to saying, all right, the one
05:49that's empty is clearly the Last name field.
05:51If it makes it past this, and we get another false, that means that both the
05:55First and Last name fields are in fact populated.
05:59So in that case I can say First and concatenate (&) that with a space
06:08and then say Last. I can cap that off and if I would like to just put a default in
06:15there, we will just say, just show nothing in that case.
06:18But here our logic makes sense, so we say these are empty. If not, put in
06:25Company. If they are empty, which one is empty? Is it that one that's empty? No.
06:28Is it that one that's empty?
06:30If neither of those two are empty, then we will show the values of both of those.
06:34So pretty simple concept there; good example of conditional branching.
06:37Let's take a look at how this works inside of our database.
06:40You see I have got the Customer Name field there.
06:44In this case I have a value in both of those fields.
06:47So I don't have to worry about it. Here's one where -- let's say if I just got
06:52rid of Company Name or a First name for example, it's just going to show Last
06:59name, but if I get rid of the both of them, it'll show New Customers.
07:03So that follows our rules just like we set up in the system.
07:06So we can see that when we're using conditions inside of our calculation formulas,
07:10that the IsEmpty function can be a very useful test,
07:12because it provides you with a true or false answer.
Collapse this transcript
Using the IsValid logical function
00:00We talked about in the previous movie how a Boolean function like the IsEmpty
00:05function can be very useful inside of something like an If or Case conditional
00:10function as the test parameter, because Boolean functions give you a very
00:14true or false answer.
00:15There is another one I'd like to take a look at, which is called the IsValid
00:19function and it does something very similar.
00:20It, too, is a Boolean function, and at first glance it may not seem as useful, but
00:24it does have some powerful hidden values.
00:27First let's take a look at what the IsValid function is. IsValid;
00:32its purpose is to return a (0) or False, if the data is invalid, and a (1) or
00:38True, if the data IsValid.
00:40So for example the Parameters are just going to be the field that we want to
00:44check the validity of. And what it's intended to be used for is really driven by
00:50what an invalid value is.
00:52So for example if a record contains an invalid value, because of the field type
00:56mismatch, for example, like if you put a number field into a date field or
01:00something like that;
01:01or if you put bunch of text characters into a number field, or something along
01:05those lines; or if you're referencing a field that's in a calculation reference
01:10and it can't find it; or it's been deleted from a related table.
01:13Any of these things it will return a zero (0) or false, otherwise it returns a true.
01:18So if everything is okay as far as the format of the data and the references of
01:22the data, if everything is okay, it returns a 1,
01:25otherwise a 0 of it's false.
01:27Now sure, you may not find very many uses for whether or not the value inside a
01:31field is a valid format.
01:32But when you're looking in the context of a parent record, and a parent record
01:37just as a refresher, is a table in a relationship has either a parent or child
01:42side, meaning the parent is the one, the child is the many so, any record in any
01:45of those tables is either a a parent record or a child record.
01:49So if you're defining a calculation in the context of a parent record, it can
01:52be extremely useful to determine whether or not any related records exist.
01:58Let's say we want to create a field in our customer table that tells us whether or
02:02not a customer has any related Invoices.
02:03This can be very useful when it comes to scripting, or we just might want to be
02:07able to do one simple search to determine whether or not a customer has any
02:11Invoices at all, so to do that we would create a Calculation field.
02:16So let's go into File>Manage>Database and we are going to use a Conditional
02:20function, the if function in this case, because we will only have one test,
02:24that's, does this customer have any Invoices, yes or no?
02:28So we'll do one thing if it's Yes or True and another thing if it's a No or a False.
02:32So what we'll do more specifically is create a field called ActiveInvoices,
02:40make it a Calculation and we are going to choose the if function.
02:44By the way you don't have to double- click from the functions list, if you know
02:50the different parameters involved, you can just type the function name.
02:54So I've got if, and so what I really want to say here is, if the related
02:58field IsValid or if any one of the related Invoice fields are valid, then that
03:03means that this client has Invoices or we'll them Active, and if not they are Inactive.
03:09So the trick here is to pick a field that we are going to use in our IsValid,
03:15so there's IsEmpty, IsValid.
03:17So the trick here, we are in the context of the Customers, so we are in the parent table.
03:22We want to pick a field from the related Invoices table that we know will
03:26always have a value.
03:28So whatever a nonempty field that it is going to be, so, we know that there
03:32will one field that will always contain a value in that case.
03:35And that field is the foreign key value, so inside Invoices, if the Customer
03:40foreign key value contains a value, then we have a relationship.
03:44If there is no related values that means that no records have the InvoiceID in
03:48the CustomerID field.
03:49So the trick here when I'm picking the field is to pick a field in the
03:53related child table, which is the Invoices table here that we know will always have a value.
03:59If we use our principles of relational databases, we know that the foreign key
04:03field will always have a value if a related record exists in the child table.
04:08So in that case, in the relationship between Customers and Invoices the
04:12_CustomerIDfk field is the foreign key value.
04:16So based on that principle, if there's related record, this field will have a value in it.
04:20So I am simply going to say if IsValid, and then I am going to point to that
04:25field that I know will never be empty.
04:27And I am going to say in that case, put the word Active, otherwise, in the case
04:34of the False, we will say InActive and this will say we want Text, we'll hit OK,
04:41we'll hit OK again and I am going to go into Layout mode and we put this field
04:45on the Layout, right there, ActiveInvoices.
04:50And let's go back to Browse and take a look, sure this one has related
04:54records, that's correct, this one does too, this one does not, that one does not, and so on.
05:00By the way this technique is also widely used with the if script step, prior to
05:04running a go-to related record step.
05:06And the reason for that is because you don't want to go run a script step
05:09that requires there to be related values. So you could do this in any context that makes sense.
05:14You could use this technique anytime the next action you're going to perform
05:17requires that there are related values in the child table.
05:20So you can use this as your test or your condition to determine whether or not
05:24that action happens.
05:25So becoming familiar with the IsEmpty and IsValid functions can prove to be
05:29very useful as test parameters in all of your conditional functions
Collapse this transcript
Using the Let logical function
00:00As a trainer I am commonly asked what does the Let function do?
00:04The Let function is something that you'll run into if you're looking around in
00:07databases that have been created by someone else, or even starter solutions or
00:10in other training materials.
00:12And the answer really is that it doesn't do anything. The Let function is a
00:15unique function that actually doesn't add any additional programming features
00:19to your calculations.
00:20But rather creates an environment within the calculation, or the calculation
00:24dialog window, where you can declare variables and those variables can be used
00:29elsewhere within the calculation itself.
00:31Now what's the purpose of something like that?
00:33Well, if we look at Let function, we can see that all the Let function is
00:37is that inside the brackets you see there, you will declare these variables and
00:42then you just run a calculation formula.
00:44So whatever calculation formula you write in the second parameter
00:48calculation, it'll run that.
00:50But the nice thing about it is, if you look at this example here, I can say I'm
00:56going to declare a variable and a variable can be anything.
00:58A variable can be any word that you make up or series of characters, or whatever
01:02it is that is not already being used by FileMaker somewhere.
01:05So it can't be a field name, or function name, or a logical operator or
01:09something like that.
01:10So when we look at CurrentDate or curDate that's just a term that we made up.
01:14We can declare it by saying what does it equal?
01:17Well, it's going to equal whatever the result of the function
01:21Get (CurrentDate) might be.
01:22So the same with mo, it is going to use the CurrentDate function.
01:26So you use see that if I have already declared a variable, I can then use that
01:31in another calculation function.
01:32So, mo=Month of the CurrentDate, yr=Year of the CurrentDate and so on.
01:37The reason we do that is because we'll write a formula, Date ( mo ; 1 ; year ).
01:44So here what we've done is declared all the variables and then we have used the
01:47variables mo and yr down below. This will of course return the date of the
01:53first day of the current month.
01:54So, I'll look at another example, because another real use for Let functions is
01:58because nested functions, or the alternative to writing a Let function can be
02:02very difficult to write visually and tough to see.
02:05So for example, let's say we've a function here where we're declaring three
02:08variables: one is called add, one is called len and one is called comma; and
02:12each of them are declared as a formula.
02:15The Trimming of the address field, the Length of the Address field, or the
02:19Position of the comma (,) for example.
02:20And then when we close out those declared variables, we run the Calculation
02:24formula, which is just Right (add ; len - comma ).
02:28And what that's going to give us, it's going to return everything after the
02:31comma in the Address field.
02:32We are actually going build something like this into our database is just a
02:37second, but the idea behind this is the alternative can be very difficult.
02:40So you see here, we have got Right and then Trim (Address) and the semicolon,
02:44Length Trim Address minus Position, Trim Address and so on and so on.
02:47But the other interesting advantage here is that when you use a Let function and
02:52you declare variables, so in this case, we declared the variable add, it equals
02:58the Trim Address functions.
02:59So we take the Trim function, we put the Address field in there.
03:02Now this Calculation below, if we wrote it like that, we are going to get the
03:06same result as we get, if we write it with the Let function on the top.
03:10But the advantage is we're only processing the Trim function against the
03:13Address field one time in the Let function above, on the bottom it's happening three different times.
03:19Now this can get very unwieldy and provide a lot of overhead and potentially
03:23processing overhead if you're maybe processing that 50 times in a calculation or
03:27something like that, or even three really makes a difference.
03:29So let's take a look at how we might actually write this inside of our database.
03:34So here I am in the exercise files, and you notice that I've got an Address 2
03:38field. Let's say we've got some kind of garbage data and either users entered it
03:42in this way, or we got it from another source where there is a comma and
03:45then it gives, like in this case, Suite 4, or Second Floor, or something like that,
03:49that's stuff that we want to have in this other field.
03:52So, let's say I go into Manage>Database and I go into Address 2 --
04:00Sctually let's create another one, we're going to call it TrimmedAddress,
04:06create a Calculation field and hit Create.
04:09So we could write this formula as Right(Trim(Address); Length(Trim(Address))- Position
04:28So you can just see even writing this, it's a lot more potential room for error.
04:33And we can leave this as a Number or Text in this case.
04:44So you see we have got a little bit of error here. Oh, I need is Address 1.
04:48Okay, now I got to change that three different times. That's fine, I mean it's
04:53hand typed. This I could have avoided just by double-clicking on these values of course.
04:57But will the function not perform properly? Well, I'll go and make my changes.
05:03And, here we go, we see there is another area.
05:06Again, those could have been easily avoided.
05:09But in this case I could go into Layout Mode and I could pick TrimmedAddress here
05:18and we get the value that we were looking for.
05:20But the alternative to this, using the Let function by going here, let's say I
05:26knock this down -- and one thing I should tell you is that you can comment out
05:30different lines in your Calculations.
05:31So by the way if it's all one line I can o slash (//) and comment that out.
05:36So I can leave it here and it's a good idea by the way if you're updating
05:40calculations kind of drastically, maybe leave the old calculation there, just in
05:43case you need to revert back.
05:44And by the way I could either do slash slash (//), or slash asterisk (/*)
05:50if it's more than one line, and then close it out with asterisk slash (*/).
05:54So, a little sidebar there on how you can comment these out.
05:57So let's comment out the old one. Let's create the new one and I am going
06:01to declare a Let function first.
06:04So Let function, and we will get rid of all the stuff, okay.
06:11So first let's open up the bracket and declare our first variable.
06:16Our first variable is going to be called add and that's going to be
06:21Trim(Address 1), so I only have to do that one time, and I'll separate that
06:27with the semicolon (;)
06:28then we will say, this next variable I am going to len, len= and then that's
06:32just going to be the Length function.
06:35And I am going to use the, add that I declared here.
06:40So, the order, if I would have done this one first, it would be confusing,
06:44so I have to declare it first before I can use it.
06:47So hopefully that makes sense.
06:48Then the last one is comma and that will equal the position of add
06:59we were looking for comma, the first occurrence, and so now let's close our brackets
07:07out and add our semicolon.
07:10So now we want to have our formulas. So our formula is going to be
07:13Right(add; len-comma). Let's close this out and see if we get any issues with it.
07:24We need to close that line out first, so here we go, see that we get an error in that case.
07:30So what we need to do is get rid of, here we just need to get rid of that, okay.
07:43So now when we close this out, you see we get the same value, little less
07:51overhead from a programming standpoint. We do get the same value, it's a little
07:56bit easier for us to look at and work with,
08:00if we need to. As you can see, as opposed to the other one, it's all nested, cleaner.
08:04This isn't as dramatic as if you get into Calculations that could be
08:08three or four pages long. Then organizing it differently in the Let function has
08:12a pretty dramatic effect.
08:13Although Let functions do not add any additional functionality to your
08:17calculations, they can make nesting functions significantly easier to write and
08:21even reduce processing time and allow you to set different variables that can be
08:26used within the Calculation itself.
08:29So Let functions don't do anything, but they certainly do make things easier to work with.
Collapse this transcript
Using the Self logical function
00:00The Self function is unique function that has somewhat limited use, but it's
00:04really good to understand how it's used.
00:07Now by definition, the Self function returns the content of the object in which
00:12the calculation is defined.
00:14Now this is -- got some very specific use, mainly with conditional formatting.
00:18The most common place that you'll see it is in Layout mode.
00:23You grab an object, let's right-click or Ctrl+Click on this object and say
00:28Conditional Formatting.
00:29Now this is where you may have encountered the Self function, because you'll
00:33notice when you add something and you change it over to formula, this is where
00:37Self function appears.
00:39And really this might be one of the few isolated areas where the Self function
00:43actually makes sense, because inside this formula, you could reference the
00:48Layout object or the field in this case, within the formula.
00:53So you could say for example, if the Grand Total field is empty then make
00:57the Text Color red.
00:59Now the option that you have there is to actually implicitly say the Grand Total
01:03field in the formula or you could just use Self.
01:06So self means me, or the object in which I am.
01:10This is the Grand Total or Self.
01:13So let me give you an example of this.
01:15So for example, let's say we want to create a formula that says if the Grand
01:20Total field is greater than or equal to 500.
01:27So I could say the Grand Total field, Invoices Grand Total if I wanted to,
01:33or I could just say Self. Self is greater than or equal to 500.
01:37So let's say if it's greater than or equal to 500, we'll make it green and bold.
01:42Let's take a look at what that might look like in browse mode.
01:46So here you see that it works.
01:48It's the two that are above 500 are bold and in green. We'll do another
01:54example in the upcoming chapters in the course where we show Conditional
01:58Formatting, but this one is a real simple one.
02:00If the value is greater than 500, apply bold and green.
02:03Now what's the advantage of using the Self function over just implicitly
02:06referencing the Grand Total function?
02:08Well, if we go back in the Layout mode, you'll see.
02:11So now, let's say I've got this Grand Total field, which is in a different
02:16occurrence of the field I should say.
02:18Here, I'm going to copy it.
02:21And you'll notice that when you copy a field in FileMaker, it carries with it
02:28the format, the size of the field, the value that it has been referenced and
02:32you'll also notice by these little diamond shape called Badges in FileMaker
02:38Layouts that it also inherits the custom value.
02:43So now you'll notice it also inherits the conditional formatting and so you'll notice,
02:49when we go in the browse mode that that's the same field in a
02:54different relationship, so a different related field, and it still carries with
02:57it that same formula.
02:59This will be a completely different relationship if I wanted it to be and I can
03:02still apply the conditional formatting.
03:05So the idea is, when you reference Self that means that then the formula will
03:09reference whatever object that it's applied to. So I could have five or six
03:13different fields on this layout and I could just drag copy each one of them and
03:18in each case it would apply the if the value inside me or the field to which
03:23it's referenced is greater than 500, then apply this.
03:25So it's just a real nice and clean compact way to write a formula almost
03:29specifically in a conditional formatting environment that then can be copied and
03:34applied to other fields without having to go in, of course, and change the field
03:39name that's referenced.
03:40We could've said in this formula, the Grand Total field; I could have wrote
03:45that in, but then if I copy this to the Subtotal field instead, I would had to
03:49go back into the Conditional Formatting and change it from Grand Total to
03:54Subtotal, instead, I just say Self and I can copy and apply that formula all over the place.
03:58So the Self function is very useful when defining formulas for conditional formatting.
04:02It returns the content of the object in which the calculation was defined and
04:06you could use the Self instead of implicitly naming the object that you want to
04:10apply conditional formatting to.
04:11So it allows you to copy the formula quickly to other objects and lets you
04:15reuse that same conditional formula elsewhere on the same layout or even other layouts.
Collapse this transcript
4. Other Uses of the Calculation Dialog
Working with calculated replaces
00:00Understanding calculation formulas can arguably be one of the most useful skills
00:04when working within FileMaker Pro.
00:07This is not only because of creating calculation fields, but because the
00:10calculation dialog can be found in several other places throughout the
00:13FileMaker Development experience.
00:16In many cases it performs a logical check to determine if a condition is true or
00:19false which is often referred to as a Boolean operation.
00:23In other cases, it generates a result that is then used internally by another
00:27feature in FileMaker Pro.
00:29In this section I want to take a look at the different ways that FileMaker can
00:33use calculation dialogs and try to demonstrate to you how useful understanding
00:38FileMaker calculations and formulas can be.
00:40So the first place that we're going to look at this is and what's called a Calculated Replace.
00:45Now first of all that's kind of an official term, but what's really
00:48happening here is there's a function in FileMaker, you'll notice, if you
00:51click inside a field like Import Source, you go under the Records menu, down
00:55towards the bottom about three up from the bottom is something that's called
00:58Replace Field Contents.
01:00Now this is something where you can create a Found Set of records in your
01:04database and click into one of them and you've a few different options here.
01:08You could replace all of the 1524 records in the Found Set with that value
01:14that's in the first record, or I could serialize them by starting by a value
01:19that I provide and incrementing by another value, or I could do the third
01:24option, which is Replace every record as I go through all these 1524 records,
01:30evaluate some formula that I write inside this Specify Calculation dialog and
01:35then insert that into the record.
01:37So I can do a batch update of a bunch of non-calculated fields by applying a
01:42calculated formula to each of the records in a Found Set.
01:45So this is a Replace Field Contents operation, but I'm using the calculation
01:49option and that's commonly referred to as Calculate Replace.
01:54So let's try an example of calculated replace.
01:57Say for example, we were given this database and when we imported the data in
02:03and this is actually kind of a common thing that happens.
02:06The data that was provided to us has the City a comma, the State and then the
02:11Postal Code all in one field.
02:14And what we want to do is parse it into its own individual fields, which is more
02:18normalized, more useful to us from a data management standpoint.
02:22But what I'm going to do is I'm going to come up with a calculation formula and
02:26I'm going to use it in the calculated replace. The advantage there, instead
02:30of creating a calculation field, is that once the calculated replace is done,
02:34it's gone and evaluated all these records.
02:36Then the field is just a regular text field.
02:38So I could go in and update the city if I get more information on this client
02:41or change some values or do whatever I want.
02:44So of course, I could easily just go in and create a calculation for this
02:48City field right here, but then users can't click inside of it and they can never change it.
02:52So that's one of the big reasons why a calculated replace might be more
02:56advantageous than creating a calculated field.
02:59So in addition to normalizing, we're also going to put everything in its right
03:02spot and allow it to be updated in the future.
03:04So how we're going to do that? First, let's start with the City field.
03:07Again, I'm going to perform this Calculated Replace against wherever the Found
03:11Set is, so let's say I just create a Found Set of All the records in the entire database.
03:16We'll go to the first one.
03:18I'll click inside the field that I want to perform the calculated replace within
03:22and I'll go under Records, to Replace Field Contents and I'll choose the third
03:27option, thus invoking this Specify Calculation dialog.
03:31You'll notice it's not exactly like the calculated field dialog, because we
03:35don't have any options below here.
03:36We can't choose what the result is going to be, because there's already a field
03:40that we're putting data into and that field already is some data type.
03:43In this case, it looks like it's a Text field.
03:46Also, there are no storage options, because this isn't a calculated field, so
03:49there is no storage issues involved.
03:51We just have to use the dialog to create a formula.
03:55So what we want to do here is create a formula that's going to extract the City
04:00name out of the Import Source field. And that function we're going to use in
04:05that case, let's use the Left function that we used earlier in this course.
04:10So say, click in there and do L, we go to Left and the text that we want to
04:17extract the left value from is this one called Import Source, the one that
04:22we can see down here.
04:25So Left Import Source and what we want to do is pull whatever
04:29numberOfCharacters are in that formula that come before the comma. So let's find
04:37the position of the comma, of course, we did all this earlier in the course.
04:42So the Position of Import Source and the searchString, it's going to be the comma.
04:54Let's start with the very first character, and we want to find the very first
04:58occurrence and we don't want it to include the comma, so I'm going to move it
05:03over 1 position, give me everything to the left of the position of the comma
05:08minus 1. So in this case, it would give us all of San Francisco, but not including the comma.
05:13So I'm going to wrap that up with a closing parens and let's see what we get. Good!
05:19Tells us that we need to check our Import Source so, we'll double check
05:23everything and there we go.
05:27We get rid of one of those, perfect. Now we're all set.
05:30Thank you FileMaker, checks our syntax. Now here's the thing.
05:32Before you go ahead and hit Replace, you should know that there is no undo for a replace,
05:37or more specifically, a calculated replace.
05:39This is a good time to mention that because it's probably a good idea
05:43when you're testing these things out to first of all test your calculated formula
05:46inside of a field or if you've got a copy of FileMaker Advanced you can
05:50use a data viewer or you can certainly just create a backup of this and try it on the backup.
05:55So we are confident that our calculation is correct so here I'm going to say Replace.
05:59And now, you'll see what it's done, pretty instantaneously,
06:02it's gone through all the records in our 1500 record found set and it's
06:06extracted out either the one word or two word, City name from all the records in
06:11the entire found set.
06:13That one was pretty easy. Let's go ahead and do the State.
06:16State, same thing click inside the State, go to Replace Field Contents and in
06:21this case, we're going to use Middle.
06:23And again, this is the formula that we used earlier in this course.
06:27So we're going to say in the pull from the Import Source, starting at the let's
06:39say the Position, and in this case, we're also going to be looking for the comma.
06:47So we'll say Position(Import Source;
06:51let's look for the comma and we want to find the first occurrence of the comma.
06:57Start with the first character and do the first occurrence.
07:00But in this case, what we want to do since we're using the State, we want to not
07:03include the comma and not include the space next to the comma either,
07:06so here I'm going to do +2 characters.
07:11So Middle(Import Source; Position(Import Source
07:16all the way through number 2 How many characters do you want to extract?
07:23Just the 2, because every State abbreviation is going to have two characters
07:27and we close that up. So, let's check our syntax, looks good.
07:31And we run that calculated replace.
07:32And again, what's nice about this is that we can go in here after the fact and
07:36make a change if we'd like to.
07:38So it's not a calculated field.
07:40It's fully editable.
07:42So it's really good for like a one time data cleanup for example.
07:45And finally, we'll do one more of these just for posterity.
07:49This one is much easier.
07:50We can just say Right(Import Source:
07:56and we'll pull in 1, 2, 3, 4, 5 characters and run that against our Found Set.
08:06So Calculated Replaces let you use the power of the FileMaker calculation
08:09engine to apply a formula across an entire Found Set of records without
08:13having to create a calculated field, which of course, your users can't edit
08:17or update in the future.
08:18So you're left then with an editable result that does not have the restrictions
08:22of a normal calculated field.
Collapse this transcript
Using calculations for the Auto-Enter and Validation tabs in the Field Options dialog
00:00Another area where you will see the FileMaker calculation dialog is
00:04under field options.
00:06Of course we define our fields under the File>Manage>Database section.
00:10And if you look into any one of the fields that are already defined, you'll
00:13notice that there's an Options button that appears.
00:16And if you're just defining a field for the first time, you have to create it
00:20before the Options button will appear.
00:21Now when you click on the Options button, you'll notice that there is a
00:25Calculated value option here under Auto-Enter and also under Validation.
00:31A field set to Auto-Enter using a calculated value differs in many regards from
00:35a calculation field and we can see that difference when we hit Specify, because
00:39in the Specify Calculation dialog that appears here, you see we don't have
00:43options down here for which type of value is going to be stored.
00:48It's just going to take on whatever the field type is from the field that we're
00:52configuring options for.
00:53And then also, there's no storage or any other options like that.
00:57The same is true in the window that appears for Validation.
01:01In the case of Validation, this is one of those Boolean calculation dialogs.
01:05So the statement that we're going to create here is either going to be true or false.
01:09And if it's true then it passes the validation rule.
01:12If it's false, it does not, then an error shows up.
01:15So let's look at a couple of examples of these two things.
01:17First in Auto-Enter, now, just as a refresher the Auto-Enter option is intended
01:22to automatically enter a value into a field whenever a record is created.
01:25Now the only field option here in the Auto-Enter tab that performs a little bit
01:29differently is the Calculated value option.
01:32So let's take a look at that.
01:33So let's say for example, you're having trouble with users putting leading or
01:38trailing spaces in the Company name field during data entry.
01:41They are copying and pasting from another form or they're just sort of doing
01:46something on the keyboard that's putting in leading spaces at the beginning or
01:49the end of the Company field and that's throwing off some of your reporting or
01:53searching, it's just way that the data looks.
01:55So what we can do is actually set up an Auto-Enter calculation to take the data
01:59that the user is entering into the field and performs a function against it and
02:03then save the data to the field after it commits.
02:06Nowthis is a concept of commit, if you are not familiar with commit.
02:10Although it appears that FileMaker automatically saves anything that you type
02:14into a field, as you'll notice here.
02:17You click into a field and go ahead and type something.
02:20No message pops up that says, Do you want to save.
02:23Well, that's because FileMaker automatically commits these values.
02:26That's what saving is in FileMaker.
02:27However, FileMaker doesn't commit until you perform some type of commit action.
02:31The most popular commit action is to click outside of a field and that
02:34will perform the commit.
02:36But what's interesting is that there is a brief moment in time in between when
02:40you type something into a field and when it actually gets committed to the
02:44database that that data can be manipulated.
02:45And one of the ways that we can do that is under the Auto-Enter Calculation.
02:52So any formula that I write here will take the data that the user has typed
02:56into the field, then perform this function against it before it commits it to the database.
03:02So this is a great way for you to capture stuff that's being data entered.
03:06Change it or manipulate it or filter it or apply some rules to it before it gets
03:10saved to the database.
03:11So this gives you complete control over the format of the data before it hits
03:14the database so, let's try this out for a second.
03:17So we open up the Company field here as you see on screen and this is the field
03:20that we're allegedly having problems with leading or trailing spaces.
03:23And we see that the result is going to have to be Text and that's because,
03:26the Company field as you see down below here is already have been set up to be a Text field.
03:32So I'm going to pick a calculation function that's called Trim and Trim is
03:36really easy one, it just has one parameter in it and that's the Text field and
03:40so what it does is it trims leading or trailing spaces off of the data.
03:44So what I'm going to do though in the text parameter, I'm going to pick the Company field.
03:49Let's pause for a second because this might seem a little strange.
03:52Nowhere in any of our calculation dialogs when we're defining fields for
03:56example will we use the field itself in the formula.
04:03But since we're talking about Auto-Enter calculation, I can use the Company
04:06field in the formula for the Company Auto-Enter. The reason for that is
04:11usually where we put a parameter in here for text, it's either going to be a
04:14formula that results in a text or a field, and it's very common to use fields in
04:18calculation formulas.
04:19Usually that acts as a placeholder for the value that gets entered into the field.
04:24That's what we're doing here.
04:25So instead of the Company name being the Company name value that's already in
04:30there, we're going to say trim the value that the user types into the field
04:34before it gets committed to a database.
04:36That's really what you're doing when you're referencing the field in its
04:41own Auto-Enter formula.
04:43So right now this formula simply says take the value that the user typed
04:46into the field, trim any leading or trailing spaces on it and then commit it,
04:50it's really that easy.
04:52So we hit OK and now, you'll notice there's one more option here and although,
04:57admittedly it's not very clear, it's a bit cryptic as to what it actually does.
05:00It's key to this technique actually working.
05:03This option Do not replace existing value or field if any,
05:08is currently unchecked. By default, it is checked.
05:11And when it's checked, it means that whatever formula we put in there, will not
05:14be performed against the data that the user entered into the field.
05:19So what we want to do is uncheck that, so it's the combination of picking
05:22calculated value, putting in the formula, referencing the field, referencing
05:26itself and then unchecking that Do not replace existing value field if any.
05:32So now, let's look at that in action.
05:35So here I'm going to click in, I'm going to add a bunch of trailing spaces.
05:39And of course, I haven't committed this to the database yet, so now I'm going to
05:42commit by clicking outside the field.
05:44So what it's actually done is then take the value that I typed in, perform the
05:48calculation function against it, which we can see the evidence of that here,
05:51is that I don't have trailing spaces after that s, and then that's what gets
05:54saved into the database.
05:55So instead of trying to train your users not to do things like add leading
05:59spaces or trailing spaces or whatever, you can just grab the data, do the clean
06:02up for them and let them type wherever they want in there.
06:05This same formula can be applied using a Substitute function, where you can
06:10substitute return characters or specific values that you don't want entered
06:13into the field with blanks or you can do a Filter function where you can just
06:17say the entire alphabet ABC, all the way through Z and then numbers and avoid
06:23special characters.
06:24So you can just use Trim, the Filter function or Substitute to perform the same
06:28task here to clean up that data that gets entered into the system.
06:32Another way to prevent data from entering the system of course is in the
06:35field Validation options.
06:37You'll see that here under Options again, in the second tab called Validation.
06:43Nowthe option to choose a calculated formula to help you validate is really
06:48just saying use the calculation dialog window to create a statement that will
06:53either be true or false.
06:54That's of course indicated by where we have the calculation result must be
06:58Boolean down at the bottom left-hand corner.
07:00Now it the statement is true, then this passes muster, and we allow the value to
07:04be entered into the field.
07:05If it's false, that means it doesn't pass muster, we have to show an error and
07:09tell the user that this is not an acceptable entry and they have to change that
07:13in order for the validation to pass.
07:15So let's take a look at this technique by applying a calculated validation to
07:19the Phone Number field making sure that the user enters the correct Phone Number format.
07:24So you'll notice that we've got a Phone 1 and users are entering in various
07:30different formats and we want a consistent format.
07:32So let's say we've come up with a series of rules where we need it to be
07:36certain length and we need there to be the dashes in there.
07:39We can't have slashes all that type of stuff.
07:41So we're going to create a customized field validation for it.
07:44So we go to Phone 1.
07:45We hit Options and we don't see anything in here that's specific to how many
07:49dashes there should be or maybe maximum number of characters, but not minimum
07:52number of characters or the exact number of characters.
07:54So we're going to use the Validated by calculation option instead.
07:58So since the calculation result is just going to be true or false, I can add
08:02something like let's say Length.
08:04The length of this field Phone 1 and here I'm again referencing the field inside
08:12the Calculation dialog window for field options.
08:16So I'm going to say field Length is going to equal 12.
08:20Now I could just leave it at this and we can test it out here, you'll see, I say
08:25OK, we go in and I say 1, 2, 3, 4, 5.
08:28I click outside the field and it tells us that something did not pass muster.
08:33We could use a customized message there if we'd like to, but if I go back to the
08:39Phone Number, I can now add additional rules.
08:43So I can say the Length of Phone 1 must be 12 and how about PatternCount.
08:49Remember the PatternCount function of this same field again.
08:56Let's say we want to make sure that there is a dash, or actually more
09:03specifically, we want two dashes, so let's say, =2, so we want to type in 12
09:08characters, but we also need to make sure that at least two of those characters
09:11are a dash and you'll see that here as well.
09:15So we could say 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12.
09:16There is 12, but still it doesn't pass because there are no dashes in there.
09:24So I could add a couple of more these as well, just to kind of show you that
09:28all you have to do is add the "and" any time you have a Boolean like this.
09:32I can just simply add the "and" operator and that's the logical operator that we
09:37see here in the middle.
09:38And I can add as many of these as I'd like, so another one would be the
09:43Position of the dash.
09:44So if we say Position, Position in Phone 1, searchString is going to be the dash.
09:54So we're saying not only do we need two dashes, but they need to be in a specific spot.
09:59So say, 1, and again 1 here, so that position will need to be 4.
10:09And we could actually do the same thing again.
10:14And by the way these are pretty legit phone formatting options, so feel free to
10:20use this in your own databases.
10:22But here the second occurrence, so that's where the number 2 is there, needs to
10:27be in the 8th position and then finally, we'll use the Filter function to make
10:33sure that only numbers, so textToFilter that's going to be Phone 1.
10:37And then the text itself will be just 012345689 and a dash of course, because we
10:46are requiring dashes and so we don't want to filter those out. There we go.
10:50And that needs to equal, once we filter all that out, that's got to equal the value in Phone 1.
10:55So all of this we'll add and then we could even do custom message that
10:59explains that you need 12 characters and that you need to have it formatted a certain way.
11:04You could say Must Format as "XXX-XXX - XXXX" and so, this way then the users
11:18would get a little bit more information. Say Ah! Yes, okay.
11:21So here I'll say, see if that passes, sure enough it does.
11:29FileMaker allows you to use calculation functions and the calculation
11:32dialog to enforce data entry rules and to filter data entered into a field in
11:37the field options dialog.
11:38And both of these techniques can really improve the integrity of the data that's
11:41entered into your database.
Collapse this transcript
Using calculations in the security settings
00:00Another area where you'll see the FileMaker calculation dialog is under the
00:04Manage>Security section.
00:06We've talked about this in the first chapter where you can create your own
00:09Privilege Set. One of the things you'll notice in the Custom privileges under
00:15either Records, Layouts, Value Lists, Scripts,
00:17when you get down to the Custom Records Privileges window, you'll notice that over
00:23here on Field Access, or even Edit, or Create, or Delete, you'll notice that is
00:27just third option. This options called limited. We discussed this earlier in this
00:31course about how you can manage View, Edit, Create, or Delete.
00:34But there is also this option for limited.
00:36Now if you choose limited, let's say under Delete, you'll see that it presents
00:42the Calculation dialog window and this is one of those Boolean calculation
00:45dialog window as you see in the bottom left-hand corner.
00:48And a common security requirement for developers is to isolate specific records
00:52from some users, that's pretty easy, you can just say you can't see these or you
00:56can't edit those or can't delete them all across the board. Sometimes you
01:00might want to do this in sort of a conditional fashion. One of the very
01:05straightforward approach is to controlling record access will rely on
01:07determining who the user is when they are logged in to the database and possibly
01:11allowing them to Edit or Delete records that they originally created.
01:16So for example, we have a field here, and just to refresh your memory, we've got
01:20the ability to Delete or Edit.
01:22So let's say I say okay, in customers, we don't want you to Delete or Edit
01:25anything that you didn't create.
01:27So I'm going to choose limited, presents our dialog window. There's a field
01:31in here called CreatorAccount and this is what's commonly referred to as a
01:34housekeeping field. If we look at CreatorAccount, just want a quick
01:40refresher, you'll see that it's set up with an Auto-Enter Creation Account Name,
01:46so whatever the user was logged in as when the account was created that will be
01:50the value to get center into that field.
01:52And that will be helpful to us here, because then we can compare that to the
01:59account that the user is currently logged in as, and if it's the same, then we
02:02allow them to perform either the Edit or Delete. It's very simple.
02:06So this is how we would do that.
02:07So under Customers>Limited, if the CreatorAccount equals, then you'll see
02:15that there is a function, actually it's under the Get function dropdown called
02:20Get (AccountName), really simple stuff here.
02:22So the formula isn't that difficult, it just says if the name of the account that
02:27the user used when the record was created equals the name of the account that
02:31the user is currently logged in as in this database session, then allow them to
02:35perform the Edit or the Delete. I can copy this over to delete and say OK.
02:46So now let's try this out, we will hit OK and so we see that that back Privilege
02:51Set is only assigned to the Admin Copy account, so let me log back in under
02:56Admin Copy, first verify that I do have Admin rights to this database.
03:03I'm going to open the file again, but this time I'm going to hold down the Option
03:08key, because I am on Mac and that will prompt the login.
03:13Or if I was on windows I could hold down the Shift key, so I'm holding down the
03:17Option key, Open, and this time I'm going to login with the Admin Copy account.
03:23Now we see that the first record here was created by Admin Copy, so the
03:30CreatorAccount now equals the login account, so that means I can click inside
03:33this field and make a change, pretty simple.
03:38But if I go into the next record, you see here that was created by the admin, so
03:44when I go in here, you'll notice that I get the error that says Your access
03:48privileges do not allow you to perform this action.
03:51The same would be true if I try to Delete the record, and because we set up both
03:55Delete and Edit in the same fashion.
03:57As with all things in FileMaker Pro there are different ways to approach
04:00conditional record access and each method has its pros and cons.
04:03In this video we presented a common technique that employs the use of the
04:07calculation dialog to enforce whether users can Edit or Delete a record.
04:12You can use any calculation formula that you wish in order to enforce your
04:16specific business rules.
Collapse this transcript
Using calculations in conditional formatting
00:00Earlier in this course we've talked about how you can apply conditional
00:04formatting to objects that are on your layout.
00:07And we also showed how you can add a formula there, but I'm going to revisit
00:10that, because I wanted to show you this as another area where the calculation
00:13dialog can be used inside the FileMaker programming environment.
00:17Of course, as its name implies, conditional formatting will allow you to
00:21dynamically apply different formatting attributes to a layout object.
00:25And in order to really dynamically apply those, you can use the FileMaker
00:29calculation dialog window.
00:30So for example, let's go back to our Customer Details layout here. I'm in Layout
00:35mode, so I can actually apply conditional formatting and I'm going to go to the
00:39Due Since field here inside the portal and I'm going to right-click on it or
00:44Ctrl+Click on Mac and choose Conditional Formatting.
00:48So here we have our Conditional Formatting dialog. When I hit Add,
00:52it automatically do the default, which is the Value Is. This doesn't allow us to
00:56invoke the calculation dialog, but if I go Formula is, you'll see the Specify
01:01button appear. Of course anytime this Specify button appears that means that
01:05we can use the calculation dialog window to create a formula.
01:10So I'm going to hit Specify and I'll clear out the default items that were
01:15presented to us there.
01:17And of course, before I do, I should say that you can use Value Is and there is
01:21various different things that are already in here, or you can just put in a
01:24certain value and here's your logical operator and a lot of these will work.
01:29So you can even do ranges, greater than, less than, that type of thing.
01:33But if you want it to be more complex or have more control over it, you should
01:37use the calculation dialog window and this way you can author whatever you want.
01:41So let's go in here and let's say we want the condition to say Formula is, and
01:46what we're going to do is we're going to say that if the -- and again this is
01:50the Due Since field, so it's a number of days, Due Since.
01:54Let's apply a formula here that indicates that this invoice is either due
01:58or past due, so let's go in Conditional Formatting Add change to formula, clear that out.
02:05And so what we're going to do is, we're going to say Get CurrentDate. So first
02:09of all we're going to establish what the date is right now and we're going to
02:14say if that day is greater than the date of the invoice, because this portal,
02:21it's actually related records from the invoice table.
02:24So we will say invoices Date plus (+) there's a value in here that's called
02:29Terms that gives us a number of days. So if invoices Date + Terms, and of
02:38course, if you are not familiar, what I'm using here is a technique where I
02:42can add a numerical value to a date value and since FileMaker internally
02:46stores dates as integers, as long as I add the numeric value to the date, it's
02:52really going to add it to the integer represents and then it's going to
02:56present a date value to me.
02:57So here I'm going to say if the CurrentDate, which also is represented internally
03:02in FileMaker as integer, is greater than the invoice Date + the Term integer,
03:08then that of course means that this is past due.
03:11So we're going to visually represent this as red, let's say.
03:14So that will tell us basically that this is overdue. We want to bring some
03:19attention to that. So really what we've done is we've used the formula to create
03:25the same rule or business rule using the calculation dialog that we use to
03:29determine whether or not an invoice record is past due or not.
03:33So I use the Formula, apply that here. We see the badge appear, which indicates
03:38there is conditional formatting applied and now let's look at this in Browse mode.
03:41We'll see here, well, all of these are past due, and you'll notice
03:47that anytime something is past due, it's going to show up is red.
03:50Now this one isn't due yet, and of course, your results may differ a little bit
03:54depending on what the current date is when you're looking at this exercise file,
03:58but as of the recording of this date, this invoice here was not past due,
04:03these three are, and you see that represented by the conditional formatting.
04:07So the idea is, in conditional formatting you can use the calculation engine to
04:12enforce either a true or false rule within your database, of course, those are
04:16also referred to as Boolean dialogs.
04:19And in this case we use it to conditionally format a field based on a formula
04:22that we wrote that doesn't necessarily reference the field that we're
04:25applying the condition to.
04:27So if you really want your formatting rules become more sophisticated, then
04:30you're going to want to become more familiar with calculation functions.
Collapse this transcript
Using calculations in tooltips
00:00Adding a tooltip to layout object is a quick and easy way to provide help or
00:04tips or some additional information to your users.
00:07It's most commonly applied to layout objects like buttons.
00:11For example, if we go into Layout mode and I select this button, you'll see that
00:18under the Position tab in the Inspector, and of course, if you can't see the
00:22Inspector, you can go under View>Inspector or choose Opt+I or Ctrl+I.
00:27I can simply type in some information like Create Invoice and when I save that and go
00:35into Browse mode, you'll see that when I hover over the button, up pops a
00:40little yellow tooltip called Create Invoice, just some raw text information.
00:43And what you might not know is that you can also use the Calculation dialog to
00:50show more dynamic information when users hover over a layout object.
00:55So for example, we've got a portal here that shows all the related Invoices to this Customer.
01:00So we are in the Context of the Customer Table, as you see here, and then this
01:05portal will show Invoices only related to this customer.
01:09If we take a quick look here at the Relationship graph, so here's where we are
01:15on this layout. We are looking at a portal with related Invoice records.
01:21So here's one Customer as many related Invoice Records, and each of those
01:25Invoice records also have multiple ProductInvoice items on them.
01:29So it might be interesting for us to see all the different ProductInvoice items
01:34that are on an Invoice without leaving the context of this layout.
01:38So of course we can drill down through those if we want, or we could maybe add
01:43a calculated tooltip that allows users hover over an Invoice portal row and see
01:48all the different items on that Invoice.
01:52Now the ProductsInvoices line Item table only contains foreign key values and
01:57does not actually contain the name of the products.
02:00So really what we would have to do is show a list of related products items,
02:05would give us a return delimited index of all the individual products that
02:10appear on an Invoice.
02:11So a quick idea of what we are going to be doing there.
02:14So in this exercise file there is actually little icon here, you'll notice that
02:18when I click over this icon, it covers the whole row, well there are some other
02:22formatting that is applied to that icon.
02:25So let's use that to be the layout object that we are going to apply the tooltip to.
02:29So we go in here little bit of inconsistency in the FileMaker UI. I've
02:34mentioned thus far in the course that anywhere you see the specify button, then
02:37you can invoke the FileMaker Calculation dialog window, but here in the New
02:42Inspector there is a pencil icon, that means the same thing.
02:46So anywhere you see the specified button or a pencil, as you can see invokes
02:51the Specify Calculation dialog window.
02:54So what I am going to do is I am going to use the List function that we covered
02:58earlier in this course and the List function of course will provide a return
03:02delimited list of values.
03:03As we discussed earlier in the course, if I put a related field as the
03:07parameter inside the List function, it'll show me a return delimited list of
03:11all the related values.
03:12So remember a portal row is actually the context of whatever table it is
03:15that we are viewing.
03:16So really what we are talking about is, I am in the context of an Invoice
03:20Record and I want to see related records from there.
03:23So that's really what I'm doing here.
03:25So I don't want to pick a related field from customer, because that's the
03:28parent of the Invoice.
03:29I don't want to pick a related field from the Invoices table, because that's
03:33actually what record we are looking at.
03:35Instead I can pick ProductInvoice, I would need to show the Item, but the Item
03:40information doesn't exist on ProductInvoice.
03:41So I am going to pick Products, where we actually do have the Item
03:45information. I'll double-click on Item, pretty simple formula List, and then
03:49show the Products and what I am going to do is I am going to add Return
03:54character and some text.
03:58We can also show the person who Created this, of course, that'll be back up in Invoices.
04:04So here's CreatedBy, this shows the list of the products in the Invoice record
04:09in the portal, and then also show who wrote up or created that record.
04:12Let's take a look at this in Browse mode. In this particular case what we
04:16will do is hover over the icon.
04:19So if I leave the hand over the icon, I see that I've got a Performance Tune
04:23Up, a Bike Helmet, Accessory Kit, Unisex Sunglasses, and this one was written up
04:26by a user Michael Gonzalez.
04:28And then when we hover over the next one, we see there is Men's Mountain Bike,
04:31Portable Pump, Created By Admin, and so on so, you get the idea.
04:34So we can use the Calculation dialog in the tooltip to show dynamic information.
04:38Couple quick things on tooltips, if you are going to use this, you
04:42should know that the formula is evaluated at the time that the user triggers the tooltip.
04:46So if I'm hovering over this and the value happens to change, it is kind
04:50of temporarily stored, but that shouldn't affect this technique that we talked about here.
04:55The tooltip won't display if all the Calculation returns as an empty string, it
04:59just won't pop anything up.
05:01Tooltip text wraps automatically if it exceeds 40% of the Width of the screen.
05:06If your screen is very small, the tooltip will exceed 40% of the Width, it'll then wrap.
05:11So it might kind effect way that your calculated information is being
05:14displayed. Calculation formulas used in tooltips evaluate from the table
05:18occurrence context of the current layout, or in our case, the Table Occurrence
05:23Context of the portal row.
05:25So keep that in mind, if we've applied a tooltip over here on the left,
05:29this would be customer contacts, but here it's the Invoice contacts, so
05:33that's something to remember when you're using related values in your
05:36Calculations formulas.
05:37And things like text formatting, like color, font size, and style, bold,
05:42and italic that type of thing will not be displayed in a tooltip, it's just raw text.
05:46So you might want to think of things that might be useful to see that don't
05:50require bulleted lists, or formatting or different things like that.
05:53But the takeaway here is definitely, like in many other areas inside FileMaker,
05:56if you use the Calculation dialog and all the formulas of the Calculation
06:00engine inside your tooltips, you can do some really compelling dynamic
06:04information as you roll over layout objects.
Collapse this transcript
5. Calculations: Working with Aggregate Functions
Working with calculation functions and related fields
00:00As the name implies, aggregate functions in FileMaker Pro Calculations are used
00:05for calculating various summarizations of sets of data.
00:09So for example we can look at what our options are if we go
00:12into Manage>Database.
00:15Say for example that we want to change the Total Invoices Paid from a Number
00:19field that requires us to enter data into it, into a Calculation field that
00:23will dynamically update this information.
00:25So let's do that, let's change our Calculation and hit Change, say OK.
00:30This allows us to look over here in the upper right-hand corner at the
00:33Aggregate Function options.
00:35You'll notice that we can average a set of Data, Count a set of data;
00:39we've already seen List, a Return to Limited List of data, in some of the other
00:44exercises in this course.
00:46Max or Minimums, and a very common one is Sum, and some of the other ones that
00:50are not quite as common, but also available to you if you need it.
00:54Now when you choose one of these functions, you'll see that it has at least one
00:59parameter that's required and that's a field. What these brackets mean
01:03here is that you have optional parameters.
01:04So what you do is you could list values. For example, we can say Sum, and then
01:10put a bunch of values together.
01:11But this really wouldn't make sense. It's kind of the native use of an aggregate
01:15function, but it's not very likely that this would be useful for you, because
01:19here you just be adding up all the numbers once.
01:21So this would result in number four for every record in our database, not very useful.
01:25Or we could put a bunch of different fields inside the Sum function.
01:30For example, Tax Rates, Unpaid Invoices that type of thing, but this also isn't
01:37very useful as far as a Calculation function is concerned, because we could just
01:41create a function that says Add Tax Rates to Total Invoices Unpaid.
01:44So really where aggregate functions are the most useful and they are very
01:49common in this regard, is when you use the aggregate function to reference a
01:53related field as the parameter for the function, just a single related field.
01:57This is much like what we've been doing in the List function where we just put
02:00one single related field.
02:02But just as a reminder, I am defining this field inside the context of
02:06customers, and if we do a quick look at our Manage Relationships, we see that we
02:10are in the Customers Table.
02:12And in order to be able to use a related field in the Calculation, that related
02:16field in this case would have to be coming from the related child table, because
02:21otherwise we won't have many of any value to aggregate, it would just be one
02:26value if it's coming from the parent.
02:28So here, since we are defining the Calculation in the parent, let's pick one of
02:33the numeric values from the child Invoices Table and Aggregate them.
02:37So let's say we want to summarize, see what our options are here, and we
02:42say, since this is Total Invoices Paid, let's go to the relationship that is Paid Invoices.
02:48And by the way, we will be covering this later in the course in the Relationship
02:51chapter and how we created those.
02:53But for now, what you should know is that this relationship will filter out only
02:56Invoices with the status of Paid.
02:59So we want to summarize let's say Grand Total, pretty simple, keep that as a
03:06Number and let's take a look at what we get here.
03:08So we'll say OK, we'll say OK again.
03:11And if you notice in Layout mode, you'll see that we already have a merged field
03:15with some formatting that displays that value.
03:17So if we go back into Browse mode, we don't have to save it, you'll see that it
03:22is summarizing only the records that have Paid.
03:24So those are the ones that are showing up in this portal down below.
03:28So here we see there is None that are Paid.
03:30But on the very first record, there was one that's Paid and it shows that Total.
03:34Now you'll notice though that if there aren't any, it doesn't shows 0, it just
03:38shows the dollar sign ($) and that might be kind of confusing to users.
03:41So instead what we will do is use the If function to say, if there are no
03:51values, just put some 0.00 in there, but if there are values, then
03:55actually summarize them.
03:57So in order to do that we will introduce the If into our Calculation formula.
04:02Let's use another Aggregate Function as our test. So here Aggregate, let's Count.
04:08So let's say if we Count up all the nonempty values in the Paid Invoices, so
04:14we know that each will have a primary key, so let's count up all those nonempty ones.
04:18So if we say this is greater than > 0, then perform this Calculation, otherwise,
04:23just show some text of 0.00.
04:28Now in this case, one of the outcomes of this could be driven by the fact that
04:34the values are empty, the values that we are counting would be empty.
04:37So that's why we have to turn off this Do not evaluate if all referenced fields
04:41are empty option, which is a default on every calculation and it's very rare
04:44that you have to turn it off.
04:46But anytime your Calculation could potentially evaluate empty values, which
04:49we're doing here, in the case of Count equaling zero, we want to turn that off.
04:55So let's turn that off and now we see in all the portals that don't have
04:59any Paid Invoices it just shows up as 0, and the ones that do, it gives us our total.
05:05Now we can also go and take that same formula, copy that and we can change the
05:13Total Invoices Unpaid to a Calculation as well.
05:17And I'll show you with a slight change instead of Paid Invoices for the Count,
05:23we will say Unpaid Invoices, pick the same field.
05:26Instead of Paid Invoices in the Grand Total we will pick Unpaid Invoices, Grand
05:31Total and now you'll see those values appear too.
05:35So now we can see the Total of the Unpaid Values as we go from record-to-record.
05:39You'll also notice that inside this database there's a series of other
05:44Calculations already created using the aggregate functions like the List
05:48function that we used earlier in the course.
05:50And here's one that's counting up all of the different Invoices, here's
05:53one that's showing a count of all the Paid Invoices, a Count of all the Unpaid Invoices.
05:58So really what those are examples of are some very useful uses of the
06:01Aggregate Function. I would go so far as to recommend that any layout that has a portal in it,
06:07should have at least one field that's aggregating the data that's in the portal.
06:10This can be very helpful to your users, because you're displaying a bunch of
06:14related values that change from record to record.
06:17And it's very useful from a User Interface standpoint to have the users not
06:21have to count all these up or total all these values up. Maybe above the portal
06:25or below the portal like we've done here, just show the totals or the counts or whatever it is.
06:30You can use Count, Sum, Average, Minimum, Maximum, that type of thing.
06:33So since aggregate functions reference related fields, they can be really
06:37useful companions to portals on layouts based on parent tables.
06:40Of course, parent tables are the ones that have portals, because otherwise
06:43portal won't show any related values.
06:45And again, I'd go so far as to recommend that any layout with a portal on it
06:49should have at least one field aggregating the related data.
Collapse this transcript
Comparing aggregate functions to summary fields
00:00Just a quick note on aggregate functions versus a type of a field called the summary field.
00:05I get a lot of questions about what the differences between those two things
00:08are, because they do have some similar syntax.
00:11As a reminder you look at a aggregate function used in a calculation, you'll
00:18see that our Options are things like Averages, Counts, Lists, Max, Min, Sums
00:24that type of thing.
00:25And in a summary field, which you can see we've got a summary field up here,
00:29CustomerCountSummary, you'll notice that's a different type of a field
00:33completely and the Options are very similar Totals, Average, Count, Minimum,
00:37Max, Standard Deviation, Fractions and so on.
00:40So what are the differences?
00:42Well they are very specifically different in their application.
00:44I want to show you an example of where the summary field is used.
00:48If we click over to the Customer List view, you'll notice that that same summary
00:52field that we just looked at in Manage Database is up here in the top of the
00:55screen and it's instructed to count all the customer records.
00:58Right now we've got all 1535 records showing, so no coincidence the value
01:04inside that field is 1535.
01:06However, if we go and search, you'll notice that our Found set has changed to 76
01:13and so has the value in the summary field.
01:16So to sort of add some clarity there, summary fields are very specific in their use.
01:22They are only there to aggregate against Found sets.
01:26So of course this user experience will change depending on whose logged
01:30in to your database.
01:32On the network, if I'm logged in and I search for California, I'll see 76,
01:36but if another user is logged in and they search for Idaho, they might see another number.
01:40So the summary fields are session specific and they are specific to the Found
01:43set that that user is working with.
01:45Whereas aggregate functions are a function inside of a calculation field, and
01:52although they sound like they're doing the same thing, they are aggregating
01:57only related values.
01:59So aggregate functions deal with sets of related values and aggregate summary
02:05fields deal with Found sets or values across a Found set, so that's just a
02:10simple rule to keep in mind.
02:11So again, the rule to remember is that aggregate functions are primarily used to
02:14summarize related values in the context of a parent table.
02:18And summary fields are used primarily to aggregate Found set values across Found sets.
02:24Both can summarize Count, Average and determine a Minimum and Maximum,
02:28but they shouldn't be confused with each other.
Collapse this transcript
6. Advanced Reporting Options
Reviewing subsummary reports
00:00One of the key features in FileMaker Pro is its powerful reporting capabilities.
00:04As a developer you can use these capabilities to create reports that allow users
00:08to better understand and analyze the data that's being stored in your database.
00:12An effective report could be anything from let's say a list of something with
00:18information displayed on it or as we looked at here we could have a spreadsheet
00:27looking view of something and possibly with some aggregate information, maybe
00:30through some charts on it, whatever kind of information might be useful to you.
00:34But you'll notice as you open up the exercise file here, it's going to go to a
00:39layout that's called Invoices SubSummary.
00:41FileMaker has a unique tool that's called a SubSummary part of often referred to
00:45as SubSummary reports that combines together a list of information into groups.
00:51So you can see here, it's a lot easier for us to look at these invoices when
00:55they're grouped by the different customers, because this can give us information
00:59not only about who the customers are, makes it more visually easy to discern
01:03when one customer ends and the other begins, but also we can use totals.
01:07So let's take a look at what makes this work.
01:09If we go to the Invoices SubSummary layout and check it out in Layout mode,
01:14you'll see over here on the left-hand side and let me open that up a little bit,
01:19I clicked on the bottom left-hand corner here to reveal the names of the parts,
01:23you can also go under Part Setup to see the different parts of the layout.
01:28And up until you create reports you are probably only dealing with Header parts,
01:31Footer parts, Body parts.
01:33But what I wanted to show you is these SubSummary parts.
01:36If you double-click on it you'll see the part definition dialog pop-up.
01:40You'll see that this part, it's called SubSummary when sorted by and I picked a
01:44certain field from either this table or one of the related tables.
01:48Now what that means is that I've just given FileMaker the instruction to group
01:53my list view by this field that we call the break field.
01:57So then in this case we're looking at SubSummarys when sorted or grouped by a
02:03company name and that's what we see when we go into Browse mode.
02:06So that's why we see all the company name here.
02:08Now the key is I have to actually sort these by the company name.
02:12I can pick some sort of secondary sort value;
02:14you see here the Date field, so you know it goes for the ascending order of
02:19dates after we've grouped it by the customer.
02:22So a combination of setting up a SubSummary part and then sorting by that field
02:28that we configured in the part. Then also another element that we're
02:31employing here, we go into Layout mode is that on the second SubSummary part or
02:37even on the initial SubSummary part we're putting a field on here and here this
02:40one is called Grand Total Summary.
02:43If I go into Manage Database you can see Grand Total Summary is what's called a Summary field.
02:48A Summary field is a field that's set to aggregate values across a found set.
02:53The interesting thing here when you are using SubSummary part in your layout,
02:57is that it's creating mini found sets.
03:00So I'm not only visually grouping the data, which is very useful, but I can use
03:04SubSummary fields to aggregate data across those mini found sets.
03:10In fact a single summary field can be placed on the same layout in
03:13several different parts.
03:14So for example I could place it in the SubSummary part like I mentioned here or
03:20I can copy it, put it up in the header and we can see in Browse mode.
03:26When I save that, that same field is now aggregating or giving us a sum across
03:31the entire found set of 25 orders.
03:34And then that same field when referenced in a different part, in this case the
03:37SubSummary part is aggregating across the mini found sets, very useful there.
03:41And the final component of a SubSummary part in review is that to guarantee that
03:47this report always shows up sorted or grouped in the right order.
03:51You'll notice here that if you look very closely there is a little badge there
03:55that indicates that we've got a Script Trigger assigned to this layout.
03:59So when a layout is entered, we can see that there is a script here called Sort
04:04Invoice List for SubSummary and if we hit Edit on that, we can see that that is
04:09sorting by the break field and then the secondary field.
04:12So the combination of a SubSummary part that groups your data and summary
04:19fields that aggregates the data across found set and those mini groups and
04:24adding a little bit of user-interface assistance there with the Script Trigger
04:27to ensure that that layout always looks grouped are what we call, when they're
04:32put all together, a SubSummary report.
04:34This is a very common way to report inside FileMaker.
04:38And if you're familiar with these or if you're working with them and
04:41integrating them into your database, you can add charts to them that also
04:44summarize against groups.
04:45but, sometimes you might run into trouble like, it looks like it's a list view,
04:48so in that case you need to make sure that you are sorting by the break field, or
04:52make sure the data has been entered consistently like for example, if you have
04:56some invoices have Bye space Ink instead of Bye, space Ink, they'll show up as
05:02two different groups here, that's a very common issue.
05:04So you can resolve that issue by properly relating all your tables together or
05:08providing user data entry assistance by doing things like dropdown menus and
05:12stuff like that for fields that will ultimately be the grouped fields.
05:16You can also put any other field other than a summary field
05:19maybe in the wrong part if you put a summary field in the body part instead,
05:23then every single record will have the same values.
05:25So those are just some of the common gotchas.
05:27But again, combining SubSummary parts on your layout with summary fields and
05:31even some script triggers to do the sorting, we'll give you very familiar
05:35grouped report inside FileMaker.
05:38And it is one of the more powerful and useful capabilities in FileMaker Pro
05:42allowing you to display it in this way.
05:44And the skills needed for creating successful reports include things like
05:47defining the proper fields, developing the layouts and defining calculation
05:51formulas and doing some scripting.
05:52So in short, it requires a combination of several skills that are reviewed in
05:57this movie but if you want to refresher you can go back and look at the chapter
06:00on reporting in the FileMaker Pro 12 Essential Training.
06:04We're going to use some of these concepts moving forward in the rest of the
06:08movies in this chapter.
Collapse this transcript
Creating subsummary ranking reports with no body part
00:00Once you become proficient with creating basic SubSummary reports in
00:03FileMaker, you can then progress on to creating reports that are a little bit more advanced.
00:08In this movie I am going to cover a really useful variation on the basic
00:12SubSummary report. Specifically, I am going to show you how to create a
00:16SubSummary report that doesn't contain a body part and then therefore it allows
00:19you to rank the data rather than group it just by this break field and then
00:23show details about it.
00:24So in a basic SubSummary report like you're seeing on screen. It can contain
00:28Summary information for each group. You see the information right there, like
00:31$964.54 for Abbot Securities and then all the rest of the customers
00:37that are grouped and have their individual order summary.
00:40Now it might have been useful when we first created this layout to show the
00:44details of all of the individual Invoices.
00:46But let's say for instance we just want to see a list of customers with
00:51their total and maybe possibly then rank them by that total, so we can get
00:55sort of ranking report.
00:56So why don't we go ahead and do that.
00:58First we'll go into Layout mode and as is always best practice, why don't we
01:02Duplicate the existing layout instead of modifying the original one.
01:06So you can see here if we click on the little pencil icon, we can call this one
01:12No body Part . The first thing that we're going to do and it might seem a
01:20little bit radical, but we are going to delete the body part.
01:21So I can select the body part, you see it's darkened there as I hover over body
01:26part, I'll just hit the Delete key on my keyboard and I will confirm that in
01:29fact I do want to delete that body part.
01:31It seems kind of crazy, but it will serve our purpose as well.
01:35So here I'll get rid of some of the formatting and move the Grand Total Summary
01:41up into this one single body part.
01:42So now I've still got the one SubSummary Part sorted by company and that's a
01:46company field that I put on that same part and now the Summary field and I'll
01:51also make some formatting changes.
01:54So let say instead of a Fill we'll just make all of these sort of uniform, make
02:01these 12 pt non Bold, and we'll keep this one Bold. How is that?
02:08And sort of make them the same size and invoke that Inspector again by doing
02:14Ctrl+I or Opt+I and doing just some quick formatting, not germain to
02:19that what we're talking about here, but we want things to look nice, so let's
02:23select this, move those up to the top a little bit and shorten out those
02:28rows, pretty simple.
02:30We still have the Script Triggers assigned here on Layout enter and if we look
02:37at what that does, you see it's just a simple sort and it's sorting by the break field.
02:42We can say OK, OK, OK and then back and let's take look at in Browse mode and
02:47see what we've got here.
02:49So by simply just removing the body parts, now we see that we've got a
02:53somewhat compelling list.
02:55Actually let's get rid of the second summary part, I failed to mention that.
03:00So now in Browse mode we see we have a nice type list of all the customers and their totals.
03:06Now the interesting thing about this is that the context of this layout is
03:09not the Customer table.
03:12Say for example we don't have a field inside the Customer table that aggregates
03:16all the related Invoices.
03:17The thing that's most interesting about this is that this total that you're
03:20seeing here is actually the total for all of the orders in this found set.
03:26So you see the number up here 25, that's not 25 Customers, it's actually 25
03:30Invoices in this found set.
03:32As a matter of fact if I went into Invoices and may be performed a search, let's
03:40go to invoice date here we go and just do 2010.
03:45So I got five of those 25, now I go to that same layout and you see that now
03:51I've got fewer records.
03:52So what this means is that the value that you see over here in the right-hand
03:55column can be found set specific, which is nice, because you can present this to
03:59the user, you can allow them to navigate over to this layout from other layouts
04:03like the one I showed you before.
04:04Or they can do their own searches and come here, so it's not only a ranking
04:08report, but it's a user driven ranking report where they can come up with any
04:12customized found set and it will reflect those values here.
04:15Now it's not truly a ranking report though.
04:18In that, when we look at all the records and sort by the break field, it just
04:23sorts them alphabetically.
04:24So the idea here would be probably be useful, yeah we don't need date in this
04:29case, if I could sort by the Grand Total Summary value instead.
04:33But of course the rule for a SubSummary part in FileMaker is that that always
04:38needs to be the first sort value.
04:40So the break field that we used when we set up the SubSummary part needs to also
04:44be the first sort value in the Sort Order window that we see here and what's
04:49interesting though is this option right down here.
04:52So instead we can keep that Sort as it is to satisfy the rule that we need to
04:56group these values, but I can check the reorder based on Summary field option
05:01that you see here, which will do just that.
05:03It will sort and therefore group, but then it will reorder these values by any
05:09one of the summary fields that are defined here and we only have one Summary
05:13field defined that's why the rest of them are gray.
05:15Now you'll see that that icon changed a little bit indicating that there is some
05:19grouping going on there and we see the Grand Total field, grand Total Summary
05:22field indicated, I say Sort and now we notice that it's sorting in reverse
05:27order, but I can just select Descending order.
05:30And now sure enough, we have a ranking report, it gives us a sort of an index
05:36list of only the customers in the found set that are reflected in the found set,
05:40in this case it's all records in the found set and then it gives us a total
05:44based on whatever found set it was created and then ranks them based on that
05:48even though it is still a SubSummary part.
05:50And so this technique is commonly referred to as a ranking report when building
05:55reports in FileMaker.
05:56So once you become proficient with creating basic SubSummary reports you can
05:59progress into creating reports that are a bit more advanced like this one here,
06:02where we show a variation on the basic SubSummary report in order to be able to
06:07present a user driven or found set driven ranking list of customers and invoices
06:13and their summary values.
Collapse this transcript
Nesting multiple groups in reports
00:00One of the things I want to emphasize when you're planning your SubSummary
00:03reports is that one single layout in a FileMaker database can be used to
00:08create multiple reports.
00:10What I mean by that is that a layout can display fields in a certain format.
00:15So you go in and you design your layout with these fields and put them in a certain
00:18order, but especially when you've got SubSummary break parts inside of that
00:22layout that you have designed, you can send different found sets over to the
00:26report and therefore come up with different reports.
00:28Many times when I am creating reports for clients, they will say things to me
00:32like oh, in this format I'd like to have a weekly report, a monthly report, a
00:36yearly report and maybe a custom date range.
00:38Now that could seem like it's many different reports and then you might think
00:42oh I need to go create many different layouts in FileMaker, but the reality of
00:45it is that's one single layout, but you can feed it all sorts of different found sets.
00:50So the most poignant example of that, I could show you here is that if I go
00:55into Invoices and again we'll search for 2010, you can see that's only five
01:04records out of 25, I go back to my SubSummary report, we could call this for
01:09example the 2010 sales breakdown report or the user driven breakdown report or
01:16I could even do a search by a certain type of a customer, for example, let's
01:21say, all paid invoices and I still feed it to the same layout, sorted by the
01:31break field and now all of a sudden this same layout becomes the Paid invoice
01:35breakdown or Unpaid breakdown.
01:37So hopefully, that makes sense because it can really be very efficient then in
01:40that case, you create one layout and instructor users to feed it different found
01:44sets or create a workflow in your layout that feeds it different found sets.
01:48Now in the example that I am showing you, we have all sorts of different found
01:52sets, but they would all be grouped and sorted by the same break field.
01:56Nowin this movie I want to show you a new technique where one single layout
02:00could be grouped potentially by multiple combinations of break fields, all
02:02triggered then by a different sort order.
02:04So let's jump right into it, let's go into this exercise file and you see I have
02:08got the Invoices SubSummary. Let's go into Layout mode and let's create a new
02:14layout and rename it and this one we are going to call Nested and we hit OK.
02:24It's got all the same components of the original layout, we've got the
02:26SubSummary part and the header in the body and even a footer in this case.
02:32So our goal here is that we're going to create one layout that our users can
02:36create found sets and then send those found sets here and then give them
02:39additional power to change what the layout looks like when they generate it,
02:43print it off or PDF or even look at it on screen, by allowing them to then
02:47include not only found sets, but the sort to change or manipulate what this
02:51one layout looks like.
02:52So in order to do that, right now we have only got one SubSummary part;
02:56we are going to add some additional SubSummary parts.
02:58The way we can do that is go under Layout to Part Setup and I can just simply hit Create.
03:03So let's pick SubSummary part when sorted by and in this case, I am going to go
03:09to Payment Status, so Paid or Unpaid and I am going to hit OK and I am going to
03:14put that one below the existing SubSummary part.
03:19So we have got one that is a SubSummary by Company, I have got another one
03:23below it, currently it doesn't have any fields in it, but it's a SubSummary
03:26by Payment Status and now I am going to add a third one that is a SubSummary
03:31by let's say Shipment Status, also print that below and we'll have them sort of cascade here.
03:39So now, I'm done.
03:42What I have done here is I have created three cascading SubSummary parts.
03:45I can choose to sort by any one of them or a combination of them, but first I am
03:50going to do some quick layout changes here. So why don't we make the fill colors
03:55a little bit less dramatic and I'll share the Grand Summary with each one of the
04:02summary parts, make sure that looks good, line it up. In this case, I am
04:08going to copy the second one here and just as a reminder, we've got the Payment
04:15Status so let's say Payment Status, maybe make that bold, change the fill just a
04:23tad here, make that transparent. Then now on this last one I am going to
04:30indent it just a tad and I am going to say Shipment Status.
04:36So all I have really done in this case is, let's make these a little bit more contrasted.
04:44Okay, so all I've done here is I've added two new SubSummary parts to the
04:51layout, I've ordered them stacked on top of each other and I know that there
04:55happens to be values that are in these fields.
04:58So now what I can do is I can go into Browse mode again, save the changes that
05:05I've made, show all my records and now I am going to do a custom sort, so I am
05:11going to say Sort, I am going to leave the Company field and I am going to sort
05:15them in the same cascading order that I did when I set them up.
05:19So I'll do Company, then Payment Status, then Shipment Status.
05:21So what you're seeing here is that if you have multiple SubSummary parts on the
05:24same layout, I can still trigger those groups, so groups within groups as long
05:30as I'm cascading the sort order.
05:32So remember, sorting by what's called the break field is what groups in the
05:36first place and if I want to group within groups, I have to just cascade the
05:40sort, so let's see what that looks like first.
05:42So we do sort, and we get sort of an interesting effect here, we've got the name
05:47of the customer and then and within the Customer, here are some that are
05:50processing, we got none that are paid, we have got Shipped, so on and so on, so
05:55here is one that's a little bit more dramatic.
05:57So we have got Lightningfast Racing Company and how many Paid invoices do they have?
06:02Well, they've got two of them and those are two invoices that both have the same
06:06shipping status as Shipped.
06:07So we've got name of customer, the Payment Status and within the Payment Status
06:12we are breaking them down by shipping status.
06:14Here is another one that's a little bit more exploded out.
06:16We see Unpaid, it gives us a total of $944.87 and within Unpaid we've got two of
06:21them that are pending, and we see that value $729.94 and we also have one that's
06:26processing, $214.93, those together give us $944 and those combined together
06:31with all the Paid ones give us a Grand Total of $1,672.06.
06:34And so same thing as before, we can go in and allow our users or instruct our
06:40users to search for just certain found sets and then feed it to our new report.
06:49The more data you have, the more you are going to see that breakdown, but
06:52here we would go in and sort by Payment Status, then Shipment Status, just like
06:57we did before and we see how it would break down.
07:00Now instead of sorting these manually, why don't we allow our users to pick the sort order?
07:04This would require that we put some sort of layout object on the layout that
07:08would allow them to interact with it. And then maybe use a Value List for
07:12example to choose from the different sort values, so let's use a field with the
07:15Value List assigned.
07:16First I am going to add a field, which is kind of common technique in
07:20FileMaker to add a field. It's called a global field and we create that
07:24field, let's say we'll make a text.
07:25What makes it global, is if you click on Options and go into Storage, it's going to
07:30use global storage. All that means for the purpose of this activity is that
07:33every record in the entire database is going to contain the same value.
07:36This is good, this is going to help us sort by those values or create values.
07:41It really doesn't matter to us because we are going to put this in the
07:42header and this is not going to be something that the records in the found set even have.
07:46This is just a field that we can use that the user can interact with and
07:49depending on what record we are on, it will still show the same value.
07:53So there is something called Global, I am going to place that on the Layout,
07:58Global field and let's assign a Value List to it by invoking the Inspector,
08:09Ctrl+I, and then we'll say Pop-up menu and we'll see if we'll have--we don't
08:16have a Value List created just yet--so instead let's create one. Hit the little
08:20pencil and we can say Sort Options and let's manually put in Company
08:30and Payments and Shipment and hit OK and now we've applied that to the dropdown.
08:40So what we need here is when the user changes that value, it's going to trigger,
08:45let's say a script that will then sort by those values. We don't even have to
08:49instruct the user on how to sort and make sure that they're cascaded properly,
08:52kind of an interesting technique.
08:53Here we'll say, we'll right-click on it or Ctrl+click and do Set Script Trigger.
08:58We are going to pick a Script Trigger, called OnObjectModify and you
09:01want more information on Script Triggers, you can refer to the FileMaker Pro 12
09:07Essential Training title. Here I am going to choose OnObjectModify, which
09:10means we are going to run the script anytime the value is changed, so if the
09:13user picks one value and then they change it to another one or if they go from
09:16an empty value to a new value it's going to trigger the script.
09:19So what we are going to do is add a new script, by hitting this Plus sign here.
09:23We are going to just call it Sort by Choice. We are going to enter an If,
09:31so if the value in that Global field equals Company, meaning they've selected
09:41that option, then simply sort by Company only. And then we are going to use
09:55something called an Else If, to say if it contains the other values, Company.
10:05And then we'll say Payment, we can duplicate this and change and sort value.
10:19We can copy both of these to make this easy, duplicate.
10:24And the last one is Shipment, and we'll pick Shipment Status.
10:33So it's not a very complicated program, I mean that there is a lot going on here.
10:37We can also add another one if we want to that combines the different
10:41ones together, but let's just take a look at how this works.
10:44So you see the script is attached, we go into Browse mode, let's do a Show All.
10:50I don't have any value in here, so here's my List view. I just instruct
10:53my users to create a found set, go to this layout and then pick how they want to
10:57sort it. So if I say Company, this magically turns into a grouped company report.
11:01if I say Payment, you see that it will group it by Paid, Unpaid, those
11:06are the two different values. And of course shows the totals.
11:08And here is the one that doesn't have a status, so it shows up as blank.
11:12And I can group it by Shipment as well, so here is all the Pending ones,
11:15processing ones and Shipped. So really kind of magically, what we've ended up
11:18doing is allowing the user to create their own report on the fly. And all it is
11:22this is one simple layout inside of FileMaker where we add multiple different
11:26SubSummaries and allow the user to trigger those different groups by sorting.
11:30What I've also done in your exercise folder, I have added what's called a bonus
11:35report, which does something similar, but does it in sort of a combined fashion.
11:40I urge you to check it out, this is a layout that has a bunch of contacts.
11:44The user can choose to sort them by State, sort them by City or even the
11:49combination of City and State.
11:51It's the same concept with the script. You can see the script is built-in here.
11:57You can take a look at it. I urge you to pull this one apart, break it
12:00up, use it at your own disposal. It's the same concept that we've talked
12:04about here with the same type of formatting, so I urge you take a look at the
12:07dynamic report bonus file.
12:09Advanced summary techniques like this one can help you create sophisticated
12:12user-driven reports that automatically organize your data in logical grouping so that
12:17you and your users can just have one layout inside of FileMaker and you reuse
12:22that same layout and appear to create what look like multiple different types of
12:26reports inside your FileMaker database.
Collapse this transcript
Creating a crosstab report
00:00SubSummary reports like those covered in the previous movies will solve many of
00:05your reporting needs in FileMaker but there are some report formats that don't
00:08necessarily work that well in these SubSummary report or grouped format.
00:12Say for instance we are looking at the Invoice Summary No Body part layout
00:16in the exercise file.
00:17Our output is going to look like a column that has the customers and the
00:21other column shows the total invoice sales for whatever the time period is
00:25reflected in the found set.
00:28The report represents the correct data but a SubSummary report only displays
00:32subgroups as rows in a list.
00:34So a more convenient output format for most users would be what a lot of
00:38people refer to as a Crosstab report or a lot of people imagine when they
00:42think of a pivot table.
00:43A Crosstab report presents a summary of information both rows and columns, so
00:48you can see sort of the intersection of a row and the column will mean a
00:51specific piece of information.
00:52In this format it's much easier to perform comparative analyses and
00:55notice trends in the data.
00:57So SubSummary reports are built in as a FileMaker Pro tool, which makes them
01:01relatively quick and easy to build, but there is no native facility for
01:05FileMaker Pro to create Crosstab reports.
01:08But there is a technique to do so and that's what we are going to cover here.
01:11The Crosstab reports do take a little bit longer to develop. They are not that
01:15complex, but they require the creation of some new fields and they are a little
01:18bit less flexible than standard SubSummary reports, meaning you can't
01:22necessarily make them as dynamic. But they are very powerful and they can be done.
01:25It just requires a few steps that I am going to cover here in this movie.
01:30So nonetheless they're certainly worth the effort.
01:32Now the first step in creating a Crosstab report is decide which variable you
01:36are going to represent across the rows and which are going to be represented in
01:40columns. The rows are really going to be let's say in this case in this
01:45report here you see that we've got customers represented in each row.
01:49Let's stick with that concept and let's say that our objective will be to list
01:53each unique customer, that's represented in the found set just like we are
01:57doing here, but then we are going to show their invoice totals for each quarter of the year.
02:01So we already have the total at the end.
02:04You will notice if we go to the Invoices Crosstab layout, you will see that
02:08we've got all the 25 invoices that are in our database with the customers.
02:14You'll also see that there's another field in here that I've added to the
02:17exercise file that's called z_Quarter. If we quickly look at that you'll see that
02:25z_Quarter, as sort of a little developer tip here, uses a calculation
02:29function that can determine based on what a date is, what quarter of a standard
02:33calendar year, this date occurred in.
02:36So here it's the ceiling function that you see right there and the numerical
02:41value is the Month function; looking at the Month of the Date and then just
02:46simply divide that by three.
02:47So you divide the month by three and then round it up essentially to the next
02:52highest integer, that's how we get the quarter.
02:54So each record as they're created will get this value that says what quarter it's in.
03:01But what we'd like to do instead, is see unique customer and then their total for
03:05quarter one, total for quarter two, three, four so on and then the final for all
03:10those and then of course that would still reflect the found set.
03:12So that's what we are going to do.
03:14So the trick here is to summarize invoice totals by quarter and then display
03:18those in each of the columns.
03:20So each customer in the found set will appear on the Crosstab once. The orders
03:24for reach customer can be summarized by quarter and then presented horizontally.
03:29Now make sense to use the quarter as our columnar variable here, because the
03:33number and the times of the quarter are known in advance. So the idea there is
03:37that we know we'll only need to be able to build four quarters. You'll see
03:40when we get into this technique a little bit where it's helpful to sort of have
03:44a finite measurable list of columns.
03:46We could certainly do Months because there is only 12 of those, but we wouldn't
03:50want to necessarily have customers be the columns for example because we don't
03:54know, we could have 30 customers today, 300 tomorrow, it could change in the
03:58found set, so you want to go with some rigid measurable item or element that we
04:02could use as our column.
04:04So here it's going to be quarter which is actually quite common in Crosstab
04:07reports anyway, so we just have to do four groups of field in order to
04:11create our columns.
04:12So let's start in the exercise file here by going to this layout Invoices
04:15Crosstab. The layout is based on the Invoices table, just to bring you up to
04:20speed, based on the invoices table and it contains a body part that shows the
04:28following fields for each one of the individual invoices.
04:31Now the trick is going to be on each one of these invoice records is to identify
04:37the quarter which we've done already by creating the z_Quarter field.
04:42Now what we are going to need to do is say if it's quarter one, then say yes; if
04:48it's quarter two, say yes; if it's quarter three so on.
04:51So really what we are going to do is say, what was the amount if it was quarter
04:56one? What is the amount if it was quarter two? What is the amount of it's
04:59quarter three? So anyone invoice record will only have a value in either the
05:03quarter one amount field, the quarter two amount field, the quarter three
05:07amount field or the quarter four. Not any combination of those, but it's an either/or thing.
05:11So that's the first thing we want to do is create a series of fields under
05:16File>Manage>Database.
05:18That will give us the amount for quarter one, the amount for quarter two and so on, so let's do that.
05:24So I am going to go in and I am going to create, I am going to use a naming
05:26convention that's just z_, because I want all these to show up at the bottom of
05:30my list when I am sorting my field list alphabetically.
05:33So I'll call a z_Q1_Amount. I am going to create one of these for each one of the quarters.
05:39So I am going to go in and create a calculation. What I am going to do here is
05:43I am going to say Case, could be an If. I'll do the same thing here, I am
05:50just going to have in this case the one test.
05:53You could easily use the If. If and Case are interchangeable when you only have one test,
05:57but given that maybe sometime I might want to add additional tests I'll use Case.
06:01So what I am going to do is I am going to say If z_Quarter=1, then show the
06:08Grand Total field, that's the field that gives us a dollar value, that's the one
06:12that we are summarizing, otherwise give me nothing. So hopefully this makes
06:16sense. We are just simply coming up with a with an amount field that shows
06:20us an amount if the quarter is one and shows us nothing if it's not.
06:23And now I can duplicate this. This is where sort of the redundancy of
06:28creating a Crosstab field comes into play, because you'll have to create one of
06:34these for starters, for every column you're going to have. But you can see it's
06:40kind of easy in FileMaker where you can do the duplicating and copying and
06:43pasting and whatnot.
06:45So now create the Quarter 3 and we'll do one more for Quarter 4.
06:51So this is the first series of fields that we need to create.
06:55Change that, go in and change to Quarter 4.
06:59So real simply put, it's just as you can see in all of these, if it's first quarter, give me the total;
07:03if it's the third-quarter give me the total and so on.
07:05So for any one given record you'll only see one of these values.
07:09So for example if I widen this out just for the sake of showing you on screen
07:14what we have got, here is Grand Total.
07:18This isn't necessary for our reports, but just to kind of show you
07:23how this works. So I am going to put this on here temporarily.
07:27If you are following along, you don't have to do this, it's just for demonstration purposes.
07:37So let's just take a quick look at this and you will get the gist.
07:41So you'll notice this invoice was in Quarter 1, so it only shows up in the
07:45Quarter 1 column; this one was Quarter 2, it only shows up the Quarter 2;
07:48and the rest are blank. That should make sense.
07:50So now what we want to do is in order to show the data to our users is that we
07:55want to summarize each quarter.
07:58So very simply put, what we are going to do is create summary fields;
08:03File>Manage>Database. We are going to create a summary field for each one of
08:07the quarters and that summary field is just going to give us the total of Q1
08:11amount, the other one is going to give us a Q2 amount and so on.
08:14So I am going to say Summary, z_Q1_ Amount summary, give me total of, you
08:22probably guessed it, z_Q1_Amount.
08:24Now I am going to duplicate this and I am going to say z_Q2_Amount and change
08:31that to the z_Q2_Amount. And again this is where the redundancy of a crosstab
08:37comes into play, but it's not very complicated programming, even though it does
08:41take a little while to produce, but it definitely has some upside here.
08:46So you could go in, and we are almost done here, change that to Q4_Amount.
08:54So now you see all the different fields.
08:55We created one that identifies which quarter it is and then the Amount and a
09:00summary for each column.
09:01If you were to do months instead of quarters, you would have January amount
09:04and January summary and then February amount and February summary, all the way through December.
09:08If you did male and female, you'd have male amount, female amount and so on, so
09:12that's kind of how this logic works.
09:14So now let's go into Layout and remove these fields that I put on here just to
09:19show you and I am going to replace them instead by the summaries.
09:30Q2_Amount_Summary, Q3_Amount_Summary and finally the Q4_Amount_Summary and the
09:43column label as well.
09:47So it might make sense also for us to select these and hold down the Shift key
09:51so that we can apply the currency to all of them, so we got FileMaker decimals 2,
09:55Fixed number of decimals 2, thousand separator; good to go.
10:01So let's go into Browse mode and hit Save.
10:04And now we are not done, what we see is the same value in each one of these and
10:07that's because we have put a Summary field in the body part, we are not grouping
10:12of these things yet.
10:13So what happens when you put a Summary field in the body part is that it just
10:15shows you the total for the entire found set rather than just the total for this group.
10:20So what we have to do is instead of having a body part, we have to create mini
10:23found sets so that we can trigger these appropriately. The way that we create
10:27mini found sets in layout view is to use SubSummary parts.
10:31So let's change the body part to a SubSummary when sorted by company.
10:40Let's change the Footer to a Trailing Grand Summary and what we'll do is we'll copy
10:49all of these values, even the Grand Total for that matter down to the Trailing
10:53Grand Summary. So this will give us like our total for the whole found set,
10:57rather than just for each individual quarter.
10:59Now when we go into Browse mode and save our changes, we see that we still have
11:04to sort by our Company break field, so let's do that.
11:08And now what we've got is sort of a not yet stylized but a sort of crude version
11:13of each individual customer.
11:15The Grand Total amount, this is the amount that's actually just for each
11:18individual invoice. So what we need to do is change that to our Summary, Grand
11:23Total Summary and do the same here, Grand Total Summary and now we'll see
11:28we'll get sort of a crude version of our report, but looks all fancy.
11:32So we've got the total for all of Abbott Securities for this found set and it's
11:36broken down in between $611 in Q1 and $352 in Q3 and so on, see 322 here that's
11:43all on the fourth-quarter, a great way to kind of visually look at this. With
11:47some simple sort of formatting we could come in and give it a little line there
11:52for our totals on the bottom, and if we want we could stylize these columns a
11:58little bit, maybe do some column lines demarcations.
12:02We can probably get the dates of out of here as well and the quarters, grab all
12:09of this and move it over. Now what you end up with is a Crosstab report
12:17showing all the customers represented in a found set and how it's broken down
12:21by quarter. As I've been telling you in the rest of these exercises, I want
12:24to also drive home the fact that I can create a different found set, nothing
12:30for 2010, let's try -- we've only got one there, let's try this so we'll do
12:362012 instead, 2012.
12:40Three of those and we'll go to our Crosstab. So it tells us in 2012 that
12:44there are only two customers, here's their totals and we can see that all of
12:49those orders came in the fourth quarter.
12:51Again, another report using a SubSummary part that's driven by the found set and
12:56the sort order that your users send to this layout. So you might want to go into
13:00Layout mode as sort of the last item and update your Script Trigger, so you can
13:07pick a different sort order, so it's only sorting by the SubSummary part that's
13:12relevant here. Since I just sorted by it you'll see that when I go in here,
13:17it tells me Company, that's what I want.
13:23And when we go into Browse mode, now anytime somebody navigates to this record,
13:27even if it's all of the records here, we can see our Crosstab report generated.
13:32So a couple of quick things to keep in mind when creating Crosstab reports like
13:34this one; you'll need a Calculation field and Summary field for every column of
13:38data that you want to display.
13:40Therefore if you want a report that shows the months of the year, you'll need
13:4224 new fields, 12 calculations and 12 summary fields.
13:46And also another field that will determine which month of the year the order was.
13:50You will need to know in advance what the Column Header values are, so that you
13:54can explicitly define the rules for assigning records to a column.
13:56It's very difficult using these methods described in this lesson to create a
14:00Crosstab report with variable numbers or names of columns.
14:03So for example if we didn't know there were just four quarters, there could be
14:06any number of quarters that may be Crosstab report and this technique might not be as useful.
14:10A Crosstab report represents summary information in both rows and columns
14:14and each value in the table represents the intersection of two categorical variables.
14:19In this format it's much easier to perform comparative analyses and notice
14:22trends in the data, so you might want to consider creating a Crosstab report
14:25anytime that you need to summarize data by two categorical variables as it
14:30was in this case.
Collapse this transcript
7. Extending FileMaker Relationships
Reviewing relationships with multiple criteria
00:00Relationships in FileMaker Pro can and should be used to implement the basic
00:05primary key to foreign key relationships indicated in any entity relationship diagram.
00:10FileMaker Pro does in fact support related tables and relationships
00:15and it makes sense to use them.
00:16If any of that didn't make sense, or if you want to have a refresher or some
00:20additional background information on relationships in FileMaker Pro, please
00:24first watch the Relational Database Design with FileMaker Pro Video.
00:28It will serve as a great primer in this next section and is highly recommended
00:31and again that's Relational Database Design with FileMaker Pro.
00:35With that said, relationships in FileMaker Pro have many powerful uses beyond
00:39just establishing the underlying structure of your database.
00:42Of course if you look inside of our exercise file, you see that we have some
00:46relationships already set up. I am going to review these here and explain to
00:50you difference between what I call a base table relationship and what I like to
00:53refer to as a query relationship.
00:55I am going to use those terms throughout the rest of this title, so I am going
00:58to take this opportunity to define them.
01:01When I talk about a base table relationship, I am referring not only to base tables,
01:05as you see here I have got tables for Customer, Product, Invoice and
01:09ProductInvoices; forget the Company Info one now that's what we call Global
01:12table, that's irrelevant to this discussion but it was part of the starter
01:15solution so we are going to leave that in there for right now.
01:18But we'll concentrate really on these four.
01:20One record in Customer equals to Customer, one record in Product equals to
01:23Product and so on. ProductInvoice is one record equals a product appearing on an invoice.
01:29And when we map out our relationships, we determine that they all have to
01:34resolve in a one-to-many relationship and then we come into our relationship
01:37graph and we graph those appropriately.
01:40So what I have done here is I used a color-coded legend on the top to tell me
01:44which of these tables and actually more specifically these are referred to as
01:47table occurrences and it tells me which one is based on which underlining base
01:51table, so that red his Customer, green is Invoice and so on.
01:54So we see we have one to many, from Customers to Invoices, one to many from
01:58Products to ProductInvoices, and one to many from Invoices to ProductInvoices.
02:02You will see in each case, it's primary key to foreign key and all of those relationships.
02:08Pretty simple stuff, that's review, it's covered in other title, stuff that you
02:11probably already know already.
02:13But that is what I refer to as base table relationships.
02:16Every system should have those defined and that's how you can do things like
02:21drop a portal in the context of customers that shows all of the customers
02:26related invoices, pretty simple stuff.
02:28But now I am going to explain what this portal is.
02:30This portal here is only showing me not just invoices related to the customer,
02:34but specifically ones with a status of Paid. So let's take a look at how that's happening.
02:40You'll notice that I have more than one relationship between customers and
02:43invoices and those are down here where I have isolated them under this
02:47Query Relationships.
02:49You'll see that if you double-click on one of these table occurrences, it still
02:53says that it's based off of invoices.
02:55But I've named them something different.
02:58Normally I'll apply some sort of naming convention that tells me the starting
03:02point of the context and the ending point. But for the purposes of training I've
03:06left them as just sort of plain readable English.
03:09I could alternatively call this Customers_Invoices_Unpaid for example.
03:14But no matter what, each table occurrence must bear a unique name.
03:17You will be prompted to name each of these occurrences as you set it up in the
03:20graph. You can add new ones by clicking this button here in the bottom left
03:25hand corner; you've of course picked the table that you want, give it the name
03:28and then you can create your relationships accordingly.
03:31A single base table can appear many times in a relationship graph and could
03:35participate in several different relationships. As you see here, it could
03:38potentially appear in several different relationships back to the same parent table.
03:42And you see examples of this throughout the rest of this chapter.
03:45The only unbreakable rule governing table of currents creation is that the
03:48relationship graph cannot have any loops in it. So that means there must be one
03:53and only one path between any two related table occurrences.
03:56To understand what a loop is, and when you encounter one, you need to know one
04:00very important point. And that is, all base tables are related to each other
04:04through this chain of relationships. So for example customers table is actually a
04:09related to products because it's related Invoicesm which is related to
04:12ProductInvoicesm which is related to Products.
04:15So that's why you can drop a portal based on the products relationship onto
04:19a layout in the Customer's table and it will actually show you some related information.
04:23So what that means is that I can't create a loop by trying to create a
04:27relationship directly between customers and products, because FileMaker will say
04:31you cannot have more than one relational path between any two tables in a graph,
04:34another occurrence must be created.
04:36So I could in fact create another relationship directly to products, but that is
04:41something that we don't need in this particular exercise, but something you will
04:44see later on though, we certainly could do that, but it's important to remember
04:48that these tables are already related to each other.
04:50Now even thought we are relating primary key to foreign key in the initial
04:54relationship between Customers and Invoices,
04:56if we look at the Unpaid relationship we still start off with the primary key to
05:02foreign key relationship.
05:03So that way what we are seeing in this portal for example are still going to be
05:07invoices related to the customer, but we are adding an additional criteria.
05:11That's where I call these query relationships.
05:13I define a query relationship as any relationship between two tables that
05:17has multiple criteria that is not the base table primary key to foreign key relationship.
05:23And I call them that because in other platforms, this is really how you create a query.
05:28You basically just say, show me all the invoices where my IDs match and where
05:34the payment status equals unpaid; that would be a query statement in some other databases.
05:39Now the main idea behind all this of course is that the MATCH FIELDS work. So
05:43if we look at how the MATCH FIELDS work in this relationship we see here's all
05:47the related invoices; this is customer 18 and of course when I click on this
05:52invoice it's got Customer ID value in it and so do all the related ones,
05:55they are all customer 18.
05:57And the reason that this record does not show up under Lightningfast is because
06:01it's got customer ID 522.
06:04So that's what makes all of these show up. Additional criteria of what make
06:08the ones in the bottom show up.
06:10So if you look in Layout mode, you'll see that we've got a portal for invoices,
06:15which is based on the base table but now we have one that's based on Paid Invoices.
06:19So we can create additional portals for these query relationships or use them in
06:22other ways, which we'll cover later in the chapter.
06:24But if we look at Paid or Unpaid it just means UNPAID MATCH FIELD equals Payment Status.
06:30Now the Match fields, the trick there is you'll just see that this is
06:37putting every record in the database when you open up the file for the first time,
06:40it's putting the word Unpaid.
06:41So basically what we are doing there is we are saying show me all my invoices
06:46where Payment Status equals Unpaid. Or here, same thing, show me all my invoices
06:53where Payment Status value in the invoices equals the word Paid. And that's it.
06:57That's how we are constructing a query inside of FileMaker and in FileMaker in
07:02the product we call those relationships.
07:04So once we have those in place, we can build calculations based on them and
07:09use them in scripting and do all sorts of other things, as you'll notice that we've got here.
07:14So the takeaway from this discussion, here is that you'll always need to set
07:18up your base table one to many relationships with one pair of primary to
07:22foreign key match fields.
07:23But then FileMaker also allows you to extend your relationships by creating
07:27multiple criteria driven by these query relationships.
07:30That's really where the power of FileMaker comes into play.
07:33So create your base table ones, but don't forget there is a ton of other ones
07:36that you can create. These query relationships will become an important tool
07:40in your FileMaker toolbox so to speak.
07:42And we are going to cover them all throughout the rest of this chapter here
07:46on relationships.
Collapse this transcript
Understanding user-driven relationships
00:00In the previous movie we discussed a little bit of a review about how you can
00:03define match fields in a relationship to dictate which records will be
00:06related between a parent table and a child table, referred to those as base
00:10table relationships.
00:12However, what if you want the user to drive the criteria?
00:15For example, if you want to have a user tell you which records you want to have
00:19show-up in a portal based on certain statuses or date ranges or whatever it is.
00:23In FileMaker we refer to those as user driven relationships and they can be
00:27extremely useful within your FileMaker interfaces.
00:30So I am going to show you a demonstration of this here. For example, let's say
00:34that the story here is that we want to have a dashboard layout and that's just
00:37something that we call a layout that allows users to gather all the topline
00:41information that they need.
00:42So in this example of a dashboard layout we would like to put a portal on here
00:46that could potentially show all the different invoices in the system. But we
00:50want to just have it be a one-stop shop where user can go in and click on and
00:54say I want to see all the paid ones, I want to see all the unpaid ones and
00:57that's it. Maybe also possibly narrow it down by date range.
01:01It's the same kind of thing that they are doing if they are doing a search or a
01:03query in your database, so I like to call these query relationships.
01:07So first thing that we need to do is to come up with the layout that we are
01:10going to use as our "dashboard".
01:13I have already got one set up inside the exercise file. Real quickly this
01:17layout is not based on any table, it's just based on this Customer Info table
01:23that was created as part of the starter solution.
01:25But don't try to wrap your head around how the Company Info table fits into the
01:29entity relationship structure, it doesn't.
01:31It's not a base table, it's not an entity.
01:33It's a Global table, which is an unofficial sort of FileMaker development term
01:37used to describe a table with just one record in it, which means that it has no
01:41context in the scope of all the other base tables.
01:44But it's kind of a utility thing.
01:46It allows us to do something like create this relationship or create this
01:49dashboard layout that we'd like to.
01:51It's a common practice for creating a layout that acts as a utility and you can
01:55use it for techniques like the one I am showing you here.
01:58In this example the starter solution already had one of these tables created,
02:01but they did so for the purpose of creating the Company Info layout, which
02:05provided an area for you to put in the logo, the company name,
02:08header and footer information into one record in the database.
02:13Then since that one all these fields are globally stored fields or connected to
02:20the product's invoices, it could then pull in header, logo, whatever information
02:25into the printouts and the products and invoices.
02:27That's what it's there for now, but we are going to use it for something different.
02:30So first what we need to do is create a relationship between the Company Info
02:35table and the Invoices table.
02:37Because in this exercise what I am going to do is create a portal that shows all
02:40the invoices, but allows the user to interact with them.
02:43Before I create the relationship, I need to have a match field in place.
02:47Now this is one of the key elements of creating a user driven relationship is
02:51that you need to have a field that the user can interact with. Commonly this
02:56field is one that is not an attribute field or a field that describes some
03:00element of whatever it is that you've stored inside a table.
03:03So since we have got a Global table we don't have any true attributes in there.
03:07So I am just going to create a utility field and I am going to call it Dashboard filter.
03:14I am going to create a text field, and now what this field is going to do,
03:18its role is just simply to have the user pick either the term Paid or Unpaid.
03:23Then that's going to connect over to the Payment Status and the Invoices,
03:26which we'll get to in a second.
03:27But first I am going to make this a globally stored field by clicking Storage
03:32and checking the Global Storage.
03:34The reason for that is because even though there is only one record in this
03:37table and there only ever will be, we don't need it to pass the value across all
03:40the records in the table.
03:42But in fact what we want it to do is be session-specific.
03:45So one user logs into the system, they can pick a filter value in their
03:49dashboard and another user can pick another filter value in their dashboard.
03:52So Global fields have the added bonus of being session-specific when they are
03:57being hosted in a multi-user environment.
04:00So now we create the relationship.
04:01It's going to be a query relationship so let me open up this little area here.
04:05Now I am going to create a new table and this table is going to be based off of invoices.
04:10I am going to call it companyinfo_ and what I like to do is I like to do the
04:17starting point or the context that I am using this in as the first word in a
04:21relationship, so that's companyinfo, make it all lowercase.
04:25Then I'll put in all caps the table that this table occurrence is based off of
04:29and that's INVOICES.
04:30Then if I need to, I can put an underscore and some other information
04:35let's say filter, indicating that, oh, this is the one that I am using that's go the filter value in it.
04:40This is unofficial. This is just a suggestion as far as a naming convention is concerned.
04:44So I am going to move that down here. I am going to open it up a little bit, so
04:49we can see the name, and what the heck, let's give it a green color, there we go.
04:55So now what I need to do is create the relationship between Company Info and
04:59Invoices. I am going to grab that Dashboard filter, because remember, that's
05:02going to be a match fields here and it exists so that that user can enter a
05:06piece of data into that field.
05:08Actually, let's scroll down a little bit. What we are going to do is go to Payment Status.
05:14So if we collapse these a bit, we'll see that the relationship is just the
05:19DashboardFilter value that the user enters equal Payment Status.
05:22So the user is either going enter paid or unpaid and that's going match records
05:26with either paid or unpaid in it, pretty simple.
05:28Now let's go back to the Dashboard layout and on this we are going to draw a
05:33couple of different elements.
05:34First we are going to put the field, which is the Dashboard filter so the users
05:39can type something into it and then I am going to add a Portal.
05:44So let's add a portal and of course we have to pick which relationship this
05:48portal is going to display and that of course is going to be our
05:51companyinfo_INVOICES_filter relationship that we created earlier.
05:54We'll do a vertical scrollbar.
05:56And now we need to pick the fields.
05:58So let's say on this field we want to show the InvoiceID, the Date of the
06:04invoice, and the Grand Total of course, and even the Payment Status, since of
06:09course that's what we are going to be filtering on.
06:12And now one important thing we might want to show here is the name of the
06:16company that the invoice is based off.
06:18But the Company field doesn't exist in the Invoices table.
06:20As a matter of fact in all the other portals, what we are doing is we are
06:25pulling the name of customer from the relationship into the Customer table.
06:31So what we need to do here is have a relationship that goes from
06:36companyinfo_INVOICES_filter over to customers that will allow us to display this.
06:40It seems a little odd, this is usually a kind of tough concept to wrap your head
06:44around, but the idea is we are basing our portal on this context, so all the rows
06:49in the portal are based off of this context.
06:51So we need to be able to pull in a related field and just like you want to
06:56display a related field in the context of a layout, the table that that layout
06:59is based off of, or the table occurrence that layout is based off of,
07:01needs to have a relationship to whatever table you are pulling the fields in from.
07:04So suffice to say, you need to create another relationship. We'll call it
07:10companyinfo_invoices; don't have to put it all caps now because that's not the
07:16table that this is based off of. We'll say CUSTOMERS and maybe I'll put
07:20filter in there as well.
07:24Okay, and we'll put that over here and we'll say CustomerIDfk, so let's shrink these down.
07:39Sometimes what I do is I just drag any field and then I open this up, but it
07:43gives me a little bit easier canvas to create these on.
07:46So it's going to be fk to pk, oops!
07:48Let's get rid of that, Customer fk to pk and we'll hit OK and make that red.
07:57Okay, so now I can choose from customers and I can get the company.
08:05These all came from the first table occurrence we created and then we created
08:08another table occurrence related to this one, which is represented by each row
08:11in the portal, and now we can place all that information on there.
08:15So let's go look at this a little briefly in Browse mode. We don't see
08:19anything at all because there is no value in the match field.
08:21So let me just type in Paid and now we see all the paid ones and we can say
08:26UnPaid, commit it and see all the unpaid ones.
08:30Now the user isn't going to want to type all those in, so why don't we just
08:33quickly create a value list and put in Paid or UnPaid.
08:44We'll go into Layout mode and we'll give it, let's say a checkbox; show you
08:50something kind of interesting here. Paid status, so go into Browse mode and
09:00check Paid, shows all the paid; check UnPaid shows all the unpaid; or check both
09:05of them and it shows both.
09:08So it's an interesting thing about a checkbox is that what it's really doing is
09:11creating a return delimited combined key.
09:14If you use that on the parent side, you have multiple return delimited values in
09:18your primary key, all the matching records will show up of both of those.
09:22So you could have several of these and they'll all show up inside the portal.
09:26So this is an example of providing a single field with a value list assigned
09:29that will allow users to drive the related values that they're seeing, in this case in a Portal.
09:35This can also be used to do something like create items for a report.
09:38In the next movie I am going to actually show you how to add date ranges to
09:41this as well.
Collapse this transcript
Using ranges in user-driven relationships
00:00In the previous movie we discussed how to set up what I would like to call a
00:04user-driven relationship.
00:05So we've gone into our Relationship graph and created a couple of different
00:10relationships, one that went from what is called a Global Table Company Info,
00:16to the Invoices Table, and then from Invoice Table using Customers.
00:20But the real one here was this Relationship we created in the middle that
00:23allow the user to populate field that we call the DashboardFilter with either
00:27a Paid or Unpaid status.
00:29And then in turn what we did is put that field right here, the DashboardFilter
00:34and a Relationship based on the DashboardFilter, onto this Layout.
00:39So what we want to do now is add additional criteria to it.
00:42So not only are we are going to allow the user to pick Paid or Unpaid, but we are
00:44also going to allow them to pick the Start and End date of the range of Invoices
00:49that they would like to see.
00:50So we are going to further embellish the Relationship that we already created
00:53or the Query Relationship as I like to call it.
00:56But what I need are two more match fields on the Dashboard side or on
01:01the Company Info side.
01:02So let's go in and hit Manage>Database> Tables and we are going to add two more.
01:08We are going to allow the user to pick the StartDate and the EndDate and
01:11anything within that will be the range.
01:12So let's call it StartDateFilter, and we'll make this a Date field and we'll hit
01:20Create, and I'll say that, that is globally stored so that it is session
01:25specific and I am going to do now EndDateFilter.
01:34And now we've got a global field for the StartDate and global field for the
01:38EndDate, which accompany our DashboardFilter that the user is populating.
01:43So let's go incorporate these into our Relationship.
01:47So here's our existing Relationship already that we are using for the Dashboard portal.
01:50So I'm going to add now is a Relationship between whatever the user picks and
01:54puts into the StartDate and the InvoiceDate field.
01:59But instead of using the equal sign, what I am going to use is another one of these operators.
02:03So here I am going to say when the value in the InvoiceDate field is greater or
02:08equal to the value that the user puts in the StartDate, then show it.
02:13So I am going to add that, so now we have multiple criteria.
02:16And I am going to do the opposite here for the EndDateFilter.
02:20So I am going to say, whenever the value that's in the Date field is less than
02:24or equal than the value that the user entered into the Date, show that.
02:28So now they are going to pick Paid or Unpaid or both, they are going to give
02:32us a StartDate, give us an EndDate, and all that criteria is really again is
02:36creating a query here, because we're searching or we're asking a question of
02:40the database and it's going to respond back with the results of that query, but
02:44we are just doing that through a Relationship, and then in the user is driving the Relationship.
02:49So let's put this into practice, we'll hit OK and instead of just having this
02:55field, let's add a couple of others here.
02:57We will add the StartDateFilter there, open it up a little bit, let's make it a
03:03calendar dropdown, we will show the icon, and then I'll hold my Option key down
03:08because I am on Mac, or I can do that Ctrl key on Windows, and I am going to
03:13pick the EndDateFilter. So here we go.
03:15Let check this out in Browse mode, Save our changes.
03:19So let's say first we want to see Paid and now we have to give it a Date Range.
03:24Once we had all this criteria, we have to add some value in there.
03:27I'll address that in a second.
03:29But let's type in 1/1/2013 and I'll type in 3/1/2013 and hit OK. Sure enough,
03:38we end up with four Paid records, all within that Date Range.
03:43I can even add Unpaid and we see those are all within the Date range.
03:47You'll notice that we've got totals for all of them, Paid and Unpaid, and they
03:50all fit within that filter.
03:51So we can allow the user to manipulate these things, and also, we can make this
03:55Relationship drive sort of a calculator; make it not only a Dashboard, but a
03:59Calculator. Let's say that they want to know what the total of all Invoices is
04:03based on whatever criteria they are entering. Well, that's pretty easy.
04:07We discussed this in the chapter discussing Aggregate Functions using related
04:10values. So what I am going to do is add something that we call
04:14SummaryGrandTotal and I'll make it a Calculation.
04:21I am going to use the Aggregate function for Sum, and all I am going to do
04:26is point to the relationship that we've been using here, and I am going to pick
04:30the Grand Total amount. Oops!
04:32Let's get rid of the parameter information first, and then the Grand Total
04:38amount, and that's a Number. We'll hit OK, and OK again. Let's put that on
04:43the Layout, SummaryGrandTotal, open it up a little bit, let's make it Currency.
04:55So now we can see these values change based on what criteria we are entering,
05:03and the different Date ranges and whatnot.
05:05Now the only thing that's a little bit awkward about this is that if you don't [00:05:079.07] have any values in any of these fields, then nothing shows up.
05:11Well, I have got the answer to that as well.
05:14Since these values are going to be session specific, it doesn't hurt for us to
05:17put some default values in there.
05:19So what I would like to show you to do here is we will go into Layout mode and
05:24we will invoke the Layout Setup where we can create a Script Trigger.
05:27So I am going to say whenever we enter the Layout, so whenever somebody
05:31navigates to it or brings it up through a script or whatever it is, we are going
05:35to create a New Script that's called SetFilterDefault and it is going to be a
05:42series of SetFieldScripts.
05:43SetFieldScript steps of course, are used to pick a field and put a value into it.
05:48So the first one we are going to do is the DashboardFilter.
05:52I am going to do a little trick here.
05:53And I am going to say Paid, and then I am going to put a Return character in
06:00there and I am going to say Unpaid.
06:03The reason I'm doing that is because it's a checkbox and in order for both
06:07values to show up selected in the checkbox, I need to separate them with Return
06:10character. That will also make our Relationship work, because I have got
06:14return delimited primary key values.
06:17And I'll do another one, and we will pick StartDate Filter, let's call it --
06:24that will start with whatever the CurrentDate is, just as some sort logical and
06:29still dynamic starting point.
06:31So now I am going to say EndDate, let's say CurrentDate+365, how is that?
06:38And then what I like to add for good measure is a Commit Record/Request to make
06:47sure that we add those values and then commit the records so that there aren't
06:50any that are left uncommitted.
06:53So now go into Browse mode, let's navigate over to this layout.
06:58Of course, we've just logged into the database for the first time we would do this as well.
07:02Now you see that it's given Paid and Unpaid already, so that there's value
07:06in there, it gives us a SummaryGrandTotal number; it gives us at least a starting point for filtering.
07:11This is kind of an out-of-the-box example of creating a Dashboard with the
07:14dynamic calculator that resets dynamically for each new session.
07:18But what it does show is that one of the most powerful tools in FileMaker is the
07:21ability to create customized query relationships with multiple criteria and then
07:26those can drive either custom portals or as you see here;
07:29drive a value in an Aggregate Calculation.
07:31Getting used to relationships with multiple criteria, much like the ones
07:34that we've don't here is really a core concept behind this skill set and is
07:38something that can absolutely help you take your FileMaker databases
07:41to the next level.
Collapse this transcript
Creating a "self" relationship
00:00Standard Relationships in FileMaker are going to be between one table occurrence
00:04and another table occurrence.
00:06Now in the examples that we reviewed so far in this course, we have been making
00:09relationships between Table Occurrences that are based on two different tables.
00:13For example, you can see the Customer Table related to the Invoice Table, and a
00:19couple other examples here of those or the Products Table related to the
00:25Products Invoice and so on.
00:27But when it comes to this complex, or like I like to call them, query
00:30relationships, we can have one table occurrence be from one table, and as we see
00:35here another table occurrence from the other, so two different contexts.
00:39And we saw that in the previous examples, where we were using the
00:43Dashboard relationships.
00:44So we have the Dashboard Table is one context and the Invoices Table is another.
00:48But in this movie I'm going to show you how you actually create a relationship
00:51between two table occurrences that are both based on the same table context.
00:56That's what we refer to as a self relationship.
00:58Sound like an odd idea, but let's say in our example we've got this relationship
01:03based on Invoices and over here in this corner, I want to put a portal on here
01:08that helps our customer service or our order entry people see all the different
01:12Invoices from the same customer.
01:14So that way the customer service people can see when the last order was,
01:17what their frequency is and different tendencies and stuff like that.
01:20So in order to do that if you think about it, the context is going to be
01:23the Invoice Table, but the context of the portal is also going to be the Invoice Table.
01:28So I need to create a relationship between Invoice and Invoice.
01:31So let's go into our Relationship graph. We already have a relationship that's
01:34based off of Invoices.
01:36So what I need now, is one that's also based off of Invoices. I am going to
01:40create a new one, I am going to pick Invoices, and I am going to call this one
01:44INVOICES because that's the contact where we are starting from, and this is the
01:48current contacts where we are going to, and we'll say samecustomer.
01:53invoices_INVOICES_samecustomer.
01:55So here's my Relationship, make it a little bit larger and we'll make it green,
02:02and now this is really where the trick comes into play.
02:04In this technique, if you remember, our goal will be, we will have a layout
02:08that's based on the Invoice Table Occurrence, and in a portal, show all of the
02:11other Invoices that have the same customer.
02:14So what we are really saying is that the records that will show up in the
02:16portal must have the same customer ID as the selected Invoice record that we are on.
02:22So we have got this field here called CustomerID and if I just simply
02:25match it to CustomerID, that means that if I'm on a record with CustomerID18,
02:30it's going to show me all the Invoices that also have CustomerID,
02:37the CustomerID, here we go.
02:38CustomerID18, show me all the Invoices that have the CustomerID foreign key
02:43value of 18 as well, pretty simple stuff.
02:45So CustomerIDfk will be our match field on both sides of the relationship.
02:50So now let's place a portal based on this relationship on to the layout.
02:58Here we go. I'll draw a portal and let's pick the relationship that we just created,
03:04which is Invoices_INVOICES_samecustomer, and I'll do a vertical scrollbar,
03:08I'll pick a couple of fields.
03:10So let's say the Date, the Grand Total, Payment Status, and the Ship Date.
03:20Just for this exercise I am going to put the InvoiceID on there as well.
03:28So now we see all those different fields, and of course we can go in and we
03:31can add some field columns if we want to, but let me show you something when we
03:35get into Browse mode.
03:37First of all we see that we need to resize this, so just a quick discussion on
03:41resizing; I can pick the portal and you'll notice the appearance over here,
03:44it's locked in the upper left-hand corner. I need it be locked in to the bottom left-hand corner.
03:47So let me pick that, do the same thing, I'll hold down the Shift key for all
03:54these fields, and I'll change them from the upper left-hand corner to the bottom left.
03:59Let's just quickly look from a formatting standpoint how that changes. So there we go.
04:04Also, we've got a question mark in the one field, so what that means is that we
04:07just need a little bit more space to show that value. InvoiceID can be a little
04:14bit smaller, get rid of that Z that was unintentional and let's make Grand
04:21Total bigger, and format it as Currency.
04:29All right, now let's take a look at what we have got. Great!
04:32So as we go from record-to-record, we can see all the different Invoices that
04:37were created by the samecustomers, so here is all the other Lightningfast one
04:40and we can drive what other information that we need.
04:43Now here's a one thing that's kind of interesting though is that you'll notice
04:46the first record in each of these is the same record that we were on.
04:50It's a little bit redundant information. These are Invoices from the samecustomer.
04:53We want to kind of remove that from the context.
04:55So we can just do one quick update to the relationship, which is common in
05:00these self relationships. And that is where we are going to say, if the
05:04InvoiceIDs match, we don't want to show it.
05:06So what we will do to add the additional criteria is say show me everything
05:10where the CustomerIDs are the same, but where the InvoiceIDs are not.
05:15So what that will do is show me all of the Invoices, except for the one that
05:18we are actually on.
05:19So let's see how that changes.
05:22Now we see we just have the one and here the top one is no longer the one that
05:26we are on, that's enforced all the way throughout where there are other related Invoices.
05:31So FileMaker's Relationship graph allows you to create all sorts of query type
05:35relationships between table occurrences. You can even create relationships
05:38between two table occurrences that are based on the same table.
Collapse this transcript
Working with cascading portals
00:00Portals in FileMaker are primarily use to display related data in the context of a parent record.
00:05So for example we've got the Customer Details here on screen.
00:09This is a Layout that's based on the customer context, and here we're showing
00:14related data from a child table.
00:16So the idea here is that, we put the portal in the context of customer to show
00:20related child records from a child table, which is called Invoices.
00:24In standard one-to-many relationships placing a portal based on the child table
00:28on a layout, based on the parent is a basic use of the portal.
00:31It's intended to see related records while looking at the parent record.
00:35In previous movies we looked at ways that portals can be used for other purposes
00:39besides just looking at child records from the context of a parent.
00:42And in this movie we're going to create a portal on the Customer Details layout
00:46that displays all of the product invoices records.
00:49whenever a user selects the Invoice from the portal above.
00:53So one of the strikes here is that, each invoice has many different items on it.
00:57In an earlier movie we added this rollover here where, if you hover over the
01:01icon you can see all the different individual items.
01:04What if we wanted to see more information about those items? How about we put a
01:08portal on the layout, so that when you click on this, it populates the portal
01:11with just the related records from the chosen Invoice? Seems simple enough and
01:15certainly could enrich our layout here for the Customer Details.
01:19First we have to take a look at the relationships that we already have.
01:23You'll notice that we're on Customer, we're seeing Invoices.
01:26Now we're going to want to portal that shows product Invoices Records.
01:30But that means we're going to have to have a relationship between Customers and
01:33Product Invoices directly, which is a little bit weird, it's certainly not a one-
01:36to-many, but this will allow us to "drill down" into what our called grand child
01:41records, so parent child, grandchild.
01:43So we do need a relationship directly from Customers to Product Invoices.
01:47So the question of course is what's the match field then?
01:50We need to have a field that tells us inside the Customer table which Invoice it
01:55is that we want to see the Product Invoices records for.
01:58So that seemed easy enough.
01:59But you might be wondering why can't I just put portal based on this
02:02relationship already on the layout.
02:04Well let's take a look what happens when we do that.
02:07So let's say we draw portal and we'll call it ProductInvoices and do a
02:18scrollbar, we'll just say Amount and Part Number, Quantity, Unit Price for example, okay.
02:28So now we go into Browse mode and certainly we do see related data.
02:34What we're actually looking at are all of the ProductInvoices from any Invoice
02:40related to the Customer.
02:41But what we want is we want to pick a certain Invoice and have it only show
02:46those product invoices, so again that means that we need to have a MATCH FIELD
02:49in the Customer in table that only contains the ID of a selected Invoice.
02:53So what we're going to do is we're going to create a Field in the Customer table,
02:57and we're going to call it InvoiceIDset. No particular reason why, but
03:04I'm going to create that make it a text. And as with a lot of these other kind
03:09of interesting utility relationships. I'm going to make this one global, that way
03:13its session specific.
03:14So one user can pick an ID on their record and it's not going to mess up
03:19another user's experience.
03:21So another user isn't going to see some other ProductInvoices portal get
03:24populated. So making it global, just simply means that its session Independent.
03:30So now we'll look at our relationships. I want to create another table
03:33occurrence from ProductInvoices. We'll call this one customers, because
03:38that's our starting context underscore PRODUCTINVOICES that's in all caps,
03:46because that's what the table occurrence is based off of where it's a data that
03:50we're seeing and we'll just say, Select.
03:53So now, we want to create a relationship. This is something that I like to do
03:59instead of scrolling through all of these I'll just pick two of them, and then
04:02just double-click on the equal sign, so that way I can more easily find the
04:06ones that I'm looking for. So we'll say InvoiceIDset to InvoiceIDfk. The
04:11reason for that is because we're going to populate this with the InvoiceID that
04:15was chosen by the user in the top portal, and so we want that to show product
04:19invoice records that already have that same ID value in the foreign key field,
04:24thus meaning they are related to the invoice that was chosen.
04:29So InvoiceIDset, which is this new global user interactive field, and then the
04:33existing foreign key field, so let's hit OK, let's go ahead and make that one
04:38purple, just to stay consistent.
04:42Now, let's replace the one that we have on the Layout with this new one we
04:48created, so that's going to be Product customer_PRODUCTINVOICES_select.
04:53Actually we'll just create another one from scratch, so don't have to update all of those fields.
04:59Okay customer_PRODUCTINVOICES_select, scrollbar and let's do
05:08the Amount, Part Number, Quantity, and Unit Price.
05:17And we'll put Part Number first, Okay.
05:24So now we'll go into Browse mode and we're going to see that this portal isn't populated.
05:30Even when I click on one of those what it does is it's navigating me over to the
05:35original layout, so we're going to change that.
05:38So what I need to do is make it so that when I click on this it populates that field that we created.
05:44We actually put that on Layout here so you can see it.
05:49So here is InvoiceIDset, now I could do this manually, so if this is Invoice 6,
05:58I could just type in 6 and commit.
06:00And there are the items you can see we can cross-reference this a little bit
06:04glasses, I have don't have the ID name on here yet.
06:07But if I did want to add the name of course, since I need to add it to the context of this portal row;
06:14that means that, that table occurrence at the portal rows is based off, of it
06:18needs to have a relationship with the Products table.
06:21Double-click this one copy, create a new one, base it off, of Products, use that
06:29same one in this set instead of select.
06:33So Product and we're going to say select. But this one is going to be showing the products.
06:43Here we'll make it, just pick two of them again and we'll change those here, so it's ProductID, the ProductID.
06:52All right, and the reason behind that is simply that I can now show those items
07:04on the layout, so we'll do Amount, Unit Price, make those smaller. Now in the
07:11context established in this portal row
07:13I can add a field based on the relationship to show me the item, all right.
07:21Just wanted to show that to you again because that's pretty common practice.
07:25So here is the children's bicycle helmet, as you see Portable pump Unisex
07:30glasses and all the other corresponding information.
07:33So the idea here is that instead of the user having to populate this, why don't
07:37we make a script populate that.
07:40So here is that button that already has a script attached to it, a go-to related
07:47record. Instead, what we're going to do is we're going to create a new script and
07:53we're going to say, SetInvoice and that'll be Set Field, pick the ID, set and
08:06what we're going to do is pick the related InvoiceID.
08:11So a Set Field will work in the context of whatever portal row the user selecting it,
08:15it'll pick the InvoiceID of that portal row selected, and then,
08:19place it into the field, and then as with any Set Field we want to follow it
08:26with a Commit Records/Requests, especially when it's driving a relationship.
08:31So now let's go in a Browse mode and try out our new relationship. So here ID 1, ID 8.
08:39So now that what we're able to do is have a relationship from Customer, and
08:43then to Invoices, and then from Customer to ProductInvoices, which allows us to
08:48provide the appearance to the user that they're drilling down into that relationship.
08:53But one thing that might not be such a bad idea is to add a OnRecordLoad, meaning
09:02every time we go from record to record, we're going to clear that filter out.
09:07Because otherwise you could navigate from one record to the next
09:12and the next record will be showing the product IDs from the previous ones.
09:15So we're just going to do a little nice clean sort of make sure we're empting
09:20that out every time we navigate to a new layout, and let the user pick the one
09:24that they want, so IDset and we'll say, quote, quote.
09:28And of course, as always, follow with the Commit Records/Requests hit OK, hit OK.
09:38And now let's look at our Browse mode.
09:41So we see anytime a record is created, so we'll populate it with that one, go to
09:45the next record, clears it out, populate it with that one, next record and so on.
09:49So query relationships have many uses in FileMaker, and in this example we see
09:53how you can use them to allow your users to, what appears to them at least,
09:57drill down into related data through a set of different portals.
Collapse this transcript
8. Scripting for Developers
Conditional branching using the If script step
00:00Earlier in this course, I discussed the If function that's used inside
00:04calculation formulas and also calculation dialogs. I explained how it could
00:09help you add conditions to your calculation functions.
00:12At the time I also mentioned that there is one other area inside the FileMaker
00:16Pro development environment where you can also add conditions. That's in the
00:20Scripts by using a Script Step that's called the If Script Step.
00:25When you introduce conditions into your Scripts, this is commonly referred
00:28to as conditional branching.
00:31Conditional branching refers to the ability of a Script to be able to perform
00:34different sets of actions under different circumstances.
00:37If you look inside the Script Maker, you'll see that we've got the If Script
00:45Step which comes with its companion End If.
00:48We've also got Else If and the combination of these allow you to introduce
00:54either one or multiple tests and then, based on whether or not that test is true
00:59or false, you can then run some other activity.
01:01So the If and Else If Script Steps require you to provide a calculation,
01:06as you can see. You'll see the familiar Calculation dialog, and then whatever the
01:10formula is. It's going to be Boolean, so it's either going to have a true or false answer.
01:15So if true, then whatever the task is that's inside between the If and the End If,
01:21well that will be performed.
01:23If it's false, it will move on to the next test, just like you do inside of a
01:28branching calculation formula.
01:30So when you are planning on adding conditions into your scripts, you need to
01:33decide what the test is going to be. And it needs to be a Boolean calculation
01:37formula that will either have a true or a false answer.
01:40Then you'll decide what script actions are going to be performed when true,
01:44and potentially which ones might even be performed when false.
01:46Just like in a calculation, you're going to decide what values are displayed if
01:50the calculation test is true, and then what is displayed when it's false.
01:55So let's look at our example file and let's come up with a scenario here.
01:59One thing you might notice is that we've got a Print button on each of the
02:02Invoice records and when I hit the Print button, it pops up a new window
02:07with this stylized invoice that's created.
02:10The problem is, if a customer has already paid, we'd rather have it produce a
02:16statement or a receipt, let's say rather than the invoice.
02:19So for example you'll notice that we've got an Invoice Layout and we have a Receipt Layout.
02:24So if they've already paid for it, we'd like it to show, here is what you paid,
02:28Thank You For Your Order!, all that type of thing.
02:31But if it's not paid, then yes, we'd like to show it as an invoice, so that
02:35we can give other information like when it's due and what the subtotals are
02:38and that type of thing.
02:39So basically, we've got either an Invoice Layout or a Receipt Layout.
02:44We would like, when the user hits that button, for it to automatically go to the
02:49appropriate layout based on a condition that we're going to introduce in the script.
02:53So it makes sense that we would want to update the existing scripts. So why
02:56don't we go into the Layout mode and let's right-click on that button, so we can
03:03see what script is assigned to it.
03:04We've got one that's called Print Invoice, so let's go in and select Edit and
03:10say Print Invoice or Receipt.
03:14First, we're going to change this and right now all it's doing is performing a
03:18Go to Related Record Script Step, which of course does a couple of different
03:21things; it opens up a new window and navigates us to the proper layout.
03:25So we're going to want to have two different Go to Related Records, because
03:27we're going to change the layout, but first we want to introduce our If.
03:32So let's double-click on the If and we see it gives us an End If.
03:36So in between those is where we say what the test is and what happens if it's
03:40true, what happens if it's false.
03:42So let's first add our condition.
03:45So we're going to say, when Payment Status="Paid", if that's true,
03:55then we want it to go to the one that says Invoice; this is correct.
04:00So now what we want to do is introduce what happens if it's false.
04:04In that case, what we want it to do is go to same thing, Go to Related Records,
04:07but a different layout. So let's add something called an Else.
04:11So an Else allows us to say, if this is true then do this, otherwise do whatever
04:16comes between the Else and the End If.
04:18So what we're going to do is duplicate the Go to Related Record and open this up.
04:24We'll say instead of Invoice, we'll say Receipt and also, more importantly,
04:32we're going to change to the Receipt Layout, so it's still doing all the same
04:37activities, but going to the Receipt Layout instead.
04:40If we read it, it says, if the invoice that you are on, when you hit this
04:44button, has a Payment Status of Paid, then perform the script that opens up a
04:48new window and navigates to the related product invoice records, but shows them
04:52in a Receipt form, it actually should be opposite, so we'll go Go to Related
04:57Records down here and Paid.
04:59So here, when it's Paid, show the receipt in a new window.
05:03Otherwise, if it's not paid, show the invoice, which of course means it's
05:07unpaid, because we only have two values.
05:10Now one thing that we haven't captured yet is what happens if that value is empty.
05:13So in that case we don't want to print anything.
05:16So what we do here when we have an If and an Else is we just say, if this is
05:20true then do this, otherwise do that. But what if we have other tests?
05:24Now in a calculation we would have used a Case statement, but we don't have a Case script.
05:29What we can do instead is introduce what's called an Else If.
05:34So Else If, instead of an Else, allows us to create another test.
05:39So here I can say, if the Payment Status equals Paid, go ahead and copy that, do this,
05:47Else If the Payment Status equals UnPaid, do this.
05:54And we'll do another Else If.
05:56Else If Payment Status equals nothing, then we'll do something that's called
06:03Halt Script, that will just stop it from performing anything.
06:07So that way we don't know what to print in that case, so we could pop up a
06:11message to the user as well using the Show Custom Dialog, it says
06:20No Status Given or something along those lines.
06:23And then when the user hits OK, then it will go to cancel it.
06:27So the idea here is that, you can use an If if you have a true and a false; and
06:30then some actions that you want to have happen when it's true, and one if you
06:34want to have it if it's false. Or you can have multiple tests and multiple
06:37actions; and you can have unlimited amount of those, which is the same kind
06:40concept as a Case statement, but it's really just If statements, a bunch of Ifs
06:44that are called Else Ifs.
06:46Now we need to close this out with an End If, so our script knows when to stop
06:49performing all the conditional values and then it could carry on to other
06:52non-conditional script stepped actions as well.
06:56So let's try this out, go into Browse mode. Here we're on a record that is Paid.
07:04So when I hit Print, it says Thank You For Your Order!, which is exactly what we want,
07:07it's showing the Receipt, as you see there.
07:10But if I navigate to the next record and I hit Print, it's now navigating to the Invoice,
07:15which is exactly what we wanted.
07:19Now if we go to one of these values that's empty, or if we clear out one of
07:25the values, here is one that's empty, now it will pop up and say,
07:29No Status Given, and it just quits.
07:30So those are the three different conditions that we included here.
07:33There is something that's kind of important here.
07:35Any time you have a Go to Related Record Script Step, it's going to navigate to
07:40the context of whatever your child table is and then do something.
07:44But let's look at what happens here if we don't have any Related Records.
07:48I hit this button, nothing is happening.
07:53And the reason for that is because there are no records to go to,
07:56there is no Go to Related Records.
07:59So what we'd like to do in the cases of Go to Related Records is add a little
08:02bit of a trap, because what could happen for example is, you might end up
08:08doing something that you think is supposed to be happening in a new window on
08:12your Related Records, but it's actually going to end up happening in this window instead.
08:15So for example if this script had something like well, let's say Print;
08:21what if we said open up the related window and then delete all the records?
08:26Unfortunately, in that case what would happen is that if we didn't have any
08:29related records, we wouldn't open a new window, but we would still carry on with
08:32the delete and that could be very dangerous.
08:34So here is a trap that we're going to add that will not even pop this up in the
08:38event that there are no related records.
08:40So here is what we're going to do, we're going to add a trap or another If
08:44condition to this that's going to make sure to only run this if in fact we do
08:50have related records.
08:51So here is an If, let's put it at the very top and the very bottom.
08:55So what we're doing is we're wrapping all of these other statements in one big If.
08:59And the test that I like to use to precede any Go to Related Records is IsValid,
09:06one that we talked about earlier in this course.
09:09I am going to say IsValid, does this invoice have any ProductInvoice values,
09:18pick a nonempty value.
09:21So we are simply saying IsValid and then we pick a value from the child table.
09:25And this just says, hey! Do we have any related records?
09:29So if this is true, then all of this is going to perform, else if it's not,
09:37I am going to hit Halt Script and so nothing will happen, or I could put another one
09:42of these custom dialogs.
09:46So let's say No Line Items Present, or something more creative.
09:57So we'll close out this window and hit Save.
09:59So now let's see what happens is it will still print.
10:03This one doesn't have a status, so it's doing the correct thing there, this one
10:05will print, doing the correct thing there.
10:08But if we end up with no line items, it pops up and says No Line Items
10:12Present and then cancels.
10:14So a conditional branching offers the ability of a script to perform different
10:17sets of actions under different circumstances, all on the same script.
10:22So understanding, how to use the If, Else If and End If in your scripts,
10:26allows you to create scripts with several layers of conditions and makes your scripts
10:30more compact and efficient.
Collapse this transcript
Allowing customer input with custom dialogs
00:00One common scripting pattern in FileMaker involves interacting with a user and
00:04then performing actions based on that user's responses.
00:07In this movie, I am going to discuss how to use the Show Custom Dialog Script
00:11Step to allow you to have your users tell the script which action to perform
00:15based on their response.
00:17Allowing user input is a great way to present the user with choices that will
00:20determine how the rest of the script will function.
00:23Now in the previous movies, we've already used the Show Custom Dialog
00:26Script Step and it's generally used to display a customizable dialog box
00:31that can provide the user with information or prompt him or her for input on their decision.
00:35Once this step has been added to your script, you can then customize the dialog
00:39that will be presented to the user.
00:41So let's add one of these to our Print Invoice or Receipt script.
00:47So we've got Print Invoice or Receipt.
00:49What this is doing is just checking to see what the Payment Status is and then
00:52also doing a IsValid to make sure that there are related records. If so, it's
00:57running a Go to Related Record Script.
00:59So it's similar to one that we've done in previous movies with one difference.
01:02And that is that we're showing the Print Script Step here. But what about if we
01:07want the user to pick whether or not they want to print or save as a PDF?
01:11So what I am going to do first is create a new script that's called Print or PDF.
01:20So in this case, what I am going to do is choose one of those Show Custom
01:24Dialogs that I talked about before.
01:26You'll see the Show Custom Dialog Script Step as a Specify button,
01:31which allows us to choose all sorts of different values here.
01:33So we have a Title field that allows us to populate the title of the window.
01:39So we can say Pick Print or PDF and then here is the message. Of course
01:46these can also be dynamic driven by the Specify Calculation Dialog window in both cases.
01:52Here we'll say, and one thing I like to do when I am using the Calculation Dialog,
01:57is say something like, Get AccountName is the person who is logged in.
02:02So I can say something like, whomever their name is, would you like to PRINT or SAVE AS PDF?
02:14Okay and that's the message that's going to show up in the dialog.
02:16And this is what I'll do, I'll say you've three different button options;
02:20the Default button is what you are looking at here. You've got the Default button as
02:24one that's going to be highlighted already. So if the user hits the Enter or Return,
02:27it's going to execute that option.
02:28So Default is button one, we'll call that the PRINT. Button 2 is going to be PDF.
02:34We'll remember that PRINT is number one, PDF is number two, and we'll hit OK.
02:40So now what we're going to do following the branch, we've asked the user to
02:44pick one of the two options and perhaps let's say we want them to be able to
02:48hit Cancel as well.
02:50So we've got PRINT as one, PDF as the second, and Cancel as the third.
02:56So now let's close that window.
02:58Now we've got conditional branching elements. What we need is an If Script Step
03:02to determine what happens when each button is pressed.
03:04So what we can do now is add an If that will immediately follow the custom dialog.
03:11Here what we're going to be saying is if the user pressed one, do this,
03:15if they pressed two, do that and so on.
03:17The trick there is a Get function that's called Get LastMessageChoice,
03:26which is specifically for this purpose.
03:28We're going to say if the Get (LastMessageChoice)=1, which was the first button,
03:32which was PRINT, then we're going to present them with the
03:37Print dialog, there is Print.
03:42Let's create another Else If, which means otherwise what if, let's copy this,
03:52Get (LastMessageChoice)=2, then what we're going to do is save as PDF,
04:03Save Records as PDF and let's do a third one where we say if Get (LastMessageChoice)=3
04:12we are just going to do a Halt Script or Exit Script.
04:16So I created this as a separate script, so that way I didn't have to go into the
04:20original script and type all those different values in each instance. This way I
04:26can just call all of them as a group. So I've got this subset of script steps
04:30that I've saved as its own script and instead what I can do is delete where it
04:34says Print and instead say print.
04:38So after each Go to Related Records, I can just say perform the subscript
04:43which was, what did we call it, let's see, we haven't saved it yet, so let's
04:49save this, there we go.
04:51So Perform Print or PDF and I'll duplicate that and put that down here as well
05:01after the Go to Related Record.
05:03In this way if there are other scripts that might need the option to choose
05:06between printing or saving records as PDF, we can just call this subscript in
05:11those as well, sort of some modular scripting FileMaker wise.
05:17Let's take a look at how this works.
05:20If we go into the Print button, which is what this is attached to, we can say
05:24Print and now it says, Admin by the way is my login name, so it's saying hey
05:29Admin, would you like to PRINT or SAVE AS PDF?
05:31I am going to say Cancel, which means it stops that option, which is fine.
05:35I could close that window.
05:36But how about if I say PRINT, what it's going to do now is it's popped up our
05:40printer driver window and I can proceed with the script; or the other option is I
05:46can say SAVE AS PDF, so now it's going to ask me where I want to save the PDF
05:51and it will go through and pull up the Adobe driver and print that.
05:56So the Show Custom Dialog Script Step is used to display a customizable dialog
06:00box that can provide the user with information or prompt his or her for input or a decision.
06:06This will allow the users to provide input, which is a great way to present
06:10the user with the choices that will allow them to control how the script
06:13actually functions.
Collapse this transcript
Using loops in your scripts
00:00So far we've been looking at using scripts to perform an action against one record at a time.
00:05So we'll have a button on screen, the user picks that button and then it
00:09performs a series of scripted steps against that one record.
00:13However sometimes, actually quite frankly many times, you might want to perform
00:16actions against a found set of records all at once.
00:20This would be FileMaker's version of running batch operations.
00:24In FileMaker, we call these performing loops or looped activities.
00:27This movie focuses on using loops to perform a set of scripted tasks in multiple
00:32different times once for each record in a found set.
00:35Looping is a very common and useful script concept particularly for reporting routines.
00:40The loop script step allows you to execute a series of script steps over and
00:44over until some exit condition is reached.
00:46Looping scripts are commonly used for iterating over a found set of records and
00:52you'll notice that there are some supported script steps.
00:54So we have Loop and End Loop, very important End Loop and even Exit Loop If.
01:01Those are the different ones available to us.
01:03There are a few rules to follow when using loops in your scripts and sort of a
01:07general structure that you want to be aware of.
01:10The first part of the loop structure is called initializing the loop and this
01:13usually involves going to the first element or record in the found set and
01:17setting one or more variables to an initial state.
01:20In most cases, this is just go to the first record in a found set.
01:24Then there is beginning the loop.
01:25This is where you actually do something.
01:27You want to print something or set some record to some value or something,
01:31whatever it is that you're trying to accomplish over and over again, you do that here,
01:34just the one time.
01:36This is usually a series of script steps that operate on the current record;
01:40then of course you want to move to the next record in the found set.
01:43Then finally you want to end the loop, this is really important.
01:46This is where you test to see if the exit condition has been met,
01:49so that you can stop the loop.
01:51Otherwise you could have something that's called an infinite loop.
01:54So you want to learn this generalized structure, build your looping scripts as
01:57closely as possible according to this model.
01:59It makes it easier to write looping scripts and to modify and extend them down the road.
02:05So say for example in our file we want to print an invoice or print a receipt
02:08for all of the invoices in our found set.
02:11Up until this point, we've just had the user click a button to do it one at a time.
02:16So let's say we want to do that across the entire found set.
02:19So in this case a looping script will deal with a set of objects and here it's
02:24going to be a set of invoice records and we'll create the found set.
02:28So it's really important that we do a couple of things here.
02:30We have to have a way to move from object to object and set an exit condition.
02:34Let me show you what I mean there.
02:36So let's create a new script and we'll call this one Loop Print or PDF.
02:46Now first we want to start our loop or initialize our loop and even before that
02:49we're going to want to go to the first record in the found set, this is the most
02:53common initializing of a loop in FileMaker.
02:56So you see we Go to Record/Request. If we had 25 records, we want to make
03:00sure we start with the first one, because otherwise the loop will just perform
03:02at whatever the active record is and go all the way to the end of that found set
03:06and in that case you might omit several different records in the found set.
03:10So we initialize the loop by going to the first record, open up the loop that's
03:14part of the initialization as well and now we have to do something in here.
03:18So what I am going to is I am going to just simply say Perform Script,
03:22perform the Script that we already created.
03:25This seems easy enough.
03:26So now what we have to do is move to the next element or move to the next record.
03:30We're also going to use the Go to Record/Request Script Step.
03:34I am going to put that after the performing of the script.
03:37Now here is the key, this is critically important.
03:38We have to have a way to move from object to object in the found set,
03:41but also to have an exit condition.
03:43The Go to Record/Request option provides us with the ability to do that.
03:47We can say instead of Go to Record/ Request first as we have here, I can say
03:53Go to Record/Request Next and what's nice about that is it's got a little Exit after last option.
03:59So we can accomplish going to the next record and exiting the loop
04:02if we encounter the last record in the found set all in one script step.
04:07So failure to have both the ability to advance to the next record and to get out
04:11of a loop will give you an endless loop. If the script does not have some
04:16way to exit, the only way that you can stop that is by quitting FileMaker.
04:20You got to be careful even in your testing environment to avoid that.
04:23So pretty simple, we're just running the same script that we've created before this,
04:28but we're wrapping it in some of the structured loop elements inside of a
04:32script to make sure that it can go from record to record.
04:34So let's add that to our layout.
04:38If we go into Layout mode, let's just drag this button over here and I can call
04:45this one Print All, and in this case, I'll attach the new script we created.
04:57So now when we go into Browse mode, we could create a found set, let's say
05:07Abbott has two records, so instead of printing one at a time, let's try printing all.
05:11So we hit Print All and we see it's gone to the first record and I'm going to print it,
05:18continue the script and now it's gone to the second record to see Invoice 6, we say Continue.
05:25We see now it leaves us at the end of that record. So we could've printed or saved as PDF.
05:30So just a real quick example of being able to isolate some activities where we
05:33first create the found set, initialize the loop by going to the first record in
05:37the found set, we do something, advance to the next record and also apply some
05:41sort of exit condition, so we don't get into some permanent loop.
05:44The Loop Script Steps allow you to execute a series of Script Steps over and
05:47over until some exit condition is reached.
05:50Looping Scripts are commonly used for iterating over a found set of records and
05:54performing actions pertaining to those records.
05:57So by following the loop rules and structure, you can perform one Script Step
06:01or a series of Script Steps across an entire found set of records, all with one action.
Collapse this transcript
The Set Field script step
00:00When you're working inside your database and you have a field somewhere,
00:04if you want to change the data in the field, you just pick the field that you want,
00:07click inside of it, type something and then commit the record.
00:11In this case I clicked outside of the field to commit the record.
00:14Sometimes when you write scripts,
00:16you might want to have to write something to a field just like I did here.
00:20In these cases, your best tool to do this is something that's called a Set Field Script Step.
00:24So you can see down here Set Field.
00:27What Set Field allows you to do is pick the field, much like clicking inside of
00:32a field, and then inside a Calculation dialog, you can put the formula or the
00:38value that you want to have written to that field.
00:40So it's really the same type of thing, but allows you to do it inside of the script.
00:44So for example, let's say when we're running our Print Invoice or Receipt script,
00:50that's attached to this button, we also want to have it write some value
00:54inside the field that says that this was either sent to a customer as a receipt
00:58or an invoice for example, maybe with a little timestamp.
01:00So to do that first we're going to need to have a field.
01:04So let's go in here and call our new field PrintStatus.
01:11That way we can always look and see, oh, was this ever sent or generated or whatever,
01:15provides kind of like a little log for us; and let's go into Layout mode.
01:20And add that to our layout, copy this, drag it down and that's called
01:28PrintStatus, let's just add that here and one last little thing that appears.
01:40So now we have a field and what we want to do is write that field every time
01:45something is printed, so we have to modify our script in order to be able to do that.
01:50We go into the Print Invoice or Receipt script.
01:52You see that, if it's Paid, we're going to generate a Receipt;
01:55if it's Unpaid, we're going to generate an invoice.
01:58And after we print, we're closing the window, but what I'd like to do is write a
02:04value to the field, so if I go in here and pick my Set Field Script Step in
02:09between printing and closing, so after the printing is done, I'm going to pick a
02:13field and that's going to be this PrintStatus field.
02:18So it's just like clicking inside the field and now I'm going to use all the tools
02:21at my disposal on this Calculation dialog to come up with the value that's
02:25going to get written inside that field.
02:27So I could just put some text like "Sent To Customer" but I'm going to add some more to that.
02:32I'm going to say Sent To Customer and I'm also going to add to that a little condition here.
02:37So let's say If the Payment Status, this is going to be the same rule that we
02:43are adding in the Script Step, if Payment Status="Paid", then I'm going to
02:49have the text and invoice otherwise Unpaid an Invoice, otherwise I'm going to say --
03:05So it's just going to say Sent To Customer either an Invoice or a Receipt,
03:08depending on whether or not the Payment Status is unpaid or paid.
03:11This is the same condition that we already have in the script. At the end
03:15of that, I'm going to add little space and I'm going to use a Get function to
03:20say Get (CurrentTimeStamp). Here we go. So an Invoice or Receipt, so let's try this out.
03:32Actually, what I'm going to do here is duplicate that, in case it's unpaid as well.
03:40So let's save this and let's give it a shot.
03:43So here on this record, I've got Unpaid. I'm going to hit Print. I am going to
03:48say, let's do the Print option and go ahead and proceed through there,
03:55continue the script, which then sets our record, so it says Sent To Customer an Invoice,
03:59because it's unpaid. What about this one? Being paid, hit Print, go ahead and
04:05just continue that, cancel on here, we sent him a receipt.
04:08Now you can put whatever you want inside of a script, which is why the Set Field
04:12Script Step is so popular, but one thing I'm going to mention is that you should
04:17categorically avoid any script steps that say Cut, Copy, and Paste.
04:23The Set Field Script Step should always be used as your first tool of choice for
04:27manipulating any record data, whether there's data already in the field, or you
04:31are adding it for the first time. You should avoid the Cut, Copy, and Paste
04:34as well as Clear, because these steps can overwrite the user's clipboard,
04:39which can both be annoying and the cause of some security issues.
04:43More importantly however, all these steps require that the reference field
04:46actually physically be present on the currently active layout.
04:49So for example, in our Set Field, it just so happened we were in the context of
04:53this layout in our script, but if we weren't, I could still set that value even
04:57though the field wasn't present. But in the case of Cut, Copy, Paste, or Clear
05:01they all need to be on the layout.
05:03So if you later remove the field from the layout, the scripts might fail.
05:07Set Field does not have that restriction, so it's just a good rule of thumb to
05:11always avoid Cut, Copy, Paste, or Clear and always use Set Field.
05:15So you'll find that Set Field will allow you to add the results of a calculation
05:19to any field, whether it's at the focus on your layout or not, and
05:23it will become one of the most used script steps in your FileMaker toolbox as a result.
Collapse this transcript
Working with script variables
00:00Script variables in FileMaker, which are created using the set variable script step,
00:04provide a temporary location for storing data and then that data can then
00:09be accessed from any context within the file.
00:12Now this concept probably isn't too foreign to you, because you're probably
00:16already familiar with it from within any application, where you can click
00:19inside a field let's say and go to Copy and then what that does is save it to a
00:26temporary location and then anywhere else in that file you can go in and paste it as well.
00:35So that is very similar to the concept of a variable, except what's nice about a
00:40variable in FileMaker is that it provides you the extra advantage that instead
00:46of having only one location where you can copy and paste something and then pull
00:50it back later on when you're in the file.
00:52It allows you to save it to a specific location that you can name and then you
00:56can call out that specific location to retrieve that stored information later.
01:01What's nice about being able to name the location is that you can then be saving
01:06several different things to several different locations without clearing it out.
01:10So unfortunately, with a clipboard in your operating system that you're already used to,
01:14when you copy something if you then copy again, you then wiped out the
01:19preceding stored value.
01:20But with variables you can name a location anything you'd like and then go set
01:25it there for either the length of a script or for the life of your user session.
01:30So let's look a little bit more into what a variable is.
01:34You can tell a variable by its type. There is a certain syntax that you need to
01:38use before we even get into the script step; it's how do we name these things.
01:42Well the syntax is very important, you can tell a variable's type by its syntax.
01:47Local variables begin with a single dollar sign ($), so for example $var means it's a local variable.
01:53And a global variable is preceded with a double dollar sign ($$)
01:57and then whatever name you come up with.
01:58Here I am using var, but you can name it anything you want.
02:02Now you can use these anytime you need temporary storage within a script.
02:06Now what's a local variable? That means that it's only going to save that value
02:10in memory until the script is done running.
02:13So this is where you could set something into storage and then retrieve it later
02:17in the script from that same storage location.
02:20In the case of a global variable, they are a little bit more dynamic;
02:24you can save something into FileMaker's application memory and at any point in
02:28your session you can then retrieve that same value by calling out $$
02:33whatever you name that variable.
02:34So that's something that can be very useful.
02:37In our case we're going to use a script variable in our exercise file to save
02:41the location where we want to save a PDF.
02:43So for example here we've got this send by email button that's already on the layout.
02:49Now there is no script attached to it. We have to author this script; but
02:53essentially what we need to do is create a PDF of an invoice or a receipt and
02:59then attach that PDF to an email.
03:02So FileMaker allows you to send an email but it needs to already have a document
03:07created in order to be able to attach it to the email to send, so it's really
03:11two different things that we're doing there.
03:13So first of all, let's go into our script. I believe there is a script in
03:18here called Send Invoice by Email.
03:20Let's author this first. What we want to do is create a Go to Related
03:25Record Script Step. I want to show the Related Records from the Invoices
03:32table and I'm going to use the Layout that's called Invoice Details.
03:37I want to show it in a new window; let's say we'll make this window
03:43500 high and 400 wide, and the distance from the top will be 100, 100;
03:51inconsequential to the task at hand here, but I do want to show only the
03:54related invoice record items. So in that case we are okay with our go to Related Records.
04:01But we don't want to perform this task unless there are related records.
04:05In that case we want to put a trap in here.
04:11We'll say If, and what's our trap for Go to Related Records?
04:15We talked about this earlier in the course.
04:16But we'll say If IsValid and then from Invoice details we actually want to show the Product Invoices.
04:26So If any of them exist, then we will go ahead and perform this.
04:32Otherwise, we will exit the script.
04:34Now that we've got that in place, we can address what happens after we've gone to the related records.
04:39So what we would like to do there is Save Records as PDF.
04:44You'll down here, under Save as PDF that we've got to provide it with some information.
04:54We could have this perform without dialog, which is optimal.
04:58But in that case we have to tell it exactly where to save this PDF,
05:02and incidentally, this is the same location where the email needs to go find the PDF.
05:07So what we could do is we could follow the instructions below and hand type out
05:11the location from the user's location where FileMaker is, all the way to where
05:15we could save a PDF and then hand type that same thing later.
05:18But instead what we could do is set a variable with this location.
05:24Let's go up to setting a variable and at the very top of my script I am
05:29going to go ahead and set a variable, very simple, there is really only one option here.
05:34You name it and then provide a value.
05:36So I am going to name this one $path, and as I mentioned before, if I proceeded
05:40with a single dollar sign ($) that's a local variable.
05:43I only need this to live in storage until the script Send Invoice by Email
05:47expires, so I am going to keep it as a local.
05:51The value that I am going to give it is a pretty handy string here.
05:55So this formula Get (TemporaryPath) followed by an ampersand (&)
06:06and I want to name it something unique, so we'll call it the number of the invoice.
06:10And then at the end of it I will put some text.pdf.
06:15What this is going to do is dynamically create a PDF that names it whatever
06:20the invoice is, so Invoice this would be number 4.pdf for example.
06:24And it will save it to a temporary path.
06:27Now Get (TemporaryPath) saves it to some hidden location inside the FileMaker
06:31application that then gets flushed out whenever you close out FileMaker.
06:35So this is a great way to not clutter up the user's Desktop. There is also a
06:39Get (DesktopPath) or a Get (DocumentsPath), but this is a great way to do it in
06:42a hidden location as long as we can go retrieve it later.
06:45So what I am going to do is set that variable.
06:49Now you're wondering why couldn't I just have put this formula right in
06:55the Save Records output file location?
06:57Well, you can't put a formula, first of all, in here, but what we can do is
07:01reference a variable, pretty simple, nice and clean.
07:05So now what's happening is we're setting a variable and then we're running
07:08this script, so we're going to Related Records and then saving a PDF to that location.
07:12Now it's saved in memory to a specific location that we're calling $path.
07:16So now the second half of this is that I want to add very useful script step
07:20here that's called Send Mail and this will of course only happen when we've
07:27validated that there actually is something to print and save as PDF and then
07:31that's what we'll attach to the email.
07:33But you'll do this performing without a dialog, so user doesn't have to enter
07:36any of this information in here.
07:38And so what we'll do, you see when this pops up is we'll send one email and
07:42we'll say let's send it to the Customers email address and we'll call this the,
07:52"Here is your invoice" and we'll put the number of the invoice as well.
08:00We could put a message in the body, but for this sake what we see here is,
08:04we have this attached file and lo and behold it's the same specified file,
08:08so we could type in the manual thing if we want to, or we could just type in our variable.
08:13So now we've set a variable at the beginning of our script.
08:16The variable is then used to save the PDF to a certain location, and then it's
08:20also used to go retrieve that PDF to attach it to an email. Then of course,
08:25when we're done with all of that we can close the window, because the
08:29user doesn't need to see it. All of this made possible by being able to save
08:34this path to a variable that can then be retrieved at a couple of different points in the script.
08:40So let's try this out.
08:42So now when I hit Send by Email, you see it temporarily opens up the window.
08:47What's happening is it's saving the PDF file to that location, closing the
08:51window and now it's going to pop up the email in our mail application.
08:59As we hear, it just sent the email, so we can go and confirm that in our mail program.
09:04We see when we go in to sent, sure enough.
09:06There is or email sent to the customer; we can see the customer in the
09:10background there, so that happened properly.
09:13It automatically put in the Subject line and then more importantly it also attached our PDF.
09:21And here you can see as one little point of quality checking, it printed out
09:26every single PDF, so one quick update there in our script would be to simply go
09:31in and save records as PDF. We can specify the options for current record.
09:39If we want we can try that one more time and Send by Email, our queue.
09:47We can verify later in the thread, here is the one record.
09:51So now since there is just one page you see that it's actually visible inside the layout.
09:55So in this example a variable helped to store the path, the location to save the PDF,
09:59then use that same path later in our script to attach the PDF to our email
10:04in script variables, which are created using these set variable scripts that
10:07provide a temporary location for storing data and that data can then be accessed
10:11from any context in the file that's allowing you to temporarily store values for
10:16later use in your script or even later in your session.
10:19So here we used it with the Save as PDF and Send Mail, but you'll find out that
10:22saving variables and being able to use that temporary memory location is going
10:26to be one of the more helpful tools in your FileMaker programming tool belt.
Collapse this transcript
Setting script parameters
00:00Take a look at this file that I have on screen. This is the invoices_08_06 exercise file.
00:05See all the letters across the screen here.
00:07Every one of these is a button and when I click on that button, it does a
00:10search in the customer's fields for anything with an N in it or anything here
00:16with a P in it, and so on.
00:19Now let me propose the hypothetical question to you as you think about this.
00:23How many scripts do you think this requires?
00:25There are 26 buttons, but if you answered one script, then you are correct.
00:29If you take a look at here, all these require is one single script, let me show you that.
00:36So in Layout mode, if we click on one of these buttons and do button Setup,
00:40we see we are running a script that's called QuickFind, and here we're running
00:45a script that's called QuickFind, and here we are running a script that's called QuickFind.
00:51Now you might think okay, I see the trick up your sleeve, there are several
00:55scripts all called QuickFind, in fact there is only one, and that's this
01:01QuickFind script right there.
01:03What's the trick here?
01:04Well, the trick here is that, when we assign the script to the button, you'll
01:08notice that there is this other optional thing here called parameter.
01:12So down here below, anytime you are adding a script to an object, whether it'd be
01:17a button or even a script trigger, you can also put an optional parameter.
01:22So for everyone of these, we just run the QuickFind script and you have to
01:27assign the script to the button anyways.
01:29So in here, you'll see that this is the optional parameter for B, here's M, so
01:36on and so on, so you get the gist.
01:38So one script, but optional parameter. Then what are we doing on the script side?
01:43If we open up the script, you'll see that we are simply entering Find mode.
01:46and we're using the Set Field while we are in Find mode to insert a value
01:52inside the Company field and then perform a Find, but the key is the value that
01:56we are entering in there.
01:57There is a Get function, which can be found under the Get functions, that's
02:02called Get (ScriptParameter).
02:04So we can package it up when we are assigning a script to a button and then
02:09unpackage it using the Get Script Parameter Script Step and perform a Find
02:14based on that. And that way one script can be recycled or used based on
02:20different parameters.
02:21This is just one example of using script parameters by the way, there's a ton of
02:25different things you can do, but the main point behind it is that within a
02:29script when the Get Script parameter function is used, you can retrieve the
02:33value of a parameter and then the value's parameter cannot be changed or
02:36modified in any way during script execution.
02:39So we've got one script, 26 different ways to perform it and that's just in this one.
02:43So the idea is this helps you use script parameters as a calculation formula.
02:47It gets evaluated and passed into a script when the script is invoked. Using
02:52these parameters can drastically reduce the number of scripts that you need in
02:55a given solution, and thus make that solution easier to maintain or create in the first place.
03:01So keep this in mind instead of having to create one script for search for A,
03:06one search for B, search for C, just create one script and pass it a parameter instead.
Collapse this transcript
Using Error Capture in your scripts
00:00If you watched the previous movie, you'll see that we had a script Perform to Find,
00:04based on whatever letter was selected at the top of the screen.
00:07You can see that here as well.
00:09I select B, that gives me everything with the B in the Customer field, D, F and so on.
00:14However, sometimes for example, if I click on X, no records are found,
00:19and I get this sort of cryptic message presented to the users that says No records
00:23matched this find criteria.
00:24Now most users don't know what record is or what Find criteria is and so this
00:29can be very confusing to them.
00:30So depending on the script that you're running, you may or may not want these
00:34options and could sometimes be undesirable as far as your users are concerned.
00:38So if you want to suppress this and possibly show your own message instead
00:42what you can do is use something that's called the Set Error Capture.
00:46So if we go to our Script and go to our QuickFind, we can add a couple of
00:54different Script Steps, but the first one that we have to add is one
00:57that's simply called Set Error Capture, you see that here in the first category of Scripts.
01:01If you add that to the top of your script, this will allow you to turn on
01:07the ability to capture or suppress errors for the life of this script.
01:10So when the Set Error Capture is turned on, for the remainder of the script,
01:14FileMaker Pro will suppress all error messages from being shown to the user and
01:18it will rely on you, the developer, to provide the appropriate error handling.
01:22So to determine whether or not there has been a script error, you're going to
01:26have to capture after the possible error causing script steps.
01:29So in our case Perform Find is what could kick out an error, so if doesn't find
01:34records that match the criteria, it's going to give an error.
01:37But if it does find them, it's going to produce an error of zero, which means
01:40everything was fine.
01:42So any function that produces an error can return an error code from the most
01:46recently executed script step;
01:48for this reason, it's important to check for an error immediately after
01:51executing that step.
01:52So in our case, it's the Perform Find.
01:54So what we want to do is we want to add an If statement, If and End If and what
02:01I'm going to do is go to a Get function here and there is a Get function that
02:06you're going to want to use called Get (LastError).
02:09So normally, you don't need to test for a specific error, it's usually
02:12sufficient to test to see if error code was something other than zero.
02:16Here, I can say if Get (LastError)=0 that means everything's fine, just continue on.
02:21But if it wasn't, that means I can assume that the error was produced.
02:25But of course if you do know the specific FileMaker error code, you can build
02:29that into your script.
02:30But here I'm going to say if Get (LastError) was zero, we will do nothing, but
02:35if wasn't, that's where we might want to show the user something, so now it's up
02:40to us to tell the user something in a dialog so here I can give it a little
02:45less cryptic dialog, so I can say No Companies Found instead of No Records and
02:52I can say No Companies Found that contain, and I can use that Get function again
03:04Get ( ScriptParameter ).
03:07So this will be whatever they were searching for, so I can use it both in the
03:11search and in the error capture if I need to, No Companies Found that contain,
03:15and then whatever the letter is.
03:16So here we'll just say OK.
03:21Let's test this out, so we'll close this window and hit Save and so B finds B, D
03:28finds D, but X pops up and instead of showing a confusing error message that
03:34says No Companies Found that contain X.
03:36So capturing errors allows you, the developer, to control what the user sees
03:40rather than having them see some confusing dialogs that FileMaker might display
03:43when an error occurs.
Collapse this transcript
9. Extending Web Viewer
Viewing custom URLs in the Web Viewer
00:00One of my favorite features in FileMaker Pro is something that's called a web viewer.
00:04Now a web viewer is a layout object that's used to display web pages directly
00:08inside of a FileMaker Pro layout.
00:10As a matter of fact you see here on this layout, we've got one of these web
00:14viewers and we'll be working with it in this exercise.
00:16Web viewers have many practical uses and quite frankly there an area in
00:20FileMaker where you can really use your imagination, so really the sky is the limit.
00:24But for example, web viewer could display a map of a website.
00:27If you see over on our Customer Details layout for example, we've got our
00:33customers with their addresses and over here on this other tab, we've got this
00:38web viewer that shows the map.
00:41As we go from record to record, it dynamically plots that address on a map if,
00:46of course, there is information available for that person.
00:49Now you'll add a web viewer just like you would any other layout object, you do
00:53it in Layout mode. They can then be added to Form View layouts and List View
00:58layouts but not Table View and not Portal Rows, just in case you're starting to
01:02think about ways that you can use this.
01:04By the way, in order for you to be able to see the contents of a web
01:08viewer, you are going to need to be connected to the Internet for the purposes
01:11of this exercise file.
01:12There are some cases where you don't need to be connected to the Internet and
01:16we'll cover those later in this chapter.
01:18Let me show you an example of how you can use a web viewer.
01:21Let's say, a web viewer can be used to calculate the URL for tracking a package
01:25based on data stored in a tracking number field.
01:28For example if we go over to the Invoice Details layout you'll notice that on
01:32the bottom of the page we've got a field with a tracking number in it and we
01:36store this information every time we ship something.
01:39But we think maybe this might be useful for us to actually be able to see the
01:42tracking information, so when our customers call us up, we can give them the
01:46most up-to-date information.
01:47So what we would do, is go into Layout mode and make a little room here on the
01:53bottom of the layout, move our Tracking Number field up and here we can select
02:00the web viewer object, which is the last object in the middle section and when we
02:06grab the web Viewer tool, our cursor turns into a crosshair and we can draw the
02:11area on the layout where we want our web viewer to appear.
02:14What you see is the web Viewer Setup dialog window.
02:17The first thing you'll notice is that on the left-hand side we've got this
02:20window where there's all sorts of pre-loaded websites that FileMaker supplies
02:24to you for you to be able to easily be able to add web viewers that dynamically
02:28show the websites based on data inside your FileMaker record.
02:32The easiest one to see is really the FedEx one, for example, so let's say we
02:36want to add FedEx tracking to our database layout.
02:39You'll notice when you select one of these pre-loaded websites, you'll see on
02:44the right-hand side we've got open fields, where either you can type in the
02:47actual address or the information of the data that's going to be loaded, but of
02:52course, then every one of your records would show the same tracking number.
02:55Or you can map it to a field in your database.
02:59So of course we've got this Tracking Number field and you'll see down below that
03:04a custom web address is being created. Really all a web viewer is,
03:10is a calculation that results in a web page.
03:13So you can put things like fields in your database that will then modify the web
03:18address. So that way when you go from record to record it's acting sort of like
03:23an unsorted calculation and the result is a web page that you see in your layout.
03:28So let's take a look at what this might look like and we'll stretch this one out a little bit.
03:33Let's go to our Position. All right!
03:38So now in Browse mode, if you look down on the bottom of the page, you'll see
03:45that we've added the ability to actually load the FedEx Tracking page, so you'll
03:50notice that of course, this is an invalid tracking number.
03:52But if it weren't, we would be able to see the tracking information scrolling on screen.
03:57Of course we could make this much larger if we want to.
04:00But the nice thing about it is, this web page is then fully interactive.
04:03So here our users could even type in another tracking number as long as they're
04:08there and hit the track page.
04:11Now again, the idea here is it's not just loading a web page. It's not like a web
04:15browser, but it's actually taking information from the record that you are on
04:18and helping load a page that way.
04:20So let's look at another example that will use custom information from our
04:23record and display a web page for us.
04:28If we go over to Product Details, you see I've got this large web viewer over
04:33here in the right-hand side of the screen.
04:35It's already been drawn, but it doesn't have an address.
04:38In this case, we're not going to use one of the pre-loaded websites,
04:42although I urge you to check them out. They're are very easy to use, there's one
04:46for all sort of stuff Wiki, Google, MapQuest all that type of thing.
04:49But what we are going to do is we're going to author our own custom address.
04:53So how do we get a custom address?
04:54Well, you're going to have to know which site it is that you want to load.
04:58A quick sort of study on websites; let's go over to our browser.
05:02We're going to put in a custom address into the Calculation window and reference
05:05fields from our layouts, but first we need an address.
05:08Now how do we come up with a custom address?
05:10Well that starts with going to the web and finding a website that you actually
05:14want to emulate in your web viewer.
05:16So let's go over to our browser.
05:17Here I've got a browser and I'm going to go to a certain site that would
05:22give us pricing information on different products, which is what we're trying to do here.
05:27I'm going to go to Google Shopping.
05:28I want you to take a look at the address bar up on the top.
05:31So if I go in here, and I type in -- we'll get rid of all this stuff here --
05:37you don't need to concentrate too much on that; quite frankly that's all
05:40session-based information.
05:42But if you look at the URL that's on the top of the page, really all Google
05:46does is take whatever you type into this box and it adds some other characters
05:51here; search and then the language and so on, but ultimately it's just putting
05:55in shop and then your search term at the end.
05:59A lot of sites do this and I'm going to show you some examples of some other ones.
06:04Those are just open accessible URLs. If you get a little bit familiar with
06:08your address bar as you're searching over the Internet, you are going to find a
06:12lot of these websites and then you can incorporate these into your database.
06:14So now, the trick is to copy that, and let's go back to our database.
06:20Again, remember a web viewer, in my opinion, is really just a calculation that
06:25results in a web page.
06:26So we're going to open up our Calculation dialog window and
06:30I'm going to paste in that address.
06:31Now of course, any time I put text in there, I have to wrap it in quotes.
06:35Now we're of course not done here, but let's just preview this and see what we got.
06:41So if I go back into Browse mode, you'll see after I save my changes, indeed it
06:46looks as though we're done, but we're really not.
06:48I happen to be on the Bike Helmet record but you'll notice that every record
06:52goes to the Bike Helmet. What we want is each record to search whatever the item name is.
06:57So let's adjust that. The way we can make this dynamic is we go back in to our
07:01Calculation dialog window and instead let's do this.
07:04Let's cut off the web address right at the point where the product name was
07:09referenced and instead let's reference our field value.
07:13So like with any other calculation, I'm going to put this placeholder in here.
07:17The Products Item field just really means whatever the data is inside the
07:21Products Item field on our record.
07:24So I'm going to hit OK, and now let's go into Browse mode and you'll see okay,
07:31we've got Performance Tune Up. It gives us all performance tune ups and I've
07:35got Bike Helmet, SpeedGel Saddle, 7-speed free wheel, bikes and so on.
07:41The nice thing about this is because we're reaching out to the web, we don't
07:44have to take on the burden of entering all this data into our database and
07:47keeping our database up-to-date.
07:49We know that the second we load this record, that this is the most up-to-date
07:52information that's on this particular website.
07:54So for our purposes of our example, we know that our database will always
07:58have access to the most up-to-date pricing information on the same products
08:02that we're storing.
08:03So this is a great way to extend the capabilities of your FileMaker database
08:07without actually having to program this information into it.
08:10Pretty cool stuff, it gets me kind of jazzed up.
08:12Now you don't have to use any Google website.
08:15You can use any website that exposes its URL and allows you to replace its
08:18code with a field value.
08:20Of course, sites that you're going to need to log into, there are some ways
08:23around that where you can actually pass log in credentials, but it gets a
08:26lot more complicated.
08:27So you're going to look for open public websites that do allow you to see the
08:31search parameters and sort of the code that they're using.
08:34I've got a real-life database example here that I'm going to show you that has a
08:38whole bunch of these different examples in it, just to give you an idea how versatile this can be.
08:42This is a real-life database that we've created.
08:46I've got a sample movie in here. The purpose of this is to track movies that are
08:50going to be coming out, of course this one has already come out, but if you can
08:54use your imagination here a little bit.
08:56The role of this is to research the movies and put information in on it so they
08:59can make bids and possibly acquire the film. So that's the backstory on this particular database.
09:04But one of the things that the researchers had to do was go to various different
09:07websites and find out information about a film.
09:11So what we did is we made it all dynamic.
09:13So all they have to do is type in the name of the film and some of the actors
09:17and they can automatically find out information about it.
09:19So for example, we've got this little link next to the movie name where when
09:23you click on it, it automatically searches a website that's called IMDb and
09:27shows any kind of hits and allows you to interact with it, so you can see all
09:31sorts of information on cast and everybody affiliated with the movie, that one is pretty easy.
09:35Also we've got this Research tab where you can click on any one of these tabs
09:39and it will automatically take you to this website and automatically search for
09:44whatever the film name is. In this case we've also got a Twitter address for
09:48the director and you can see that it automatically loads the Twitter Feed for that directory.
09:53You go to Rotten Tomatoes, it automatically loads any information you got on
09:57Google, Google Trailers, Reviews of the movie, YouTube Trailers, Deadline
10:04Hollywood, Hollywood Reporter, IndiWire, Variety all of these and they're just
10:10automatically searching based on the film's name.
10:13So just to give you an idea, we could go in here, and I'm going to type in a
10:17film and we'll see if it's already in the list, its not in list so we're going
10:21to add it and now that it's already added.
10:23we can click on buttons and it will automatically go and search.
10:26We see we've got a couple of different options here for us.
10:29We also go into our Research tab, don't have any Twitter information there yet,
10:34but automatically searches Rotten Tomatoes, Google, Trailers, Reviews, YouTube
10:39Trailers, Deadline, Hollywood Reporter and notice on the bottom, you can see
10:45these custom address being loaded.
10:46And just to give you a quick peek into how this works; so we go into Layout
10:52mode and you'll notice that what we have is just a tab control with a series of different tabs.
10:59If you look real close, these calculations are pretty easy.
11:01Twitter is a really easy one, all you have to do is just do twitter.com/ and put
11:06in whatever the handle is.
11:08Rotten Tomatoes has an exposed URL that's basically just rottentomatoes.com/m/
11:16and then I just do a little substitute where I replace any spaces with
11:19underscores because their particular website doesn't like spaces.
11:23So real simple stuff you can do within your calculations.
11:26Here I do one where I just check to see if the name of the film is not empty,
11:30I show that; if the director field is empty, I show the cast; all that type of stuff.
11:35So you can really leverage what you already know about calculations,
11:39to dynamically show this information inside of web viewer.
11:42The other thing I would say is that when you're researching the websites that you want to use.
11:48I find that it's helpful to use mobile versions of websites.
11:52They still do have those out and instead of having to load all of the different
11:57ads and all that kind of stuff in your website, you'll notice that in Browse mode,
12:03when I go to IMDb what I'm really doing is, I'm loading what's called the
12:06mobile version of IMDb, that way I don't get all the wacky stuff and it just
12:10gives me just the basic information.
12:11So you can do simple Google searches for WAP versions or mobile versions of the
12:16websites that you want to load.
12:17Now because web viewers use the operating system's web browser technology and by
12:21the way, we can't get around this, but web viewers will use Internet Explorer
12:25if you're opening the database on Windows or Safari if you're opening the database
12:29on Mac, you can perform most of the same tasks in the web viewer that you can
12:34within a web browser.
12:35But your web browser settings are going to control how the web viewer operates.
12:39So for example, if JavaScript or other plug-ins are disabled in the web browser,
12:43then those same technologies will be disabled in the web viewers.
12:46Make sure of course when you're defining custom web addresses, that your URL
12:49begins with a correct scheme such as http or https or ftp.
12:54If you omit the scheme, the operating system's web browser might not use the one
12:58that you intend; just a couple of tips there.
13:01Web viewers, my favorite layout objects, are an extremely powerful way to extend
13:05the content within your FileMaker layouts.
13:07You can display data from nearly unlimited amounts of resources, by just adding
13:10URL formats that can grab from your web browser.
13:14Adding web viewers to your database can really add some wow factor to
13:17the FileMaker layouts.
Collapse this transcript
"Scraping" source code from web pages
00:00We've been talking about how we can use the web viewer layout object to display
00:04data from web pages inside of the context of our FileMaker layouts.
00:08We can also talk about how we go into the web Viewer Setup and we can actually
00:12pull data from records in our FileMaker database or fields even within a record
00:18to dynamically display those web pages in our FileMaker layouts.
00:22But web viewers can also be used to not only display web data, but also to
00:26consume web data into the database.
00:29Let me show you an example of what I'm talking about and then I'll kind of
00:32reverse engineer how this works.
00:34If you open up the exercise file Invoice 09_02, you'll see that I've got a
00:38layout called Conversion.
00:40All I've got going on here is just a simple web viewer and I've got a text field.
00:46So we've got a web viewer that's unfortunately because I'm on Mac, it doesn't
00:50actually show the source code, which is really what we're gong to be working with
00:53here, but I'll show you that in a second.
00:55But it displays the contents of a web page,
00:58we'll talk about that web page here momentarily.
00:59Then I have a text field that we're simply going to populate with the data from
01:06this web page and then I've got two calculation fields and I'll show you how they
01:10automatically get populated once I consume the data from this source.
01:14The idea is I've got a web page, it's got some background source information,
01:18I want to pull that into my FileMaker database and then I can do whatever
01:22I want with that data.
01:23So I've set up a script here on this button that's called Scrape and when I hit
01:27the button, you see a couple of things happened.
01:29First of all this text field gets populated with what is actually the source of
01:36the web page that I am showing in the web viewer.
01:38But even more interestingly what you see here are two fields and each of these are exchange rates.
01:45So I've got the US Dollar exchange rate and the South African Rand currency exchange rate.
01:51Both of these are now instantly updated and now I have a database that
01:55I can import in on any frequency that I'd like to, whatever the most current currency exchange rates are.
02:02So let's look at how this whole thing works.
02:04So what I've done is I found a web page.
02:06In this case this is the European Central Bank's public website and they happen
02:10to have an open XML feed, that if you go to this address you can view yourself
02:16and it just shows me raw XML.
02:18So it could be an HTML page and in this particular technique if I went to a
02:24regular HTML page, I would be consuming in the backend source code.
02:28So in this case I thought it'd be a little bit easier for you to just look at code,
02:32in this case it's in the format of XML and show that we can consume this.
02:35Now what's nice about this particular feed and it's really the same with a lot
02:40of HTML sites, is that the code maintains a very specific format.
02:45So every time you load this page, the US Dollars are first, the Japanese Yen
02:50second and all these other ones are in this particular order with the South
02:53African Rand at the very bottom.
02:55So I can rely on the position of each one of these rows of data and all this
03:00header information stays the same. I can also rely on the position of the
03:04rate, where the rate actually shows up in each row.
03:07NowI'll talk about why that's important in a second.
03:09So what I've done in my database is I've created a web viewer that simply loads that page.
03:16So in this case we're just going to a static page and I've done one more step to this web viewer.
03:21You'll notice when we go into the inspector that I've named this object.
03:27You can name any object, like I've named this object over here the Field.
03:31I could name this button if I want to, you can name anything on the screen and
03:34we'll talk about why that's important in a second.
03:36So I've loaded the web page and it's really not meant for display, it's more
03:39meant for consuming all this information so this web viewer could be very small
03:42or nearly non-existent on the layout.
03:45Then this field, the source field, actually plays a very important role.
03:50You see here its just a text field, but if you look at the Calculation for USD
03:56and the Rand, I've used a somewhat simple parsing mechanism, similar to what
04:03we've talked about earlier in this course, where I use a middle function here to
04:08go into the text that I'm pulling from that XML page into that field and I'm
04:15looking for the specific position of this text, USD apostrophe (') space rate
04:21equals, and then I say I want to grab all of the contents;
04:27if we look at it you'll see it's a little bit easier to understand.
04:30So I say find out where this position is and then give me the six characters to
04:36the right of it and every one of these has six characters it just so happens
04:41that's what the format is of this particular site.
04:43So all I've done is then made a very minor adjustment to the Rand, so in this
04:50case I'm looking for the location of the ZAR space rate equals and then pulling
04:57the six characters to the right of that.
05:00It's a pretty simple stuff.
05:02Once I consume that data into the FileMaker field I can then consume it and
05:07parse it out in anyway that I'd like.
05:10And what this button does, you'll see we've got a script attached to the button
05:13that's called Scrape Rate.
05:15This technique is commonly referred to as HTML scraping or web page scraping and
05:20down here under Scrape Rates, it's a pretty simple script.
05:23What I do is I set a variable that's called Source and then here's the key to making all this work.
05:29There is a function in FileMaker called GetLayoutObjectAttribute and I can point
05:34to a layout object that I've named and, if you remember I named my web viewer WAP,
05:40and I can put this keyword in here.
05:43If you look in the FileMaker Help you can see what all the different keywords
05:46are, but if you're pointing to a web viewer and you use the keyword content in
05:51quotations like you see here, it's going to give me the source code and it's
05:55going to take that source code and as I've instructed it to do, set it to a variable
06:00and then I take the contents to that variable and I set it to the field called source.
06:04So all I'm doing is I'm just using the little technique of naming the web viewer
06:09and then pulling in the source code and then parsing the source code using
06:13normal data parsing techniques that we've covered earlier this course.
06:18So if you look closer at the GetLayoutObjectAttribute, you'll see that it
06:21has two parameters, the name of the object and then this attribute name and
06:25this will return the specified attributes of whatever layout object that you're naming.
06:29So name your layout object, in this case it was the web viewer, and then
06:31the attribute name. There is all sorts of supported attribute names.
06:35So we've got two parameters, we've got the objectName and then, the
06:38attributeName and that's the key to making this work.
06:41So the name of the supported attribute, and if you see below we've got content
06:44is the one that I'm using, that's the attribute name that I'm using, and there are
06:48several supported ones depending on which type of object you are pointing to,
06:52but I'm just focusing on content here because when you use the content attribute
06:55name against a web viewer, it will return the current content such as HTML code
06:59or view source or whatever information is on the back end of that site.
07:03Now I've created this is as a manual script, but we don't necessarily have to
07:06have this run manually.
07:07For example in a FileMaker database you'll see under File Options there is a
07:12script trigger for OnFirstWindowOpen and that's a script that I've created.
07:16What we can do is we could append this OnFirstWindowOpen script to run this
07:23script every time the database is open.
07:24The user will never even see any of this activity going on and all the while
07:28you'll be assured that you'll have the most recent currency rates.
07:32So we'll just add a couple of quick steps.
07:33We can say Go to Layout, Go to Layout and I'm going to pick the Conversion
07:43layout to see right there, so we're going to have some focus and then we're
07:48going to pause for a second, just for literally one second to give the web page a
07:56second to load, so we actually have something that we can pull in.
07:59Then we'll simply say perform the script, the Scrape Rates script and then
08:05after that we will commit the records.
08:09Pretty simple stuff.
08:11These four steps I've added to the beginning of the open script and so every
08:14time the file opens it will go for one second go to this page, scrape the rates,
08:18populate it, all your fields get updated in the background.
08:23We can even make this layout a calculator where we can allow users to pick any
08:26currency and then it would display that value inside the appropriate fields.
08:30We're going to use the same concepts that we've been working on and to do this,
08:34we'll use several of the techniques that we've talked about earlier in this course.
08:39Most of it involves a field that users will pick a currency rate in and then the
08:44rest of it is just making our calculations more dynamic.
08:46So if we go into Manage>Database, I'm going to add a field called CurrencyUser
08:53and, much like in our techniques with user driven relationships, I'm going to make
08:57this a global field so that it's session specific to the user.
09:01And then I'm going to duplicate one of my currency fields and I'm going to call
09:06it Currency Selected and change the name. Instead of always looking for USD,
09:14instead what I'm going to do is I'm going to have it look for the value that the
09:21user selects in the currency user field.
09:25So here we'll just add a little ampersand (&) and what we'll get back is a number in that case.
09:32So now what we'll do is we'll go on to this layout, just add the new fields,
09:38copy this field over here and we'll pick CurrencyUser and then this will be the
09:48value in CurrencySelected.
09:50So what I'm going to do to Currency User though real quickly is I'm going to add
09:54a pop-up menu and a value list and I've already created this value list in the
09:59example file which shows all the different currency abbreviations, just to save a little bit of time.
10:05Now if we go into Browse mode, see I can scrape, clear this out and scrape the
10:11most recent currency codes. I can select the Japanese Yen and I see the value
10:17appear there. I can select whatever these other things are and it basically
10:23gives me a user driven and session specific currency calculator that is based on our HTML scraped data.
10:31So web viewers, although primarily used to display dynamic content from the web
10:34within your layouts, it can also be used to combine with the get layout object
10:39attribute function in a script to consume data from the web dynamically and
10:44therefore enhance the functionality of your existing FileMaker databases.
Collapse this transcript
Using data URLs in the Web Viewer
00:00Web Viewer Layout Objects can be used to take data within the fields in your
00:04database records and display them as web pages within your layouts.
00:08And this works essentially because FileMaker web viewer is an unstored
00:12calculation that results in a web page, not technically, but figuratively.
00:16Web viewers can also display web pages, because what they do is they borrow the
00:20same engine that your computer's web browser uses. Specifically on Mac, the
00:25Safari engine is used; and the Explorer engine is used on Windows.
00:28So that way what you are trying to display requires a plug-in or something like that,
00:32make sure you install those plug-ins on either of those two browsers,
00:35depending on the operating system of course.
00:37Now since web viewers use browser's engines,
00:40that means that they can parse and display things that are wrapped inside HTML.
00:43That's basically what a web browser is.
00:46So FileMaker Web Layout Objects that are web viewers are really just using that
00:51same concept and that same technology.
00:53But what if you wanted to control the text that's displayed in a web viewer?
00:57Well, you need to wrap this text in HTML in order for the browser to read it;
01:00that's the same thing with the web browser.
01:03So let's do something like this inside our exercise files.
01:06Say for example on this layout where we've got the web viewer that displays a
01:10map of the contact information. It's programmed to display Google Maps,
01:16specifically of all the data that you see here in Address 1, City, State and optionally Zip as well.
01:23But what if there's no data in those fields?
01:24You notice here in the second record we don't have any data in the fields and
01:28all we get is a blue screen.
01:30It doesn't let the user know much about why they don't see anything in that web viewer.
01:34Say instead, that we wanted to show some text that tells the user that the
01:38fields must be populated in order to see a map that we need to modify the
01:42calculation formula that's been used to set up this web viewer.
01:46So let's go into Layout mode, I'm going to double-click on this.
01:49NowI should point out here that I'm not using the standard Google Maps option
01:53that FileMaker provides.
01:54Instead, I'm using a GetMap custom function, and if you've got a copy of this
02:02example file and a copy of FileMaker Pro advanced, you can go under the File
02:07menu to Manage, and then Custom Functions, and you can see how that's written.
02:11But essentially I've created something that's customized that just takes
02:14different fields and you use those fields as parameters, and if you want to use
02:20it, you'll notice that the custom function is listed there, GetMap and I just
02:23plug-in to different fields for the parameters for this particular map.
02:26So I just plug FileMaker fields in to where the fields are here, with parameters
02:31of the function and it renders as a map.
02:34Now what we want to do though is we want to add a condition in here.
02:37So let's say we go in and we say, if those fields are empty then let's
02:42display some text instead.
02:44So as we've talked about earlier in this course, what I'm going to do is I'm
02:48going to list all the different fields that you see here, just go ahead and copy
02:52these actually and, instead of delimiters, I'm going to concatenate all of these.
03:00So I'm going to say, if I put all these together and it's empty and that means
03:04that all the required fields are empty, and therefore, we want to show some
03:08text that tells the user that these all need to have a value in order for this to work.
03:13So I'll just add this as our test.
03:15So if is empty, all those fields concatenated together, then show some text,
03:23"These fields are empty," otherwise run this whole existing calculation already.
03:33Now let's check our syntax.
03:35That looks good, we see that in our in Layout mode, now, we go to Browse and Save.
03:40We see that we've got the map here, because that one has fields.
03:45Now here, you think you would expect to see text, wouldn't you?
03:48Well, the reason you can't see text is because we didn't format the text as HTML.
03:52So let me show you for a second what I'm talking about there.
03:56So here is the text that we might want to show inside of our web viewer and it's
04:00just written as plain text. This is how I put it inside of our calculation.
04:04The problem with this is that it can't be read by a web browser because it's
04:08not formatted as HTML.
04:09And even if you don't know a lot about HTML, you'll know that if you add the HTML
04:13and HTML head and body tags and then close those tags, that now it's formatted as HTML.
04:20Of course, I could add some things like formatting and what not, but just
04:23with the plain text, this is all I need to do to actually have it be read by a web browser.
04:28But even if you know how to format HTML text, it's still not going to appear
04:32because HTML actually needs to be hosted by a web server in order to be displayed
04:35if you're pointing to it from a web address.
04:39But there is a technique that I want to tell you about that you can use to
04:42display HTML that isn't presented by a web server, but instead, it's by using
04:47something that's called the data URL.
04:50Now the web page address specified for web viewers, usually a website located on
04:54the Internet, but it can also be a file path reference to an HTML file.
04:57So maybe you have a fully formatted HTML file on your network somewhere around
05:01a server and you are going to point to that and have that be read inside the web viewer.
05:06Web viewers in FileMaker Pro also support this concept called the data URL.
05:11And all the data URL is just a prefix that you put in front of any HTML code
05:15that tells FileMaker's web viewer, don't worry about this being hosted,
05:19just read it and parse it out as if you're the web server basically.
05:23All you do is, you just add a prefix to your existing HTML that says
05:27data:text/html, and then a comma. That's all you have to do, and then this
05:33will magically be parsed inside your web viewer.
05:35Now if you want to flatten this out, this is how it's going to look inside your calculation.
05:40So let's take the same text and instead of the text that we put in our
05:43calculation, let's put this text in instead.
05:46So back in Layout mode, we'll go in and we'll modify this, and we'll say,
05:50instead of just where it says these fields are empty, I'm going to paste in the entire string of HTML.
05:58Now we hit OK, we go into Browse mode, save our changes, and of course, we see
06:04that our map still draws when there are fields populated for the record.
06:09Here we don't have fields populated, but what we'll end up seeing is the
06:12text that we put in there. Your address fields must contain values for the map to draw.
06:17Now in this case we only use simple text to display HTML, but you can embed any code
06:21that can be written into HTML, into your web viewer.
06:24This next movie, we're going to explore how to extend that simple example that
06:28you see here of just text, into a really complex HTML string that represents
06:32interactive images and even additional code that's outside of HTML.
06:36So really, the takeaway here is with the combination of powerful web viewer and
06:41the extensive HTML library, the possibilities of what you can display in a web viewer
06:45are bounded only by your scripting skills and imagination.
Collapse this transcript
Using HTML5 in the Web Viewer
00:00I've put together a couple of demonstration files. These are not files that you're going
00:03to find in the exercise files folders, but some things that I put together,
00:07because I wanted to show you some particularly cool things that can be
00:10done inside the web viewer.
00:12In the last movie that we just did, we talked about how we can have some text
00:17show up as long as we wrap it in HTML and as long as we use the prefix, which we
00:23refer to as a data URL.
00:25So if you recall, what we did there is we had some text that was instructing our
00:30users to populate the address fields before a map could be drawn.
00:34So instead of trying to draw the map with some field references, we just
00:37had some text show up.
00:39If you even have a limited knowledge of HTML, you know that any text that
00:43you put in between these tags can show up.
00:46So for example, instead of the instructions that we did in the last exercise,
00:52you see that I can just change some information.
00:53So what you're seeing that I have here is a demo file, again, not in the
00:58exercise files, but something I just set up for you to show you a couple of concepts.
01:02And on the left-hand side what I've got is a web viewer, and on the
01:06right-hand side I just have a field. As you can see, the web viewer, after
01:10I type something into the field and commit it, it's just rendering whatever text I write.
01:14So the idea here is that I can show you on the right-hand side what it takes to
01:18actually have something appear on the left inside.
01:20So again, this is how you get a piece of text to show up in a web viewer.
01:25Of course, you could have an HTML file that's been hosted on a web server, but
01:28in this case we're just putting it right into a field, or we could have put it right into
01:32the web viewer set up, but we have to make sure to show the data URL first.
01:37So let me take this one step further.
01:39This is the idea of this demo is to kind of show you what's possible inside these web viewers.
01:44Now what I've done is I've still got the web viewer and it's still showing the
01:48information on this side, but instead of having just that HTML information
01:53that's showing the text, instead what I've done is I've put in some CSS and sort
01:58of style sheet information to, instead of showing text, to show a box, or to
02:02show a square with a certain color on it.
02:04Of course, I could manually change what this says inside the box, maybe
02:10the color of the box.
02:12I could even change the size if I'd like to, or the location of the box within the web viewer.
02:22Now keep in mind that I'm just manually changing this data here inside this
02:26folder, but you kind of get the idea that if this wasn't a text field, if it was
02:30maybe a calculation field or concatenated set of a bunch of fields, I could have
02:35a field that just does how close to the top, how close to the left, the height,
02:39the width, even the color.
02:41I could have all those be input field, or those could be something where I'm
02:45using the calculation engine to drive this information.
02:47So that's kind of part of what I wanted to help you see, to kind of get your imagination going.
02:52Also, I could do the same for the text that shows up inside of this box.
02:56Here I could type this over and put our Hello World message.
03:01Now of course, this assumes that you have a little bit of understanding of HTML
03:05and CSS. As I go forward I'll be using some JavaScript here, but I really
03:09want you to understand how powerful the web viewer is and how powerful using the
03:13data URL with HTML certainly can be.
03:16So let's take this even one more step further.
03:18You see what I'm doing in step three is that I'm showing an image.
03:21Now this is another little thing that I've stumbled across that I wanted to share with you.
03:25I have another file here that I call image and in this file this is sort of a
03:30demonstration file that I put together.
03:32There's not much to it, you can easily extrapolate from what I'm doing.
03:35But when FileMaker 12 came out, we discovered a really interesting new tag.
03:40This was a URL syntax that allowed us to point to a database.
03:47So in this case, I'm pointing to the ISOImage database and a layout called
03:53ISOimage; you see that here, and the field is called image.
03:58So I've got this field set up in the database, you see here its called image.
04:02It's a container field, it's even got external storage on it. What I'm doing
04:07in that case is, let's say we just blow that out, and if we look at our demo file,
04:13we'll see that we've already pulled this in. But that will effect the next time
04:16somebody loads this, because you can see I'm putting that exact same image
04:20reference into my HTML.
04:23So what I'm doing here -- what we found out was kind of interesting is
04:26if I insert a picture into that field, you'll see what happens is that now it
04:33automatically shows up in a web viewer and the web viewer is just simply
04:38pointing to that address.
04:39Now you can freeze this, and feel free to use this code, but all we're doing is
04:44just using the same string that we stumbled across.
04:48The key to this string here is that it's going filemakerxml/cnt/data.png.
04:57Now these are PNG files, so you can change that extension if you like to.
05:02This was the way that we found that we could store images inside of a hosted
05:06FileMaker file inside of a container, even with external storage, and then
05:10still be able to reference the contents of those containers within our interactive HTML.
05:15So you'll notice here, instead of having that box, what I've done instead, still
05:21use some CSS to talk about the position.
05:23You notice that I can manipulate that if I like to as well. But what I did, when
05:28I referenced the image, you'll see this information here, I'm going to give a
05:33little bit of padding, but here's that string.
05:35The string that just simply finds the record, points to the file, points to the layout
05:39and then points to the container. Then I give it some sizes and this
05:44is the height and width that I want to show that at.
05:47So a really neat way to incorporate the contents of a container fields into your
05:51HTML that's been presented inside of a web viewer.
05:55So this is a neat way to allow your users to drive this.
05:57So again, I'm trying to show you different ways to use your imagination to make
06:02this web viewer interactive and dynamic at the same time.
06:06So let's take this even a step further.
06:08I know what you are thinking now; we've gone way passed the HTML. But really,
06:14all this is a referenced JavaScript file. It happens to be called Kinetic.
06:20If you're interested in getting Kinetic, it's called kinetic_4.js and I just simply
06:27found that in the jQuery Library.
06:30This is something that you can go get. Its public access. Personally, I
06:34don't know much about JavaScript, but I looked in the library and found one
06:38that allowed me to manipulate different images and literally just copied and pasted it.
06:43So what I did is I copied and pasted it after the data URL and before the rest of my HTML.
06:48So it looks very daunting and very scary.
06:50If you don't know JavaScript, you can find someone that does. If you've got a
06:5510-year-old in your neighborhood I'm sure they know how to do JavaScript.
06:57But the idea is, it is all HTML.
07:00So I preceded the script and then we've got some additional information in here
07:04that references that script and does things like mouseovers and whatnot, and
07:09here you see those references again to the images.
07:11I've got three images this time.
07:13I've got an image for the person, which I can move around.
07:17So part of the JavaScript is letting me move this person around, and the other
07:22part is allowing me to drag it on top of something. Now it looks like I've
07:27just seated the person into the chair, but really what I've done is I've
07:31instructed it. When I get into a certain area with the first one and I release,
07:35then I want to load the person in chair image, so there's really three images here.
07:41So again, I know it seems little daunting, but I just want to let you know
07:44what's possible with FileMaker Pro.
07:45This is really just a very rudimentary example,
07:48but try to get the imagination going.
07:50So what I'm actually doing there is just some JavaScript, inside my HTML,
07:55a little bit of CSS, and I'm referencing images that are stored in a container.
07:59Now here's my favorite part; I can take all that same code and add one more step to it.
08:04So here's that same code again, don't be afraid of it.
08:08But now what I'm adding down on the HTML section is something that is a call.
08:15So I have a little function that I've said that when I drag this person over
08:19that seat, not only do I want to load the third image, the InSeat image, but I
08:24want to run something that's a fmp:// and then I reference a file, and you see
08:31what I'm doing here, is I'm running a script.
08:33I've got a script in this database that's called ReportDragPosition.
08:38What it does is it puts some text and then it takes two variables;
08:41dollar sign ($) left and dollar sign ($) top and it displays the values of those variables.
08:46The interesting thing is this HTML is calling back to the database and running a
08:53FileMaker Script, but it's also passing it two variables dollar sign ($) left,
08:58which is the value 300 and dollar sign ($) top, which is the value of 200.
09:01So all that together allows me to drag this person onto a seat. When I
09:05release it, it runs a script and in this case the script just shows the dialog window.
09:10These are some demo files that I put together, again, it's not in the exercise
09:14files, and these are things that I put together for myself, for the purposes of
09:17various other presentations.
09:18I wanted to share this with you, because this is the sort of the inception
09:22of some very exciting and compelling things are moving forward in the FileMaker world.
09:26It combines FileMaker Web Viewer Layout Object, data URLs, FMP URLs, a little
09:31bit of JavaScript, some CSS and some HTML5, put all that stuff together and you
09:36get some really compelling and imaginative things that you can do right inside
09:40the layouts in your FileMaker databases.
09:41Now if you are interested in more information on this, I've written a free
09:45article that can be found at this address:
09:47www.isolutions-inc.com/html5.html, and I cover all of the different
09:57demonstrations that we went through here with a lot more detail on data URLs,
10:01HTML5, JavaScript even pointing back to some of the lynda.com Essential
10:06Training titles, and I even talk about the FMP URLs, which I think are also very fascinating.
10:12So I appreciate you taking the time to look at this.
10:14I happen to think that after many years in the FileMaker market, this
10:18combination of technologies is going to lead to some of the most dynamic and
10:21creative and impressive things that we're going to see embedded into FileMaker
10:25Layouts that possibly we've seen ever.
Collapse this transcript
10. Sharing Your Databases on the Network
Peer-to-peer networks vs. FileMaker Server
00:00One of the primary reasons that organizations move to a database like FileMaker Pro
00:05over just managing their data on spreadsheets or Desktop databases
00:09is for the ability to be able to share the database and the data that's contained
00:12within it live, with multiple users concurrently.
00:15Centralizing your data and sharing it is a major step forward in maintaining
00:19data integrity for any organization. FileMaker Pro is an excellent option for such a step.
00:25Any database that's created in FileMaker Pro can either be used as a
00:28single-user database, which is just a database like the one that we have here
00:33on screen that I could just Save to my Desktop, or like a device iPhone, iPad
00:38or iPod Touch; or I can host this,
00:41or present it in a hosted environment where multiple users can all access the
00:45data at the same time.
00:46So depending on your needs, you may or may not need to share your data,
00:50although most users of FileMaker do need to share their data even if it's just
00:54sharing it with one other user, that's what we would call a hosted environment
00:57or a shared database.
00:58Now one very important point here that I want to make; we're talking about
01:02sharing your FileMaker databases, but I need to caution you with extreme
01:07prejudice that this is not file sharing.
01:10You should absolutely in no case ever, ever, ever, file share a FileMaker database.
01:15So what I mean by that is don't put your database, like the database we have here
01:19on screen, into a shared directory and then open it up and have another user
01:24open up that same file.
01:26That might be how you work with your spreadsheets or your word processing
01:29documents, but those are extremely different documents than what FileMaker is.
01:33FileMaker databases, even a single-user FileMaker database, is a delicate
01:38balance of moving parts internally that have been engineered in a very specific
01:42way to allow for seamless multi-user access.
01:45So you do not file share them.
01:47Even if the word FileMaker is also in the file sharing, they have no
01:51relationship whatsoever.
01:52So it's extremely important that you never file share FileMaker databases.
01:56The one reason for that is because you could permanently damage a
02:00FileMaker database by simply opening it in a file sharing environment.
02:04Those are not very common, but you should be aware that that is a possibility.
02:09FileMaker does however have a bunch of different very elegant ways that you can
02:13share these for multiple users, for either two users at the same time or up to
02:17hundreds of users, and I'm going to talk about those here in this movie.
02:20So your two options for sharing FileMaker databases are one that's called
02:24peer-to-peer sharing, which is using FileMaker Pro clients talking to each other.
02:29We're going to talk about that here and then also sharing using FileMaker server.
02:33So first let's take a look at peer-to-peer sharing.
02:36Now you may not now this, but by simply having a copy of FileMaker Pro, I have
02:39FileMaker Pro 12 here, but also a copy of FileMaker Pro 12 advanced,
02:44this will work in the same manner.
02:46If you have a copy of FileMaker and other users on your same network,
02:50and that's the key here, they need to be able to see your computer on the network.
02:55If you all have that, one of you can set up your copy of FileMaker Pro,
03:00the application, to serve as the host of a database.
03:03So let's say, I've got this database, there is a couple of steps that we need to do first.
03:06I first need to set up the database so it can be shared and that's one simple step.
03:10If we go under the File>Manage> Security you'll see extended privileges.
03:15Now we talked about extended privileges earlier in this course,
03:19but the one extended privilege that is critical to be being able to share is the fmapp,
03:23which allows access via the FileMaker Networks.
03:25So that means if you want to share from one client to another or more
03:29importantly on FileMaker server, you need to have this turned on at least one Privilege Set.
03:35So we see here the Full Access Privilege Set has it turned on.
03:37So we need one account that's active to have the extended privileges assigned
03:43to that Privilege Set.
03:45So that's all that is required for this database to be hosted.
03:48So keep in mind, this is not a default setting, you would have to go and
03:52turn this on yourself.
03:53So once you've got your database set for hosting, let me show you how can set up
03:57FileMaker Pro for hosting that database.
04:00Now if you look under the File menu of any copy of FileMaker Pro or FileMaker
04:03Pro Advanced, you'll see that there's an option for Sharing; and the first option
04:08you see for Sharing is called FileMaker Network.
04:10If I select that it pops open the FileMaker Network settings.
04:13Before I go any further with this I just want to say, this is not an optimal hosting environment.
04:18It's perfectly understandable if you have maybe one or two users that need to
04:21share your database, but I would go so far as to say -- this is not an opinion,
04:26this is the best practice -- that if you can support this infrastructure within
04:30your organization, anymore than just one single user in a database or
04:34potentially have others that might need to share the same database not even at
04:37the same time, you need to host it on FileMaker server.
04:40We'll go into the reasons why that is in a second and this is not a recommended
04:43hosting environment at all.
04:45FileMaker Pro is intended to be set up. They are very sophisticated hosting environment.
04:50It is not a workaround of any kind. It is intended to be hosted that way.
04:54So if you need to though, cost permitting of course, if you want to set up a
04:59network of FileMaker Pro clients, you can go with this route.
05:03So all you need to do in that case is open a copy of FileMaker Pro, this is
05:07a copy that's on a computer that is hooked up to a network that other users can see.
05:11So when you hit on, you'll see one change happen and that is that you get an
05:16IP address that shows up here, under the TCP/IP Address.
05:20Now that's your address and this is the address that you want to distribute to other users.
05:24Down below then you'll see whatever files that you have open and I only have the
05:28one file open and I can go in and I can Specify what level of Privilege Set
05:33access I want to allow any users.
05:36Or I can say, All users can see it or No users.
05:39If I have some files open that I want to host and some that I don't,
05:43I can turn No users on some, and All users on others, so whatever it is that you intend to do.
05:48So once that's done, you just simply hit OK and then now other users on your
05:52network, who again, can see your IP address from their machine, would go
05:57under the File menu to Open Remote and what they will see is the Open Remote file dialog.
06:04But because they are on the same network as you are, they go to Local Hosts.
06:08They are going to see a list of servers, or in this case this is your machine
06:14that is acting as a server. What they'll see is the name of the machine
06:18and then when they click on it, they will see the file name and they can simply
06:22hit Open. So now, you see that I'm actually logged into this file that's been hosted.
06:28If they cannot see your computer acting as a Host under the Local Host you can
06:32go in the Favorite Hosts, hit Add and then manually type in the IP address and
06:36then click on it. Many times that allows your users to see this.
06:40So this is what's called a peer-to-peer environment.
06:42Now granted, this is supported by FileMaker Pro, but is not optimal by any means.
06:47It is not a best practice for hosting databases, and again, the best practice
06:50is, if you have more than one user, you should be using FileMaker Pro Server.
06:54FileMaker Pro is a database platform that is intended to be shared with multiple
06:58users and can be shared with workgroups of up to hundreds of users, which we'll
07:02discuss those limits in a second.
07:04But if you find yourself having to use this peer-to-peer networking, let me
07:08present you with some of the caveats may be.
07:11First of all your limit in a peer-to-peer sharing environment is only nine
07:14additional simultaneous users.
07:16So including you, that's 10 people all accessing a database at the same time.
07:20You may have a workgroup that supports that number.
07:23Do not mistake this stat., this is not FileMaker's limit of how many simultaneous users
07:29can access the database, this is not even close.
07:31This is what the FileMaker Pro peer-to- peer environment supports, and again,
07:35it's not a best practice or recommended hosting environment.
07:39The host computer must have a static IP address. It's not critical, but if you
07:43have a machine that every time you reboot the machine, it gives you a DHCP or a
07:48dynamic IP address, you are going to have to continue to redistribute that IP
07:52address every time that you log on to your machine.
07:55Additionally, the host computer must remain on at all times or the connection will be lost.
07:58There's no magic here.
07:59You open up the file, you're the host, when you close the file, whether it be,
08:03because you've closed the FileMaker application or you've closed your computer,
08:06that connection is going to be gone. That might not be consistent enough for
08:10true workgroup environments, and the connections are not secure.
08:13The FileMaker has a very sophisticated and industry class way to secure
08:17communication between clients and server when using FileMaker Server,
08:21but that is not available to you when you're doing peer-to-peer connections.
08:25There are also no automated backups available when you're going in
08:29peer-to-peer environment.
08:30So unlike the very industry grade and stable backups that are available on
08:34FileMaker Server, you'll notice that there are none available and this can be up
08:38to you the user, to continue to make copies in to other locations if you want to
08:42backup your databases.
08:44And probably most importantly, the performance could be compromised.
08:47FileMaker Pro Server is set up to allow hundreds of users' simultaneously
08:51access to your database and allow them to do that in a very performance rich environment.
08:57Not the case when it's peer-to-peer, you're at the mercy of your network
09:00connections and more importantly, you are at the mercy of the processing speed
09:03of your workstation computer.
09:05So this is not an optimal environment by any means.
09:08Now FileMaker Server software, which is another product available from FileMaker
09:13Pro is the key for deploying FileMaker Pro solutions to many users.
09:17Using FileMaker Server, the FileMaker Solution can be shared among tens or
09:20hundreds of FileMaker Pro or FileMaker Go clients, all at once.
09:24All of them simultaneously accessing and, depending on their privileges,
09:28modifying data in your system.
09:30Now most choose to use FileMaker Server because they need to share for more than
09:33nine simultaneous users.
09:36But the following are reasons to host FileMaker Pro files with FileMaker
09:39Server, rather than the peer-to-peer sharing with FileMaker Pro, beyond just
09:42the number of users.
09:44First of all you can host up to 125 files at once on one server.
09:48Now keep in mind, you can have up to a million tables in each file.
09:51So really the file limits shouldn't matter much since you can build a ton of
09:55different tables into a single FileMaker file and they can all be related tables
09:59in a relational environment.
10:00So 125 files on one single copy server. You could have additional copies of
10:04server with other files on them if you like. You can provide data access for
10:08up to 250 FileMaker Pro, Pro Advanced or FileMaker Go clients, if you just have
10:13the standard version of FileMaker Server.
10:15It's the first tier of what you can do with FileMaker Server.
10:18Now there's a product that's called FileMaker Server Advanced that lifts the
10:22restriction of 250 clients and can allow hundreds of different simultaneous
10:28clients in a very safe and performance rich environment with no compromise,
10:32you just do need to upgrade to FileMaker Server Advanced in order to be able to that.
10:37You can schedule automated backups, which is critically important to any data
10:41environment and you can do so with integrity checking to make sure that with the
10:46databases that you are backing up are not bad backups.
10:49You can create FileMaker based websites and web applications using PHP or XML or
10:55even other applications that require XML; very powerful capabilities here from a
11:01web standpoint FileMaker.
11:02All you need is FileMaker Server in order to be able to host PHP applications
11:06or XML applications.
11:07There's another web technology that's called Instant Web Publishing
11:11that does require FileMaker Server Advanced.
11:14You can also view key information about hosted databases and connected users.
11:18So whoever your database administrator is can see who's connected at any given
11:21time, full logs of information, all the activities that they're performing, any
11:24errors, all sorts of notification, industry grade server level stuff.
11:29You can also automate certain scripts running in your FileMaker Pro solutions.
11:34So for example, if you have a script that automatically pulls in currency
11:38exchange rates from the web everyday, instead of having to have your users hit a
11:42button to pull that in, you can create a script and then go on to your server
11:47and have that script automated to run in the middle of the night, so that a user
11:49doesn't have to do that.
11:51I'll be showing you how to do that later on in this course.
11:54You get significantly better performance out of your FileMaker databases when
11:58they're hosted on FileMaker Server.
11:59Now in FileMaker Server 12, it uses all the resources available to you on the
12:03hardware device and allows you to create an optimal performance environment for
12:09those hosted FileMaker databases.
12:11You can also use external authentication as we discussed earlier in this course.
12:14So if you have active directory that's been used to manage single sign-on for
12:19example for all the other applications in your Windows environment, you can
12:22include your FileMaker databases in that single sign-on scenarios as well, all
12:26by using external authentication although that does require that your databases
12:29are hosted on FileMaker Server.
12:31Any of these are legitimate reasons to go with FileMaker Server for hosting.
12:35Keep in mind that FileMaker Server is another product that you must purchase,
12:39but you should seriously consider purchasing this product if any of the items
12:44that we discussed earlier are appealing to you or your organization.
12:47And also, keep in mind although I don't have any recommendations that there are
12:51some organizations out there that can provide hosting packages for you,
12:55that mean that you don't have to buy your own license of FileMaker Server, you
12:58can just pay a monthly fee and upload your databases to their servers.
13:02But most important, sharing your databases is the key to centralizing data
13:06within your organization and FileMaker provides either a peer-to-peer sharing
13:09for much smaller networks, but really the best practice here is any network with
13:14more than one user accessing a database should require the industry grade
13:18product that FileMaker provides that's called FileMaker Server.
Collapse this transcript
FileMaker Server vs. FileMaker Server Advanced
00:00Once you decide that you want to share your databases using FileMaker Server,
00:04you must then decide which of the two FileMaker server products are going to be right for you.
00:09First there's FileMaker Server.
00:11FileMaker Server allows you to host 125 files at once and provide data access
00:16for up to 250 clients.
00:18You can schedule automated backups and even do custom web publishing with PHP or XML.
00:25You can also gather all sorts of information about the users and the databases
00:28that are being hosted on server and then even automate the running of certain
00:32FileMaker scripts or even some operating system level scripts.
00:35The main reason that you would go with any version of FileMaker Server is
00:39because you really get significantly better performance out of your databases
00:42when they're being shared.
00:44Now currently, at the time that we're recording this, FileMaker Server 12
00:48runs at a cost of $999.
00:50Keep in mind there are organizations out there that will allow you to host
00:54your database on a shared server that doesn't require that you buy a license
00:58of FileMaker Server or FileMaker Server Advanced and instead you would pay a monthly fee.
01:02I don't officially endorse any of those in particular, but they are out there
01:06and they've been around for quite some time.
01:07So that is an alternative to investing the $999.
01:11But my stern advice is that if you're hosting your database for even up to two
01:15people, you should seriously consider one of the two FileMaker Server products.
01:19FileMaker Server is the least expensive of the two.
01:22FileMaker Server Advanced, as its name implies,
01:26it is a little bit more enhanced of a product than FileMaker Server although
01:30everything that FileMaker Server does FileMaker Server Advance does as well,
01:33it's just that there are some additional features that you get when you purchase
01:37and install FileMaker Server Advanced.
01:39Mainly, you can provide data access to an unlimited number of users of FileMaker
01:43Pro clients, FileMaker Pro Advanced clients, FileMaker Go clients, any client.
01:48Of course you have the 250 user limit on FileMaker Server and you have no
01:52limit essentially on FileMaker Server Advanced, although it does depend on the
01:58assumption that you have a sufficiently powerful server and your database has been optimized.
02:04If you follow normalization techniques and proper data modeling with your
02:07FileMaker databases, you can really set them up to be shared by hundreds
02:12of users if necessary.
02:13But if you get into the couple thousand user range, really in any database
02:18structure, even in a very overpowered server, now you might be reaching the
02:23limit of one iteration of FileMaker Server. Keep in mind you can always have
02:25multiple copies of FileMaker Server, each running different databases, and you
02:29can have dozens of them, and therefore, you could service organizations of thousands if need be.
02:36So keep that in mind and FileMaker ceiling isn't published, but it does have
02:40something to do with the server that you are running it on and the
02:43optimization of the database.
02:45You can also do something where you create local or external administrator
02:48groups inside the administrator software. If you have third-party consultants
02:53or other individuals in the group who don't need full configuration or
02:56administrative access to your server, you can allow them just to able to turn on
03:00and off different databases, we'll cover that later in this chapter.
03:04If you're interested in publishing your databases to the web using FileMaker
03:07specific technology, which is called Instant Web Publishing, you will be required
03:12to host that database on a copy of FileMaker Server Advanced. That is not
03:15supported on FileMaker Server, but if you do have a copy of FileMaker Server
03:19Advanced, you can have up to 100 simultaneous users all accessing a database on
03:26your FileMaker Server Advanced database server and they can all access FileMaker
03:31without a client and they can do so via a browser.
03:33Also if you have other applications that need to access data from hosted
03:38FileMaker databases via ODBC or JDBC, and again this isn't if your FileMaker
03:43database needs to reach into other applications via ODBC, this is just if it's
03:47being hosted and if other applications are going to pull data out of it or
03:51interact with it via ODBC.
03:52In that case you must host the database with FileMaker Server Advanced and you
03:57have a limit of 50 simultaneous remote users. That's actually quite a bit of
04:02remote applications all sharing access simultaneously into your database so
04:06that's something to be aware of as well.
04:08This product is priced at $2999. You can see there's a $2000 difference
04:14just to be able to have unlimited clients and to be able to do Instant Web
04:18Publishing and ODBC or JDBC publishing.
04:21So it really depends on what your particular environment is and which one of
04:24these two would make the most sense for you.
04:27If you want to compare these products, I put together a couple of screens here for
04:30you, and talk about some of the different things that are available. You'll see
04:33that most things like the set up administration, reliability, the fact that it
04:38is a true 64 bit application, and some of the security features, and also custom web
04:44publishing, you'll notice that all those are available in both of the products.
04:47One thing I want to bring your attention to is with Custom Web Publishing,
04:51that's really mainly doing PHP applications that use FileMaker as a backend.
04:54It's very popular technique.
04:57But if you're going to do that and you have FileMaker Server, you can support up
05:00to hundred concurrent connections.
05:02If you have FileMaker Server Advanced, that's 200 concurrent connections.
05:05I'll talk about this more in the web, that's not 200 sessions or connected users
05:10at any given time, I'll talk more about how that breaks down, but that's in any
05:14given second there can only be 100 or 200 requests being processed from the web.
05:20That does extrapolate out over thousands of users.
05:23We'll talk about that more in the web chapter.
05:26But the sharing limits change and then of course administrator groups and
05:31Instant web Publishing and ODBC and JDBC connectivity all require
05:34FileMaker Server Advanced.
05:37FileMaker provides hosting options for all types of network environments.
05:40Before you decide which version of server you'll need, you should look at how
05:45many users you need to provide access to and what types of access they will be
05:48requiring of your databases before you make that decision.
Collapse this transcript
Installing FileMaker Server and the Admin Console Start page
00:00When you've made your purchase of FileMaker Server and it comes time to install,
00:04it's a relatively easy process.
00:05We're going to go over that here in this movie, but like any other software it
00:09comes with one installer and it installs all the server components onto your
00:12desired machine or multiple machines, which we'll talk about in a second.
00:16But first let's take a look at the components of FileMaker Server
00:19and what is being installed for you.
00:21FileMaker Server is made up of many different components.
00:24There is Database server, which is the core database server that does all the hosting.
00:28There is a FileMaker Script Engine, which is a separate component that runs
00:32FileMaker scripts and plug-ins.
00:34And there is the Web Publishing Engine,
00:36it's a separate suite of software that handles all web connectivity to FileMaker Server.
00:41Now the web server is part of all these components, but it's not something
00:45that's installed or managed by FileMaker Server.
00:48FileMaker Server web publishing requires the default web server, which is
00:51either Apache on your Mac OS X or Internet Information Server or IIS on
00:56your Windows environment.
00:58So you're going to want to have that installed already before you do the
01:01FileMaker installation and those come free with any server grade operating
01:05system on each platform.
01:07Additionally there is the PHP engine by the way, that if you're using custom
01:12web publishing with PHP, the PHP engine will need to be installed alongside the web server.
01:16FileMaker Server can work with a PHP engine, if you already have it installed.
01:21However, you can install the version of PHP that FileMaker requires at the same
01:26time that you're installing your server components.
01:28So keep in mind, the web server does need to be installed ahead of time.
01:31The PHP engine could be installed ahead of time or you could just opt to let
01:35FileMaker install that.
01:36FileMaker will not install the web server, but it will install the PHP server.
01:40There is also the FileMaker Server Admin server component, which is the component
01:43that manages the deployment of FileMaker Server components such as the web
01:46publishing engine and displays the Server Admin Console on client computers for
01:51the purpose of configuring them.
01:52We'll look at the admin console in the next movie.
01:55The FileMaker Server Admin Console component also gets installed when you
02:00install server, that's Java-based administrative application with which you can
02:04administer one or more deployments of FileMaker Server.
02:07Now before you start the installation, you want to make sure to check the system
02:11requirements for your version that you wish to install to ensure that the
02:15software will run on your chosen machine.
02:17I strongly recommend that you refer to the FileMaker Server 12 Getting
02:21Started Guide, which comes with FileMaker Server but is also provided in this exercise folder.
02:27In order to install FileMaker Server you're going to need to install or run the web
02:32server if you are in fact, going to be using any web publishing; that needs to
02:36happen ahead of time.
02:37You'll quit any copies of FileMaker Pro running on the install computer and it
02:41is a best practice to not have any copies of FileMaker Pro or Pro Advanced
02:46installed on the same machine and server.
02:48As a matter of fact, it is best practice and a strongly worded best practice to
02:52not have any other applications running on your machine.
02:56You should have a dedicated machine that you're going to use to install FileMaker Server.
03:01You also need to make sure that you haven't already installed a copy of
03:04FileMaker Pro server using the same license key anywhere else on your network,
03:08because there will be a conflict upon installation.
03:10You got to meet any prerequisites that are stated in the server guide or any of
03:15the other server documentation and you're going to want to run the installer.
03:20Now when you purchase a copy of FileMaker Server or Server Advanced, you'll
03:24get an installer document much like you see here, but what we've done for the
03:28purposes of this exercise is we've gone to use the FileMaker Server Advanced
03:3330 day trial which is available at filemaker.com/products/fms as in FileMaker Server.
03:42So you can download this 30 day trial.
03:44It does have some limitations, but it does give you all the components of
03:47FileMaker Server Advanced.
03:49You'll also need to have an install key.
03:50This is the install key that was provided to us in this installer.
03:53Normally you'll get a Name, an Organization and a License Key, so that's all
03:57information that you're going to need to have before you proceed with this installation process.
04:02You can just copy that information if you'd like to, but make sure that the
04:06Name and Organization that you're provided with are typed into the installer
04:10with the exact same syntax.
04:12If they've got spaces and commas and periods and stuff like that and either one
04:15of those, you got to make sure to take those into account.
04:18So you can copy your License Key and then open up your installer.
04:22You'll double-click on the icon with the arrow to install.
04:27If you download it from the Internet, you can just dismiss this warning.
04:30You'll need to type in your admin password if prompted, which will be required
04:34if your computer does have one set up.
04:37And you can read through the information, hit Continue and Agree.
04:42Now you have a choice to make. You should be aware that you can install
04:47all of the FileMaker components either on one Single Machine, which we're
04:50going to be doing here in this exercise or upon Multiple Machines, really up
04:54to three different machines. You can split up the different components.
04:57So if you choose Multiple Machines, you're going to prompted to determine
05:01which of the two machines is going to be the master and the other is going to be the worker.
05:05Now the master is just the machine that's going to have the database engine
05:09installed and the worker are the machine or machines that will have things like
05:12the web publishing engine or Administrative Console or even the dedicated web
05:16and PHP engines installed.
05:18One key thing here is if you're going to choose Multiple Machines you have to
05:22install components on the worker machines first before you install the master,
05:26because when you run the installer for the master, you have to tell the IP
05:30addresses of those other machines.
05:31So for the purposes of this exercise we're going to choose a Single Machine installation.
05:35If you want more information about Multiple Machines, please see the server documentation.
05:39You can also use this to uninstall an existing copy of FileMaker Server from your computer.
05:45We'll advance to the next screen and we see that we have a License Key already
05:49installed. This is the one provided for the demo. Again not with the demo,
05:53but when you actually do get you license make sure that the syntax or the
05:56Username and Organization are exact before you proceed.
06:01Once all the files are installed you'll see a couple of things on screen.
06:04First of all you'll notice that a shortcut to the FMS 12 start page will appear
06:09on your Desktop and also you'll be prompted to start the Deployment assistant,
06:13which we're going to do.
06:15All you have to do to start the Deployment assistant is hit Continue, or you
06:19could quit at this stage and do the deployment later.
06:22To launch the Deployment assistant you just hit Continue and FileMaker will open
06:27up a web page, and this web page is going to be pointing to the IP address of the
06:32server installation with the :16000.
06:36That's how you can get to it at a later date if you need to.
06:39So what this page will do is download the Admin Console to your machine, but if
06:43you don't see it right away you can click this to launch it automatically and
06:48once the Admin Console is downloaded you will see a .jnlp file.
06:53The jnlp file is one that you can double-click to allow you to run the FileMaker Administrative Console.
07:01And again the FileMaker Administrative Console can be run on the same machine as
07:06the server or it can be run on another machine that has access to that server.
07:13Either way this is a separate application from the FileMaker Server.
07:17The first thing that you're going to see when you launch the Administrative
07:20Console for the first time is a screen asking you to enter in a User Name and
07:24Password and I strongly recommend that you write this down somewhere, because if
07:29you forget the User Name and Password after this stage, you'll need to
07:33uninstall the FileMaker Server and reinstall it again in order to bypass the security settings.
07:40So the next screen that you see is something that allows you to import
07:44installation settings from a previous version of 12.
07:46So if you had Server 12 on another machine and you uninstalled it and you
07:51want to migrate to a new machine, before you uninstall, as part of the
07:54uninstall wizard, you can see an option that allows you to save a separate file for your settings.
07:58So if you had done that, you would hit Yes, import my settings and import those
08:02all in, so any further configuration wouldn't be necessary.
08:06You can rename your server, if you have multiple copies of FileMaker Server on
08:11your network, you might want to name them accordingly and put some description
08:14of information on how to contact somebody who is the administrator.
08:18Then we get into the different technologies.
08:20Now because we're installing FileMaker Server Advanced, it's asking us if we
08:23want to enable ODBC/JDBC, we'll go ahead and say Yes.
08:26Also asking us if we want to enable the web publishing components and then
08:29asks us which one of the components we want to install, we'll leave all the default ones set.
08:34And here is where you can choose to defer to use your own PHP engine if you have
08:38one previously installed in this machine.
08:40Although it is recommended that you use FileMaker Server's version if you don't
08:43already have one installed.
08:45Now you can choose between your One Machine, Two Machine or Three Machines.
08:50In this case we're going to choose One Machine, meaning we're going to install
08:53or use all of the components on this single machine.
08:56And in this section, the Deployment assistant is asking you, which web server you're using.
09:01It's going to make a guess based on your operating system.
09:03Here we're on OS X, so it says Apache.
09:05Now you can see your web server documentation for how to install and start
09:10either Apache or IIS.
09:12But here we'll point to which web server we're using and hit Next, at which time
09:17it gives us a deployment summary indicating all the selections that we've made
09:22and then it will go through a process of deploying where you can watch the
09:25installation process happen.
09:29And once completed you'll get confirmation that the deployment was completed on
09:33your log file and you can hit OK.
09:36Once you're done with that installation, you will see the Welcome screen appear,
09:41which gives you a couple of different options.
09:43You can click the Register FileMaker Server, which allows you to go to the
09:47FileMaker page to register your installation or you can go to the Open FileMaker
09:53Server Technology Test page, which allows you to test things like instant web
09:57publishing by simply clicking, you see here your confirmation is that everything
10:01is installed properly, or you can also test to make sure the PHP is running,
10:05where you see here that is running as well.
10:08Now if you want to test FileMaker Pro you have to open a copy of FileMaker Pro
10:12and then you'll look under open remote for a file that's called Server_Sample.
10:16Installing FileMaker Server is pretty straightforward.
10:19Just make sure that you have some of the prerequisites in place beforehand and
10:21of course that you remember your User Name and Password.
10:26Once you have FileMaker installed, you can then use the Admin Console to
10:29configure it which we will cover later on in this module.
Collapse this transcript
Best practices
00:00Before we move on to configuring your FileMaker Server.
00:02I wanted to take a moment to share with you just some top line best practices for FileMaker Server.
00:09You should consult FileMaker's documentation on server, and if you're a member
00:13of TechNet I strongly recommend that you read a document that's called FileMaker
00:17Server 12 Configuration Guide, which is available to you with your TechNet
00:22membership through filemaker.com.
00:23But otherwise I wanted to share with you some important points.
00:28When you choose the hardware for which you're going to install FileMaker Server,
00:32make sure that you have some room to expand. The best practice or the formula
00:36here is to look at the exact size of the databases that you have, and then
00:42multiply that by 10 and that's about the footprint that its going to leave from a storage standpoint.
00:48FileMaker Server itself doesn't require a lot of space for installation, it really just is a service.
00:53So the only thing that you need storage for is for the databases themselves,
00:57but you're going to want ten times the space just simply for the fact that,
01:01you are going to be doing backups and saving backups at least temporarily on the same machine.
01:05Make sure that you're providing a suitable environment for the machine in
01:08best case scenario, you would have a server room with all the other servers.
01:13Don't use a personal desktop, don't use a machine that already is a mail
01:17server or especially not a file server; you must have file sharing turned off
01:21on the FileMaker Server.
01:22And don't use one that could be accidentally bumped into or possibly stolen for that matter.
01:28Do not install FileMaker Server on a user's workstation, for various different
01:32reasons, not the least of which is stability and making sure you have the most
01:36resources available to your FileMaker Server machine.
01:38And when at all possible, avoid running all other services, specifically email,
01:43printer file sharing, on same machine or FileMaker Pro or FileMaker Pro Advanced
01:47for that matter. The best case scenario and the supported environment for
01:51FileMaker Server is to be on a dedicated machine.
01:55Backing up your database files is critical. We're going to talk about that later in this chapter.
02:00You may be tempted to use mirroring or third-party backup software.
02:04The key is to backup your databases that are stored in the backups directory.
02:10We will talk more about that later in this chapter, but it's important that you know.
02:14Never point any third-party backup or mirroring software towards the live
02:19databases directory; you can damage those files if they're currently being
02:23hosted and if they're active.
02:24There's a lot of moving parts in a FileMaker hosted database and it's very
02:28important that you never backup or make any manual copies of any files in that
02:32directory. There is specifically a backup directory for that purpose, and you can
02:37use your third-party backup to back those up off-site.
02:40We'll talk in more detail about that in the chapter in Backing Up.
02:43Do not use any anti-virus software to scan live database files. Even if you are
02:48going to the Internet FileMaker Server services and components do not do any
02:52installing of anything from the web. There is no need to scan your live
02:57database files. Do not by any means point your scanning software at that live database directory.
03:04Disable screen savers and sleep functions and most likely you'll be using
03:08headless servers in an optimal environment anyways, but screen servers will
03:11disrupt the stability of your FileMaker Server service.
03:15Of course make sure that you have enough storage for 10 times the databases.
03:20And the key is, if you're going to choose what you're going to spend money on
03:23when you're choosing your hardware, spend money on I/O or the disk speed.
03:28It's a lot of RAM, multiple processors and a ton of memory storage, don't add up
03:33anywhere near to how important it is to have fast I/O. If you can get away with
03:3815,000 RPMs of speed, that is the best case scenario; 10 is recommended, 75 might
03:45be a little low, but if you have a choice between an additional processors or
03:50more I/O speed, go with I/O speed every time.
03:52All the FileMaker Server does is read and write that's it. It barely uses any other resources,
03:57It will certainly try to give your server the fastest I/O possible.
04:01You may also look into, in addition to have fast hard disk possible
04:05Multi-disc RAID systems or Reliable Storage Area Network or SAN systems for hosted databases.
04:11You definitely want to turn off indexing services or Spotlight, as these can be
04:16disruptive to the performance of your FileMaker Server and if it is a truly
04:19a dedicated server you don't need anything indexed on the operating system level.
04:24Also exclude your live database directory or even both directories from your
04:29Time Machine backups. You can use Time Machine to back up just the backup's
04:33directory but definitely exclude your live database directory from your backups.
04:38It is however recommended to disable Time Machine completely if you're on the OS X environment.
04:43Verify that Shadow Copy is also disabled on Windows if you're in a Windows
04:47environment; these features reduce performance of FileMaker Server.
04:52Things like Shadow Copy and Time Machine can be very CPU intensive and it's recommended
04:56that these are disabled on the server machine.
05:00Shadow Copy, which is sometimes referred to as volume snapshot service or VSS,
05:05is a backup and restore function that creates a point in time copy of files.
05:09And generally a feature like this provides little benefit on a server machine.
05:12If this feature is enabled it will significantly slow down the reading and
05:16writing of the disk which is the server I/O which is all FileMaker is actually
05:20doing on your machine.
05:22Installing FileMaker Server is pretty straightforward, configuring it is pretty straightforward.
05:26But make sure that you address some of these simple best practices and of
05:29course consult other documentation on best practices, and make sure that you're
05:33giving your FileMaker Server environment the best chance to perform at its highest level.
Collapse this transcript
Configuring FileMaker Server
00:00In order to configure the settings on your FileMaker Server you'll need
00:04something called the Admin Console.
00:06Now you are presented with the ability to start up the Admin Console at the end
00:10of the installation process. If you chose not to do that you can invoke the
00:14download for the Admin Console by going to your web browser and typing in the
00:19IP address where you've installed your server. If you've installed your
00:22server on multiple components putting the IP address at the web server, and put
00:26in :16,000, that's the port that FileMaker communicates on. Then you'll be
00:31presented with the FileMaker Start page, at which time you'll hit the Start
00:35Admin Console download page, and it will open up the Admin Console and prompt you to log in.
00:44You may also see a .jnlp file that got downloaded during the process and you
00:49can just go right to that file and double-click on it which will also open up the Admin Console.
00:53This process will also prompt to save a shortcut on your desktop or whatever
00:57location, if that's also more comfortable for you.
01:00Now again Admin Consoles can be installed on remote machines, as long as that
01:04machine has network access to the FileMaker Server.
01:08So if you have a laptop you can have various different Admin Consoles all
01:13installed on that as long as you can connect to the Internet and manage your servers.
01:17For example, as a consultant I have various different Admin Consoles installed
01:21on my machine at the office that allow me to log into my client's remote
01:25servers, to perform any kind of maintenance or configuration tasks.
01:29So in order to configure, we need to log into our Admin Console, and this is the
01:34Username and Password that you set up during the deployment process.
01:39Once you log in you'll be presented with the FileMaker Server Admin Console
01:44Overview. What you want to see here are green checkboxes next to all the
01:49different services, so you see we've got the three different components;
01:52Web Server, Web Publishing Engine, Database Server. In this example they're
01:55all installed on the same server, so I see them all under the blue header with
01:59the IP address of the machine where they're installed.
02:02If they're installed on three different machines you'll see three blue headers,
02:05all with their own IPs or two different machines and so on.
02:08So in order to begin the configuration process you'll click down on the
02:11left-hand side to Configuration.
02:13You'll see different hyperlinks that'll get you to the same places as the
02:17navigation on the left-hand side.
02:18But we'll start with General Settings.
02:20Now in General Setting this is where you can name your server we've named it
02:24during the deployment process, I can name it something different.
02:27This is of course for the purpose of if you have multiple different servers all
02:31in your same network.
02:32I should also note that if you're running the trial and you then choose to
02:36upgrade and purchase an actual license key, all you have to do is go to this
02:40tab General Settings Server Information and hit the Change License Key button.
02:44It'll allow you to upgrade to a fully working and licensed version of FileMaker
02:47Server without having to change any of your configurations or even pull the service down.
02:52The Email Notifications tab is not to be confused with any email sending
02:56features that you build in the FileMaker.
02:58FileMaker allows you to send emails through scripts either using the email
03:02client, or in a more robust fashion, directly through an SMTP server; that is not what this is.
03:09In that case, that's all on the SMTP server side; all you're building into your
03:13FileMaker scripts are SMTP information.
03:16This is specifically for if you want FileMaker Server to send you, the
03:20administrator, any notifications about errors or warnings that are coming from
03:25activity that's being logged on the FileMaker Server side.
03:27So if you are administrator and you want to be alerted if the service goes down
03:31or if there's some error encountered, then what you would do is put in the SMTP
03:34information that you want FileMaker to use, because FileMaker is not a mail
03:39program or SMTP program. That is what this is for; you put that information in
03:44here, setup your account, and then you can tell it which emails will receive
03:47these notifications and you can comma separate those for multiple emails.
03:51You can also choose Errors or Errors and Warnings. Warnings or errors are a
03:55little bit more verbose of notification.
03:58Admin Console can be restricted under the Admin Console tab, to just a series of
04:02IP addresses or one IP address.
04:06You can also set up a different Username and Password.
04:08If you forget your Username and Password you have to uninstall and reinstall FileMaker Server.
04:13But if you want to change it you can go in here and change it to the Username
04:18and Password button right here.
04:20You can also have it automatically check for updates, when you go to the
04:23FileMaker Start page in your browser.
04:25Finally Auto Start means, when you restart the machine do you want it to
04:29automatically restart the Database Server and or the web Server service?
04:33This is recommended for true server environments, but if you've just setup
04:36FileMaker Server on your laptop or a test environment, maybe you want to disable
04:40these because you don't always want that service on.
04:44Now Administrator Groups are something that are specific to FileMaker Server Advanced.
04:49I just logged in using my admin privileges that allow me to get access to the
04:54Admin Console, but I could setup subgroups for let's say consultants or
04:59individuals that I just need to be able to upload their own databases.
05:03As an IT person or administrator of the server, I probably don't want to be
05:07burdened with, having to continue to replace files every time somebody changes some things offline.
05:12So instead what I would do is I would set up a group, I would name the group
05:16whatever I want, and then I would give it a password, and I could enable the
05:22Start page and say, Here are your files.
05:29What we want to do is put in a Password and Confirm the Password, and this
05:36is what we will distribute to the different users.
05:39And the link that we give them will be this link that you see down here in the bottom.
05:43First we're going to want to save, what we've done give them a folder, these are
05:48group folders telling it which databases they have access to, so we're going to
05:52give them the access to sample database.
05:54So now when you see that you've got access to the databases,
05:59and you've given them all the privileges that you want them to have, and
06:03passwords you can then save this setting.
06:07And after you save the setting, you can then click on this button and you'll see
06:11what's called the Group's Power User page.
06:13So this is something that they can use to -- you just distribute this link with
06:17the IP address :16000/groups, and then the name of the group that you set up.
06:23So here's a message that you typed in. This, by simply clicking on it,
06:27will allow them to open any of these files in either Pro or Instant Web Publishing as appropriate.
06:34But they also then, can use the Group Name and the Password that you've given
06:41them to login through the administrative console, if necessary, as well.
06:46So Administrator Groups, great idea if you have individuals who have to manage
06:50their own databases, but it does require FileMaker Server Advanced.
06:52On the Database Server side you can manage how many client connections you can
06:56have, running on the server at any given time.
06:59You don't really need to manipulate this; it doesn't really allocate resources in
07:02any way, shape or form, but you can power this down if you're not going to use
07:06the maximum number of clients.
07:08You can set the idle time. This is something, if you set up in your security
07:12settings that users will be logged off after the idle time is met, you can set
07:17that idle time here by both checking it turn it on and then setting what the
07:20maximum time is that you want to use.
07:23And if you have a directory service this where you would configure the Directory
07:26Service information; same thing with Databases here. You don't have to really
07:32set it to a lower number, if you don't want to, but if you only have a few
07:36databases it can't hurt to drop that down and save whatever the little resources
07:40are allocated to it.
07:41Down on the bottom of the page is the database cache; this is an important setting.
07:45You'll notice here that, it's set by default to a 128 MB, and this is database
07:49cache that is used for everything from live backups, to indexing to a little bit
07:54on the performance side of your databases. It might be something that you're
07:59not familiar with, but one thing I can show you is, if you go over to Statistics here,
08:03you'll see that there's this thing called Cache Hit %.
08:06A Cash Hit % is something that you want to have between 90% and 95%.
08:11And you don't want it at a 100% like you see here, because that means that the
08:14FileMaker Server Service is currently using a 100% of the allocated RAM cache,
08:19which likely means that it needs more than that,
08:21it's just using everything that you've given it.
08:24So the way that you can give it more is by upping this amount here.
08:27You see that FileMaker Server Admin Console has given us an estimate of 3072 MB
08:34available on this machine, and so I can up that percentage to whatever limit
08:40that I want to, and then save that.
08:44And then, what I'll do is let it run possibly for few days or week or so
08:47depending on your activity.
08:49And see if I've gotten my peaks or my averages down into the 90 to 95 range.
08:54If I see that it's too low then I can go back to the Database Server and drop this download a bit.
09:00But this is what you have available to you for RAM cache, and this is what's currently allocated.
09:04So you can play with those, until you get to that sweet spot of 90 to 95.
09:08Security has some interesting settings here.
09:10First of all, I think the most important one, down on the bottom, is that
09:13FileMaker allows you to use industry grade encryption to encrypt the
09:16communication between your FileMaker Pro clients and FileMaker Server.
09:20And all you have to do is simply turn on Require secure connections.
09:25This will turn on SSL encryption of course, it does add a little bit of extra
09:29data packets to encrypt all that data, and then between your FileMaker Pro at in
09:33Advanced Clients and your FileMaker Server and any client that's using a session
09:37even IWP for that matter, those will all be encrypted.
09:41This is the only setting that requires you to restart the service after you apply it.
09:46Client authentication can be turned to allow FileMaker accounts only, or if you
09:51decide that you're going to use external authentication, you'll have to come
09:54onto the server and turn on FileMaker and external server accounts.
09:58Keep in mind that you turn this on, on the server it's the only thing that
10:01you have to do on the server, but you do have to go configure those accounts
10:04as group names in your Security Settings and we covered that in the first
10:08chapter in this course.
10:10The File Display Filter gives you the opportunity that when a user goes into
10:14file open remote and they select the server name.
10:18On the right-hand side window they can either see all the different databases
10:21that are hosted on this server or only ones for which they have a username and password.
10:27So if you turn on List only the databases each users authorized to access, they
10:31will then be prompted to enter a username and password or an account name and
10:35password once they select the Server, and then after they enter that they'll
10:40then be given a list of only databases that have that account active, so that
10:45way we don't see any other databases from any other groups.
10:49Keep in mind however that they will have to authenticate yet again, after
10:53selecting the file from the File List.
10:55I'm not sure why that is, but that is something to set expectations for your users.
11:00On the Folders these are all the locations of the Backup Folders and Progressive
11:04Backup Folders. It's advised not to change these unless you decide to keep your
11:08data in its separate volume then your application, otherwise you should leave
11:12these settings as is.
11:14Leave your FileMaker Logging settings as it is as well. Inside your Log Viewer
11:19is where you can see the different modules that are being tracked.
11:23All that is driven by the activity on the server, but here is where you can
11:28either change your intervals or change the Log Size, and also say what other
11:32types of events that you want to log. Access and Usage statistics are optional.
11:37Server Plug-Ins are outside the scope of this discussion. These are third-party
11:42applications or plug-Ins that are created by other manufacturers. See their
11:45documentation for use, but you should know that before you have any server-side
11:48plug-ins you need to enable FileMaker Server to run them in the first place,
11:53and then install them per the third-party instructions and you'll see them here once enabled.
12:00Finally turning on any web publishing technology is rather easy.
12:04You can go in here to General Settings and this is where you can manage your
12:08limit of web Publishing Sessions.
12:10Keep in mind that Instant Web Publishing is really only the web technology that
12:14actually uses database sessions, so it has a maximum of 100. You can even knock
12:19that down from 100, if you only expect to have a handful of users.
12:23It's not the same thing as Custom Web Publishing sessions. We'll talk about that
12:26again in the Web Publishing Module. You do not use database sessions for
12:30Custom Web Publishing. So this 200 limit means 200 concurrent users all making
12:35a request of your server at the same time. That usually takes about a second
12:38or less than a second to do that, and that means something completely different
12:42than the amount of sessions available for instant web.
12:44So even though this looks like it, does not mean that Custom Web Publishing
12:48Applications have only twice as many transactions available from the web as a
12:52Instant web Publishing session.
12:54Here is where you can turn on PHP, turn on or turn off XML and turn on or turn off instant web publishing.
13:02And finally, if you choose to have FileMaker Server Advanced be the host of ODBC
13:08connections, what this means is that someone or some other application more
13:12likely, wants to access data that's stored in a FileMaker database, that database
13:17needs to be hosted on FileMaker Server Advanced, not FileMaker Server but
13:20FileMaker Server Advanced.
13:21And again it's not if your database is reaching out, using ODBC to consume data
13:26from another source, but only if it's acting as a host, meaning another
13:29application is trying to consume data from FileMaker.
13:31So these are your General Settings for the FileMaker Server Admin Console.
13:36You can come back and change these at any time, but these are the recommended
13:39settings when you first set up your server and of course, all these are
13:43administered through the Server Admin Console, so of course see FileMaker
13:47documentation for any more details on any of the configuration settings that we covered here.
Collapse this transcript
Uploading and managing databases in the Admin Console
00:00Many of the most common administrative tasks in FileMaker Server concern the
00:04management of database files.
00:06FileMaker Server Admin Console not only allows you to configure FileMaker
00:09Server, but it gives you the ability to upload and manage files on the server.
00:14If you have FileMaker Server advanced you can also configure Administrative
00:18Groups to allow users to be able to back up and verify Databases as well.
00:27Once you've logged in to the Admin console you'll notice that there is a
00:31section called Databases.
00:33This will display all the Databases that are currently being hosted on FileMaker
00:36Server, and in addition it also shows you columns for each of the extended
00:41privileges or the technologies that it's enable to be able to be used with.
00:45So for example this database the FileMaker Server sample is available for use
00:51and access through FileMaker Go, Instant Web Publishing, XML, PHP, and even via
00:56ODBC, Clients and that's intentional in the sample file, because it's meant to
01:01test all the technologies.
01:02But if there are users that are logged into the database when you click on a
01:05database you'll see all of their Computer Names, Account Names, the Type of client
01:10that they are using in their IP Address all listed down below.
01:14For databases that are already being hosted by FileMaker Server you can do
01:19different actions like Open them, Close them, Verify, Pause, Resume, Upload, and Remove.
01:26So for example I have a FileMaker database that has a status of Normal,
01:31which means it's currently being hosted.
01:33If I were to select Close, I would then hit Perform Action and I would see that
01:38status changed to Closed.
01:39Any closed file is now eligible to be able to be removed.
01:45So if you actually want to remove and replace a database file, what you would
01:49have to do is first close it like I hit done, then go to Remove, and perform the
01:55action and then you would want to upload a new database in its place or if you
02:00have a database that's closed you can simply go to say Open and then you'll see
02:05the Status changed to Normal after you hit the Perform Action.
02:09Now if you have a database that isn't yet on the server and you would like to
02:13have it hosted, you can use the FileMaker Upload Assistant.
02:16You'll notice here in the upper corner of your Admin Console screen there's an
02:20icon for uploading a database.
02:22This will prompt the Upload Database Assistant window and the first thing
02:26you are asked to do is choose a folder or subfolder in which you want to add
02:31your database file.
02:33By default there is always going to be a databases folder and you can create
02:36subfolders if you'd like to.
02:38For example I can create a subfolder for exercise files, and then I will
02:45select that one and I will now select Add Database. Here's where I can
02:49navigate throughout the database, to the location of where the database is
02:56that I want to host.
02:57And I select the database and now, hit Next.
03:01After a brief checking of the configuration of the file, I can choose to
03:05automatically, open the database after upload, and then I see the Upload
03:08Status and it indicates that it's successful and then I see a confirmation of the database.
03:13Once I'm done I can hit Finish or I can go back and upload another one.
03:17And now I see that Database listed here with the status of Normal.
03:21I also see that it's configured for access via Go/Pro but not any of the other technologies.
03:26If you wish to replace your database that's been hosted on FileMaker Server with
03:30one that's currently offline something that maybe you've added some new features
03:34to or imported some data to, here are the steps that you would have to do.
03:38First you select the database that's currently on the server, and you hit Close,
03:44and Perform Action and you see the status change and now you have to hit Remove,
03:50hit Remove, and confirm and now you see that database gone.
03:56Now if you want to upload a new Database you can say Upload, Perform Action,
04:01choose the folder hit Add Database.
04:04And now select the database that you want to replace it, you see the checkbox,
04:10hit Next wait for your configuration, hit Next again, and then confirm.
04:16New in FileMaker 12 is also the ability to be able to download databases that
04:21are currently hosted on the server.
04:23So for example we have got the Sample database folder, we have got the Ex Files
04:29database folder here, and inside that folder is a Database.
04:32If I want to copy of such a database, I can go into here, select the Download
04:36Database action and hit Perform Action.
04:39This indicates to me that the files must be closed before I can make a copy.
04:43So of course I'll go back and hit Close, perform the action, go to Download,
04:50and now perform that action.
04:51And now it asks me, where I want to save this database, and I'll hit Download.
04:57Now the nice thing about this is that you can run the Admin Console on the
05:00machine that's remote to the server, which means you might have a laptop that
05:04you log in via the network, and connecting to FileMaker Server and you can
05:08download a copy of the database.
05:09Of course, you do have to take the database offline. As an alternative to
05:13creating a copy of the database by closing it first,
05:16what you can do, if you have an Open database, is you can go into the back ups
05:24under Schedule, select Daily and hit Run a Schedule Now and wait for the status
05:31to change to OK, and then you can actually go into your databases directory to
05:36grab that new backup.
05:38Now I am on an OS X Machine so here's where you can find the database backups.
05:43On Windows you would start with the program files directory select FileMaker,
05:47then FileMaker Server.
05:49On Mac you go Library, and then FileMaker Server, and then the rest is the same.
05:53There is a directory called Data and then a Directory called Databases.
05:58Inside the Databases directory you are going to be looking for the
06:02subfolders that you created.
06:04These are your live database files.
06:06This is the directory that you should never manage, you should never handle this
06:10with backup systems, or create mirrors of this, or use this for virus scanning,
06:15or even manually copy files out of here.
06:18This is the directory that should be off limits at all times. Instead, the backups
06:22directory is the one that you want to manage.
06:25These files are not live they're currently offline. You see that whenever a
06:29backup is created, it creates a complete copy of the database folder.
06:33And so here's a file that I could copy, or drag onto another device, or move it
06:39somewhere where I can work with it offline.
06:42So the take away here is never touch anything in the Databases folder, always
06:47just use the Backups folder, and you can use backups to manually create a
06:52database if you want to pull something offline while its being hosted.
06:55FileMaker Server provides an Admin Console to allow you to manage databases that
06:59are being hosted on that machine.
07:01Using the Admin Console to manage databases, provides you with a safe method for
07:04uploading, opening, closing, and even downloading databases from your server,
07:09even if you're accessing the server remotely.
Collapse this transcript
Scheduling backups
00:00Many Database systems are used all day and everyday.
00:03One of the strengths of database is their ability to store and retrieve critical data.
00:07This critical data however needs to be protected and storage in databases does
00:11not constitute much protection on its own.
00:13So any data that's critical to an organization must be protected through some
00:17scheme of data backups.
00:19So in this movie I am going to talk to you about the powerful backup features
00:22that are available in FileMaker Pro Server that are there to protect the data
00:25that's stored in a your FileMaker Pro solutions.
00:27There are a couple of very important rules that I want to establish before we get
00:31into the backup mechanisms.
00:33First of all, do not use backup software to directly backup open FileMaker files.
00:38I cannot stress that enough.
00:41You need to be aware that there are two directories that contain
00:44FileMaker backup data.
00:46Inside your FileMaker Server directory, inside the data directory, there is a
00:49Databases directory but under no circumstances should that ever be manipulated
00:54by human or by automated system.
00:56Those files must be kept in their place without being touched or manipulated at all.
01:01And this goes for backup tools.
01:03Backup tools have means to deal with open files such as simply waiting 'till a
01:07file is closed, and all these other things, but none of them take into account
01:10the sensitivity of FileMaker databases.
01:12So please understand never, ever, ever backup open FileMaker files
01:17and in open FileMaker files any file found within the databases directory.
01:21However you can backup, or copy, or move to a different location
01:26any file that's found inside the Backups directory.
01:29Just want to make that perfectly clear.
01:31Now these warnings are not meant to suggest that FileMaker Pro databases cannot be backed up.
01:35FileMaker itself contains features that will assure safe, clean backups, of our
01:40active FileMaker Pro databases that will take data from these database folders
01:45into the Backups folder. That is exactly what the backup scheduling does
01:50inside the Administrative Console. That's what we are going to be talking about in this movie.
01:55Backed up copies will be incomplete and likely corrupt, so remember that.
01:58There is also significant risk to the live hosted databases that they will also
02:02become corrupted if you try to copy something from the live databases folder.
02:06The idea here is that you have got live databases you are going to use the
02:11FileMaker Admin Console on the server-site to create backups.
02:15Once you have those backups created, then you can do something with them in any
02:19kind of automated fashion.
02:20So as you see here on screen, let's say we've got a couple of different files,
02:23Bonsai, FTSMeetings.
02:26We use FileMaker Server to create a scheduled backup and it creates some files
02:31in the Backup directory. Then you can do things like transfer those backed up
02:34files to remote, network backups, tape backups, remote disk any kind of
02:39offsite storage location.
02:40Note that this lesson that we are talking about here does not attempt to teach
02:44us everything we need to know about the full backup regimen.
02:47Once you've used FileMaker's built-in backup mechanisms as suggested here on screen,
02:50it's still going to be necessary for you to use system level backup
02:54software to create a more durable backup.
02:57Also it's highly recommended to create some sort of strategy that involves
03:00remote or offsite backups, because just having something local on your machine
03:03doesn't protect you against damage to the machine itself.
03:06So how do we create backups in backup's directory?
03:10Once you log into the FileMaker Admin Console, you'll notice that there is a section
03:13called Schedules underneath the Administrative area.
03:15When you first log into Schedules you'll see that there are three Schedules
03:19already reconfigured by default, FileMaker does these for you.
03:22One of them is called Daily, the next Hourly, the next Weekly; they are pretty self explanatory.
03:27And you'll notice that the Daily has a check under Enabled, which means
03:30that right out of the box, after installation, it's already setup to create daily backups.
03:35You'll also see that you've got some actions available to you to create, edit,
03:39duplicate, delete and run other schedules.
03:43So how about we take a look at the existing schedules by choosing Edit a
03:47Schedule and hit Perform Action.
03:51So when you setup a Schedule or Edit a Schedule, you can choose all databases
03:54that are being hosted, or you can setup special backup schedules for
03:57individual sets of databases.
04:00So for example I could just go to the Sample file databases, and even within
04:05that I could just select a single database if I want to.
04:09But here we'll select the sample directory and then we tell it where, we want to store it.
04:14All that you can do here is make sure that it's in a subdirectory below the
04:20data directory and you can call it Backup, so you can create another directory
04:24if you would like to.
04:25Now the number of backups is an interesting option here.
04:28What this will do is create a folder in your Backups directory for everyday that this schedule runs.
04:33And you can tell it how many you want to keep.
04:36So if you say 7 for example, that means on the seventh day, it's going to
04:41create a new directory and that directory is going to replace the oldest one that you have.
04:45So you've always got the last seven days of backups.
04:49And you'll notice inside our Data directory, inside Backups, that each backup
04:55directory that's created has the word daily, weekly, whatever it is that it's
04:59called and then a timestamp and inside that are a direct and save copy of the Databases directory.
05:06So what you are actually telling FileMaker to do in this case is create seven
05:10of those, each gets a unique name and it only gets overwritten after the seventh copy has been made.
05:17You can also tell FileMaker you want to verify backup integrity and what that
05:21does is make sure that the backups that are being created are not corrupt.
05:25And if, so it will send an error message and possibly notify you if you have
05:29that setting setup in the database.
05:31It's also a good idea to create a clone of a backup, because if you do find
05:35that you've got corrupted databases, all you can do is recover them to extract data out of them,
05:39and then migrate the data into the healthiest shell or clone of a database.
05:43So if you are creating a clone every time you create a backup then, you're
05:47always going to have a healthy shell on hand.
05:50Next you'll see where you can pick the Frequency. You can pick Daily, every so
05:54many days, once, one time only, weekly, whatever it is that you like. You can
05:58pick Start Dates or even End Dates if you want to just run them during a certain cycle.
06:02Once per day at a certain time, or run them X number of times or X number of
06:08hours, starting at a certain time ending at a certain time, whatever it is that you prefer.
06:12And you can name the schedule and even have notifications being sent and here it
06:18tells you that you need to go into General Settings to setup your SMTP
06:21Information in order to be able to send emails.
06:24But here we can do a comma delimited list of individuals who are going to receive these emails.
06:29There is your summary and then you can hit Finish and we'll just say No on that one;
06:33Hourly, Weekly, these are already created.
06:36So the idea is you can create your own customized ones. Maybe certain databases
06:41need to be backed up more often than others; maybe certain groups of databases
06:44need be backed-up more than others.
06:46The recommendation is to at least have one daily backup perhaps a couple hourly
06:50and then do weekly backups on top of that.
06:53That way you're only going to have so much data loss at any given time.
06:57Then always make sure to have multiple versions of the backup; 7 for daily and
07:01for hourly it's up to you to pick; but weekly it might be a good idea to do four those as well.
07:06Backing up your databases is one of the most critical responsibilities you have
07:10as a database administrator.
07:11So make sure all of your databases are backed-up appropriately and that any
07:14third-party backups are only pointing to the backup's directory.
07:18FileMaker Server Scheduling tool is the perfect way to schedule these safe backups.
Collapse this transcript
Scheduling scripts to run on the server
00:00We have already taken a look at FileMaker Server's ability to schedule backups.
00:05But we can also use that scheduling engine to do other things, and the most
00:09significant of those is the ability to run scripts.
00:12So in addition to being able to run what are called System-Level Scripts, or
00:16scripts that are written to actually run on the OS level, not within FileMaker.
00:20FileMaker Server can also execute FileMaker Scripts that were created inside hosted FileMaker Pro files.
00:27Of course those were the scripts that we were talking about that we see under
00:31Manage Scripts and any script that you create inside a database it's hosted by
00:34FileMaker can be run or scheduled to be run by FileMaker Server.
00:39However there are some caveats; you need to make sure that your script and script
00:45steps are compatible to be run.
00:48And the way that you can tell that is by opening up your Edit Script Window and
00:52you'll notice in the bottom left in a corner that you have a dropdown that lets
00:56you choose all the different technologies that could run a script and it tells
01:00you which ones are going to be compatible.
01:02So if we hit Server you'll notice that first of all in the script that you have
01:06already authored, you might notice things like, Perform with dialog (NOT COMPATIBLE)
01:09those types of things.
01:11But if you scroll through all the script steps on the left-hand inside you'll
01:15see that some of them are grayed out, some of them are not grayed out. All the
01:19ones are grayed out are not eligible to be run inside a server-side schedule.
01:24You might also look at some that say they are compatible but might have some
01:27portion of it not compatible.
01:29Some of these are pretty logical there are pop-ups that you don't even have a
01:33user there to pop up, some other things like inserting different things like
01:37containers that's going to be impossible to do, or exporting field contents and
01:42those types of things.
01:43But if you've written a script you can audit whether or not it can be compatible
01:47on the server, but everything looks good then you can host your
01:50database on FileMaker Server and then setup a schedule that will run those scripts.
01:54The way that you setup a schedule is in the Admin Console, under the Schedules section.
02:03So here you can create a new Schedule, and you'll see when you create a new
02:07Schedule that you select the task that you want to Schedule.
02:10So the most popular one is to create backed-up databases or even verify
02:15databases that are running, or even sending messages to users so you might
02:20want to send the message to users to get out of the database if your about to
02:24run a backup or something like that. The one we are going to focus on here
02:26is to run a script.
02:28So let choose run a script and you'll see that we have two different options.
02:33One is to Run a FileMaker Script which of course are the ones that you've
02:37designed inside the Database under the manage scripts or a System-Level Script as well
02:40A System-Level Script for example could be a script that opens up some
02:45other application and has it export out a CSV file of a bunch of data and put it
02:50into a certain directory.
02:51Than you could have a FileMaker script that runs an import script that goes and
02:56looks for a file of that name in that directory.
02:58Now sometimes the timing of those two scripts executing is going to be very
03:02delicate so that's what this third option is here Script Sequence.
03:05Script Sequence allows you to pick a System-Level Script and then a FileMaker
03:10script and instead of timing them properly, it's just going to wait till the
03:14first one is done and then run the second one, however you set that up.
03:17We are going to focus on FileMaker Scripts here.
03:20So I choose FileMaker Script, I hit Next, and now I pick the database that has
03:23the script that I want to run.
03:25So let's say here we want to run the script every night. That was the script
03:29that we created in the previously in the course where we were scraping, currency
03:34rates, from a web source and we're updating that date inside our database.
03:38Let's say instead of having users do that, or have it happening on the opening
03:41of a database, we want to run that in the middle of the night.
03:43So we point to that database, and then we have to log in, because if you
03:48remember some of the scripts or some of the actions inside the scripts are going
03:52to have privileges that are required in order to be able to do so.
03:56So you have to put in account that's going to have all the privileges necessary
03:59to run every step in the script and then you pick the script.
04:03And that script that we were using is called Scrape Rates and you can also
04:07pass a parameter to it.
04:08So you could say something like server or if you want to know how this script was run.
04:13In this case we don't need any script parameters, so we'll hit Next and here we
04:17can give it a maximum amount of time to run.
04:20This is purely optional but you can say, give it a 10 minute option, and then
04:24abort the schedule if that time is reached or the server has stopped.
04:28That's completely optional and not really used that often.
04:31So now what we can do is pick when we want this to run.
04:35So we can say we want it to run daily and how about if we run it just after
04:40midnight, so we know we have the daily rates, and we can call this Scrape Rates, hit OK.
04:50Let's choose not to Send Email Notifications, review everything then hit Finish.
04:57And now we see that already enabled and we see that hasn't run yet, because it's
05:01not that date or time yet and at some point we can turn this off, or go in and
05:07make edits if we want to.
05:09And here is a number cases where the ability to run scripts from the server
05:12could be useful it's really up to you and what you're doing with your databases.
05:14But things like periodic updating of calculated values, not to unlike what we're
05:19doing with the Scrape Rates, but inventory quantity on hand, student GPAs.
05:24Because you are going to be searching on stored updated values and its likely to
05:27work much faster, if your searching on dynamically calculated field data.
05:31So you might want to think about running the script every day that just goes
05:35and sets all those values rather than having untored calculations.
05:37That way our users can search on them more quickly or even use them as key
05:42field in relationships.
05:43You might also have to do reporting, or summarization of data for reporting
05:47purposes, or flagging records daily, such as doing deduping, or finding
05:52overdue invoices, or importing records from other sources, like I mentioned,
05:57or doing exporting, or emailing of records, or emailing of reports kind of
06:01auto report generating.
06:03So you can write all the scripts in FileMaker and then you can have
06:06FileMaker Server run them.
06:07When running these scripted actions, do not require users to access your
06:11FileMaker databases but they can still add very powerful functionality to your
06:15system. Nearly any hosted database can benefit from this in some way.
06:19So learning how to trigger a script from a server is a key concept to understand.
Collapse this transcript
11. Web Publishing: PHP and Instant Web Publishing
Understanding web publishing options
00:00Web publishing helps solve the problem of how to get your FileMaker Pro
00:04solution or the data in your solution into the hands of the greatest number of potential users.
00:10The best way to make a FileMaker Pro solution's data fully functional and
00:13accessible is to have users connect to it using the FileMaker Pro client and a
00:18host that database on FileMaker Server.
00:20However, in some cases this isn't practical.
00:22Perhaps because there is too many users, maybe more than 250 supported by
00:27FileMaker Server or simply because it just doesn't make sense to get them all of
00:32FileMaker Pro client.
00:33Or even because those users are physically too remote, or even unknown to you,
00:37which might lead to some either slower performance, or if they're unknown
00:41there is no way you can get them a FileMaker client; really, there is a
00:44plethora of reasons why users might need to be able to have access to your
00:48FileMaker data via the web.
00:49A lot of the time using the FileMaker Pro client may not be necessary because
00:54the larger user base needs only a small piece of the solution's overall functionality and data.
00:58In either case, some form of web publishing may be in order.
01:02So why might you want to web publish in the first place?
01:06Perhaps, you have many users who would need to interact with only a subset of your data.
01:10For example, let's say you've got a database solution where you store
01:13information on vendors and you want them to be responsible for updating contact
01:16information and certifications and different things like that.
01:20That way you can extend only that functionality out to the vendors thus
01:24removing the need for you to be able to manage that information in the
01:27liability of its correctness.
01:29Also when external users need occasional access to solution data this might be
01:34again, individuals updating profiles or somebody just adding a one-time
01:38application to your database, a lot of things that are taking the burden of data
01:42entry off of you and then, again the liability of the accuracy of that data.
01:46Also you may need to go to the web when FileMaker Pro data needs to be blended
01:51into an existing site.
01:52Perhaps you want people to be able to search on the inventory when they go to
01:56your website or even you need some shopping cart functionality or you want to be
01:59able to do course registration, or whatever it is.
02:02If the data is stored inside a FileMaker solution you wanted to be integrated
02:06seamlessly into your existing website presence then, you need to web publish.
02:10Quite simply when users do not have a FileMaker client, although I do want to say
02:14this is very important,
02:16using the web is not a replacement simply because users who could have a
02:20FileMaker client don't.
02:21We are or not talking about building a web application to circumvent the need
02:26for actually purchasing FileMaker licenses.
02:29FileMaker licenses are always the best plan if you have an internal solution and
02:34however many users you might have, it's always a better idea to access your
02:38database solutions with the client if that's possible.
02:40Of course some of these other scenarios it might not be possible.
02:45Also keep in mind there are third-parties out there like in the example of the
02:48vendors or people filling out applications, or signing petitions, or
02:51registering for courses or whatever it is, it's just going to be impossible for
02:55them to have a FileMaker client.
02:56The general public in the cases of shopping carts or other types of e-commerce
03:00perhaps they're not going to have FileMaker and you want to be able to have as
03:04many people interfacing with your database as possible.
03:08Simply put, when you're defining the requirements of a system, you may identify
03:12certain users or groups of users that are not going to have access to FileMaker.
03:16These could be those online applications who are selling products or vendors
03:19or parents checking on children's grades or potential customers viewing
03:23inventory, the list goes on; but let's face it.
03:25The reality is there's a web culture that's very mature and it's been
03:29establishing in nearly every industry.
03:31So it's your responsibility to be able to extend your business rules out to the
03:34web into those who expect to find your data there.
03:37Now you have some decisions to make when it comes to web publishing in FileMaker Pro;
03:41really you have two options.
03:44You've got Instant Web Publishing, which is referred to as IWP, or Custom Web
03:49Publishing, which is referred to as CWP.
03:52They are two vastly different technologies and I will give you my personal
03:57opinion that I've never used Instant Web Publishing in any practical scenario,
04:01but I am a big fan of Custom Web Publishing and use it all of the time.
04:05The technologies that we're talking about when we say Custom web Publishing
04:08are really just PHP;
04:09building an application that can be run in a browser that can access your
04:13FileMaker data and represent it in a way that's been coded with PHP.
04:18Instant Web Publishing is an interesting technology. It's something that's been
04:22around in FileMaker for many versions. What it allows you to do is publish
04:26your FileMaker database. I make that distinction because with Custom Web
04:31you're just dealing with data but with Instant Web, you're dealing with data the
04:35layouts that you create, all the layout objects, scripts that you create, access
04:39privileges, the whole nine yards and that is pretty attractive.
04:42Although Instant Web, even though it really is just the client experience in a
04:46browser, is not intended in any way to be an option or an alternative for
04:51circumventing the purchase of a client license.
04:54Custom Web Publishing also has the ability to do some real interesting
04:58things from a user interface standpoint but all of those get built into the actual custom app.
05:03So Instant Web Publishing will present information exactly in the same way as
05:07it is FileMaker Pro.
05:08As a matter of fact when you are designing layouts, you are designing the look
05:12and feel of the interaction that the users are going to have via Instant Web.
05:16In Custom Web you can take that data and integrate it in with style sheets in
05:21HTML and make it look and feel any way that you want inside of the technology
05:25that you already used to using on the web.
05:28There are some limitations to the browsers that can use Instant Web but there
05:31are no limitations to the browsers that can use Custom Web Publishing.
05:35Instant Web Publishing has a ceiling where you cannot exceed 100 consecutive
05:40users on a hosted database.
05:42Of course you do need a copy of FileMaker Server Advance in order to be able to
05:46even host an Instant Web Publishing solution.
05:50Instant Web Publishing uses something called a database session and those are
05:54capped out at a hundred.
05:56Custom Web Publishing has no cap.
05:58As a matter of fact even though it's stated that depending on your version of
06:02FileMaker Server you either have 100 or 200 consecutive interactions we're
06:06talking about requests at any given second with a database.
06:09So it doesn't mean that someone is on your web page trolling through your data,
06:12they are not even connected to your database in that case.
06:15It's only when they for example hit a Submit button, or add a record, or perform
06:19a search or something only for that brief second in time can you accommodate a
06:23100 or even 200 consecutive users.
06:25This expands pretty quickly out to thousands of users on your web application if you need it.
06:31If your system doesn't need to integrate with other web based systems like SSL
06:35or shopping cart systems or any other kind of technology Instant Web
06:38Publishing works but if you need any of those other integrations, Custom Web
06:42Publishing is your only option.
06:44And I like to boil it down to, if you really need to publish your database and
06:48its scheme along with the layouts and scripts and all those things that you
06:51already developed use Instant Web.
06:52Otherwise if you only need to share publisher data then Custom Web Publishing
06:56is the option for you.
06:57Now keep in mind that in some cases where it appears that Instant Web
07:01Publishing is the appropriate option, because maybe you want to share your
07:05database to remote users who only have access to the web, I would strongly
07:09recommend that you explore using FileMaker Go on compatible iOS devices like the
07:15iPad, or the iPhone, or iPod Touch, because they could probably access the
07:19database via those devices and have a richer experience than they would with
07:24Instant Web via the browser.
07:25And in both cases the browser is a free client and so is FileMaker Go.
07:29So if you've identified some users during your planning stage that require
07:33access to data but cannot access FileMaker the client, then web publishing is
07:37very appropriate option for you.
07:39If you've already ruled out FileMaker Go, then you're left with deciding between
07:43Instant Web Publishing and Custom Web Publishing, and between those you can find a
07:46technology that fits your solution and your business rules.
Collapse this transcript
Understanding Instant Web Publishing (IWP)
00:00As the name suggests Instant Web Publishing, which is often and will hereafter be
00:05referred to as IWP is a FileMaker Pro technology that makes a substantial subset
00:10of database functionality available through a web browser.
00:12And it doesn't require clients, which frankly is why it's the most popular.
00:17In theory, publishing a FileMaker Pro database to the web using Instant Web
00:21Publishing can be as easy as enabling a few extended privileges in an existing
00:25solution, but in practice it's rare that a FileMaker Pro solution of any
00:29complexity will translate seamlessly to the web so there are some things that
00:33you need to take a consideration.
00:34We're going to covering those in detail throughout the rest of this chapter.
00:38But it's generally best practice to create a web friendly workflow within your
00:42solution that will cater to the different display capabilities and behaviors of
00:45your Instant Web Publishing application.
00:48But before you go ahead and do that or before you even choose Instant Web
00:51Publishing, it's important to really understand what Instant Web Publishing
00:55is and what it's not.
00:56So first you've got a maximum of a hundred simultaneously connected users.
01:01Instant Web Publishing uses database sessions and FileMaker Server Advanced,
01:06which by the way is the only copy of server that can be used to host a database
01:10for Instant Web Publishing access.
01:12The Server Advance does require that there only be a hundred or less database
01:18sessions from an Instant Web Publishing client.
01:20Of course those clients are browsers, which can only be Safari, Firefox,
01:25or Internet Explorer.
01:27Other browsers are not necessarily supported or tested.
01:30And the databases of course, need to be hosted on Server Advance, which is a bit
01:34more expensive than FileMaker Server.
01:36And it's probably more appropriate for a defined user base; what I mean by
01:40that is that you know who these users are, you know what activities they are going to perform.
01:44Quite frankly, they're familiar with FileMaker and what a FileMaker database looks like.
01:48So if you've got some people who usually work in your network or in your office
01:52and on occasion they want to work from home or the road maybe then you offer
01:56them access via Instant Web Publishing. Because really, it's about setting the
02:00expectation that with the user of how the experience is going to work, and how
02:04it might be different from their expected FileMaker client experience.
02:07Keep in mind with Instant Web Publishing, just like FileMaker Pro, there is no
02:12way to separate the data from its presentation.
02:14So the layouts are there the workflow, layout, objects, all those things are there
02:19in Instant Web Publishing, whereas in other web technologies, you can have the
02:22data and then you can use whatever web technology like JavaScript or PHP
02:27combinations with HTML, that type of thing, to actually handle the presentation
02:31for you. All that's altogether in one thing in the browser in Instant Web.
02:35So really the way I like to frame this up is that Instant Web Publishing
02:39provides you with the means to create a web-enabled FileMaker Pro application.
02:44It's not web Published FileMaker data, like Custom Web Publishing is, but
02:48instead it's the entire application or the entire solution that's published to a browser.
02:53IWP can be an excellent solution but it has its limitations, we're going to
02:57discuss those later in this chapter.
02:59But if you're needs are not met with Instant Web Publishing, one of the Custom
03:02Web Publishing technologies might be the right choice. Or perhaps, and I strongly
03:06encourage this, if you do need to web-enable or remote-enable your FileMaker
03:10application, you should definitely take a look at FileMaker Go, which is the
03:14FileMaker client for any IOS device.
03:18So you might want to compare and contrast Instant Web Publishing with your same
03:22database in FileMaker go.
03:24Web technologies in FileMaker Server allow you to give your solutions a very broad reach,
03:29potentially as wide as the web itself.
03:30However, there are some trade-offs to be aware of, depending on which option you choose.
03:34And IWP is really the best choice when you want to create a web-enabled
03:37FileMaker Pro solution.
Collapse this transcript
Preparing your files for IWP
00:00Once you've decided that you want to share your FileMaker databases using
00:03the Instant Web Publishing technology then, you need to make that FileMaker
00:07Pro database available.
00:09And making that database available via the web begins in the file itself,
00:12specifically by way of the FileMaker extended privileges.
00:16If you remember in our chapter on Managing Security, you recall that there is a
00:22Extended Privileges tab under your Manage Security window. This manages all
00:27the different technologies that are available that can access your database.
00:31One of those is the Instant Web Publishing extender privilege or FMIWP and you
00:36need to make sure that it is assigned to at least one Privilege Set that has an
00:42active Account in the system.
00:44So we see here that the web privilege set has one active account assigned to it
00:50in the extended privilege for IWP is assigned to the web account.
00:55So that is all you actually need to do to be able to share your database via
01:00Instant Web Publishing.
01:02Keep in mind this is the same way that you set up your database to be able to
01:06be accessed using PHP for example, but in both cases, it's not just a matter of
01:11setting up extended privileges, but instead so there is some design
01:14considerations and subscripting considerations that you're going to need to do
01:18as far as building the database itself. We'll cover all those later in this chapter.
01:23Now just simply enabling your extended privileges are not enough to be able to
01:27allow FileMaker to be able to host databases for Instant Web Publishing.
01:31You're going to need to set up one of the different hosts that you have
01:34available to you to be able to share your databases to users with browsers.
01:39There are a couple of different options available to you when it comes to hosting.
01:43The first option you have is through the FileMaker Pro Client and the second
01:47option is through FileMaker Server.
01:49Now when I say FileMaker Pro Client I mean FileMaker Pro or FileMaker Pro
01:52Advanced. You can turn on the application and enable it so that it can act as
01:58the host, which means of course you need to be connected to the Internet to have
02:02to have a static IP and other users need to have your IP address.
02:06So the differences here as opposed to hosting with the client and hosting with a
02:10copy of FileMaker Server Advanced because of course FileMaker server does not
02:14allow for Instant Web Publishing hosting.
02:17But the main differences are you can support up to 5 concurrent users via the
02:20FileMaker Pro Client or up to 100 concurrent users via FileMaker Server.
02:25You have no secure connections on the client but SSL encryption available to you if
02:29you needed on the server, no backups or automation whatsoever on the client but
02:33scheduled backups if need be on the server, no event monitoring, of course event
02:38monitoring and logging on the server.
02:39So let me show you how you would set up the FileMaker Pro or FileMaker Pro
02:44Advanced application to act as a host for Instant Web Publishing.
02:48If you have a FileMaker Pro application you can open it up and under the File
02:53menu you go to Sharing>Instant Web Publishing and you're presented with the
02:58Instant Web Publishing dialog and you can hit On and keep in mind that if you
03:03have FileMaker Pro Server already running on the machine you are going to have
03:07to change the ports.
03:09I have that set up here for training purposes but it's very unlikely that
03:12well, first of all you should never have FileMaker Pro installed on the same machine as server.
03:16But if that's the case you can change to an alternate port. FileMaker provides an
03:20alternate port for IWP which is 591.
03:23Once that's turned on and of course it can't be turned on in this training
03:27environment, you'll see a URL here and if you chose 591 you'll see the URL
03:32appended with that port at the end of it; a colon (:) and then 591.
03:36You simply distribute that URL to any users that need access to your database.
03:40Then go into your database and either check it for no users or all users.
03:45If you choose all users or any of the specified Privilege Sets. then users will
03:48be able to hit that IP address and then see the Instant Web Publishing homepage
03:53with this database shown.
03:55Now it's not the preferred option for Instant Web Publishing but instead, if you
04:01have FileMaker Server you can go into the Configuration panel, choose Web
04:06Publishing and select Instant Web Publishing and make sure that enable Instant
04:11Web Publishing has been checked.
04:13Now it's also a good idea to have a session timeout here, which we'll talk about
04:17when we take our tour of the Instant Web Publishing interface.
04:20I suggest having that on and the default of 15 minutes is pretty good because,
04:25otherwise you've got those hundred sessions and if users just log out of their
04:29window without exiting or killing the session, something else needs to log them
04:32out in the session timeout will do that.
04:35You also have some control over the number of those sessions.
04:38So for example, if you want to lower that even below 100 you can go into the
04:42General Settings under the Web Publishing engine and lower the default setting
04:46of 100 down to whatever your preferred number of concurrent sessions might be.
04:50Now once you have FileMaker Server set up to be able to host for Instant Web
04:54Publishing, you need to have a database added that has Instant Web Publishing enabled.
05:00So let's replace the database that we have here that doesn't have Instant Web
05:04Publishing enabled with one that does.
05:06So we'll close this, perform the action, wait for that to be closed, and then now
05:12we'll remove, and confirm and now we've removed that.
05:18Now we will use the Upload Assistant and we'll add a database from our exercise files.
05:28Here's one that we've set up to make sure it had the extended privilege.
05:33Now we simply upload it like any other database, and confirm, and we hit finish, and
05:42you see now that we've got a database that has the Instant Web Publishing
05:46extended privilege active and now is accessible via the browser.
05:50Now in either case, whichever option you use to host your databases you're going
05:54to have to distribute the IP address to your users.
05:57So in either case you're going to want to enter in the IP address, so in this
06:00case we'll enter in the IP address.
06:06Now once you enter this information you can hit enter and your users will be
06:10presented with what FileMaker calls the Instant Web Publishing homepage.
06:14FileMaker provides you with two different ways that you can host your database
06:17for Instant Web Publishing access and once your database is hosted it'll now be
06:21available for access via the web browser.
Collapse this transcript
Touring the IWP interface
00:00Once you've configured your database files to be shared via Instant Web
00:03Publishing and set up your host to host the file for Instant Web Publishing, you
00:09can then enter in the IP address of that server and up will pop the Instant Web
00:14Publishing homepage.
00:15What you'll see on this homepage are two hyperlinks in this case or a
00:18hyperlink for every database file that's configured to be shared on Instant Web
00:22Publishing. All your users have to do is click on the database.
00:28If there's a password they'll be prompted with entering the password here and they can log in.
00:35Now this is a very important point, you'll notice that this indicates that
00:39the layout is not supported for Instant Web Publishing because it does not
00:43contain the classic theme. This is the very first thing I want to show you.
00:47Back in FileMaker in Layout mode you'll notice that each layout can potentially have a theme.
00:54So all these different themes that are provided in FileMaker 12 and older are
00:59not compatible on Instant Web Publishing.
01:01However, there is one which is really the lack of a theme which is called
01:04classic which is compatible on Instant Web Publishing.
01:08What you want to do is have databases, we created a series of databases that
01:14only use the classic theme and those are the ones that you're going to want to
01:18have accessible to you from the web.
01:20Now going back to our tour of the interface, if we look at the FileMaker
01:24Server sample, we see that it does have layouts that are configured already
01:28for the classic theme and we can take a look at some of the functionality of FileMaker here.
01:32First thing you'll notice is that the status toolbar that you're used to
01:35when you're using the FileMaker Pro client is almost fully intact here inside the browser.
01:40You'll notice that you can navigate from record to record just like you
01:42would inside the client.
01:44You can see that you can add New Records, Edit, Delete and even Omit or
01:49Duplicate Records are show Omitted Records and all that type of stuff that you
01:53are use to under your records menu.
01:55Of course your menus are different, so you really going to have to rely on the
01:59status toolbar for this functionality.
02:02But notice some of the things that are the same we've got the ability to view
02:06something as a list, view it as a table, and view it as a form.
02:09Of course, if you set up any rules or restrictions inside your database those
02:13same restrictions will be translated here. You also have the ability to navigate
02:17between different layouts.
02:19Of course, here you see that we've only got two layouts that are showing because
02:23inside your Privilege Set for the web and for any accounts that are going to be
02:27accessing for the web, you can go in and restrict access to only layouts that
02:32have the classic theme applied.
02:34But you can still click inside records it might be one thing that you have to
02:39set an expectation with users about is that editing provides a different state.
02:43So for example, in FileMaker Pro you just click into a field start editing and
02:47then click out of the field and it's saved.
02:50Little bit different thing going on here, you click into a field you notice
02:53that you're in sort of an editing mode and you can tell that because your
02:56status toolbar has options change and now there is this Submit button or Cancel
03:00button or even Revert.
03:01So any change that you make, your users than have to hit submit.
03:04This is something that they're likely already use to;
03:07from using the web but it's not going to be something that they're used to if
03:11they're just using the FileMaker Pro client.
03:13So you could also train them to hit the Edit Record, which will just bring them
03:17into that same mode and then of course train them that they have to submit.
03:21Things like deleting records and adding New Records are all the same but in the
03:25case of new record, same kind of thing here, you have them entering some
03:31information and even on a new one they do have to hit Submit.
03:34Finding records is the same thing. It takes you into a different view but that's
03:39something that users are used to already because they have to be in find mode,
03:43you can have multiple requests, you can use you the Omit, you can Duplicate a
03:48Request or you can use your Extend and, Constrain, and Revert found sets all the
03:52stuff that you're used to, it wouldn't have been able to navigate through those
03:55different requests here.
03:57That Find mode is something that users are probably already used to.
04:00Sort is actually rather interesting.
04:02Sort will present a dialog that looks very much like the sort dialog at your
04:06users are already trained to use and you'll be able to move different fields
04:11over and performs sorts just like you're used to doing.
04:14Now one thing that you should be aware of is when you're looking at records in
04:18a list, we can't see it here because we only got four records, but that there are some limitations.
04:23In list view users can only see 25 records on screen at a time.
04:27And table view they can see 50 records on screen at a time.
04:31So than your record navigation now has you navigate from batches of 25 to the
04:36next batch of 25 or in the case of tables from one set of 50 to the next set of 50.
04:41Now what this is,
04:42is this kind of a web term and this is something that is familiar in web applications.
04:47For example, if you go to Google you only see ten of the results on screen.
04:52And this is called a fetch size and FileMaker is controlling your fetch size
04:55here because let's say you have a FileMaker database that has millions of rows
04:59of records in it which is fully supported on the desktop and it doesn't do
05:03anything the web other than that's just a lot of data to be pushing out to a
05:08browser any browser or any technology for that matter.
05:10So FileMaker limits it to just batches of 25 or batches of 50 in table view
05:15because it doesn't have that layout overhead and therefore you don't choke web
05:19browser or the application or your servers or anything like that.
05:22So that's there for your protection but another thing that you're going to have
05:26to train your users on that let them have that expectation.
05:28Now the most important thing about this user experience on Instant Web
05:32Publishing is the logout screen.
05:35Now you could have different buttons, we'll discuss these later.
05:38You see that scripts are supported in the layouts just like they are elsewhere
05:43in the application. You've got thing like dropdowns and tab controls and web
05:47viewers and even viewing containers; all that stuff is still supported.
05:50But what you do have to manage is the users logging out.
05:55If they don't hit logout and they simply close this window that database
05:59session is still open and it's still being reserved for them on the server.
06:03Unless you set your server up to allow for a timeout that's just going to keep
06:07going until either the web server or your FileMaker Server times out.
06:11You need to train your users to be able to hit the logout button, which will
06:15take them back to the homepage and just let them now that closing the window
06:20will not stop the session.
06:22Of course, you can incorporate a script step for exit application into your
06:27different scripts or even assign that to a button on screen.
06:30Looks a lot like the FileMaker-like experience at your users are used to but you
06:35do want to take the time to either design a layout that fits within some of
06:39these IDP design restrictions or even train your users about some of these
06:43restrictions so that they can have a trouble-free user experience when they're
06:47accessing your database through Instant Web Publishing.
Collapse this transcript
Design considerations in IWP
00:00Enabling and configuring a FileMaker Pro file for Instant Web Publishing is pretty straightforward.
00:05Your FileMaker Pro layouts as well as a good portion of FileMaker Pro
00:09experience should come to life in a web browser by simply turning on Instant
00:12web Publishing web Hosting, and then hosting the file under either server or
00:17one of FileMaker Pro clients.
00:19For simple straightforward solutions it's really pretty much that easy, but with
00:23anything with any level of complexity, you may need to do some additional work
00:26before your database is ready for IWP.
00:29So in order to be able to do this before you decide to deploy your database via
00:33Instant Web Publishing, there are some tradeoffs that you need to consider when
00:37you want to go to IWP.
00:39So first let's look at the features that are available in that work faithfully
00:43within the IWP experience.
00:45FileMaker Pro Security model works just like it would on the client, as a matter
00:50of fact Accounts and Privileges governs web interactions as well as the Desktop
00:54and as a matter of fact, one account can be setup to allow access via the
00:58Desktop and Instant Web Publishing if need be. FileMaker Pro therefore offers
01:02single security model for all forms of different deployment.
01:07It does a pretty good job of rendering layouts.
01:09IWP presents these very faithfully, it uses an HTML CSS based rendition of the
01:15FileMaker Pro layouts that only uses the classic theme. So as long as you don't
01:19use any other themes besides classic, your layouts will render faithfully on the web.
01:24Instant Web Publishing users can view charts that are created in FileMaker Pro,
01:27but cannot edit an existing chart or add a new chart to a layout like you can in client.
01:32In addition, if the data for a chart changes, a refresh of the browser is
01:36required for the chart to update. Otherwise you get those nice charts that
01:40you design inside your FileMaker layouts and they look just like they would
01:43inside the FileMaker client.
01:45As we saw on our tour, the status toolbar enhances the look and feel of the
01:49Instant Web Publishing for your users by closely resembling what they already
01:53see in FileMaker Pro.
01:54This should ease the transition between FileMaker Pro clients in IWP, but we
01:58will require a little bit more training when it comes to things like submitting
02:02after different editing or record creation. Record management
02:07for the most part creating, editing and deleting database records in Instant Web
02:10Publishing, is just the same as you would in FileMaker Pro.
02:14But some actions that occur during database editing, such as portal refreshes
02:18and field validations, might happen a step later in Instant Web Publishing,
02:21because of the need to hit the Submit button.
02:24Searching and sorting;
02:26pretty much exactly what people are going to be used to. So if you really just
02:29need to provide a database for the purpose of allowing others to search, then
02:33Instant Web Publishing is a pretty good option for that.
02:36Instant Web Publishing can perform scripted actions via buttons, we're going to
02:40talk later in this module about some of the constraints, when it comes to
02:44scripting in Instant Web Publishing. Most steps are in fact compatible, but once
02:48you're familiar with the ones that aren't, you can then design scripts that are
02:51specific just to IWP deployments.
02:55Now just as importantly, it's important to look at some of the features that are
02:59not available to Instant Web Publishing users. These are certainly things that
03:02you can take into account before you design your database.
03:04But if you already have a pretty robust database created, these should be things
03:08that you take into consideration when deciding whether or not IWP is the right move for you.
03:13Script triggers; not supported in IWP.
03:16They are supported in one strange scenario and that is, if another script step
03:22that was not triggered by a Script trigger causes some action that would
03:25normally trigger a script, then in fact, your Script Trigger will run.
03:30So for example, let's say you have a script that says go to field, if you do a
03:35go to field script step and any script step that you have for on object enter
03:40for example, will trigger.
03:42But that can't be very predictable, and so really you should just expect that
03:46the script triggers aren't going to be available to you in your Instant Web
03:50Publishing workflows.
03:51List views as we discussed in our tour will only show 25 records at once, while
03:55table view shows only 50.
03:57We discussed the fetch size reasons behind those. And of course, the layout
04:01themes, classic themes is only supported on IWP and if your database is
04:05converted from previous version, then all of the Layouts are already set up to
04:09use a classic theme.
04:10But if you created a new database using a non-classic theme or modified any
04:13existing layouts to another theme, those are not going to be supported IWP.
04:19You don't have the ability to get into the managed security or database to be
04:24able to do things like update your schema or your fields or anything like that;
04:27it's just really just for the user experience.
04:30Preview mode is not available in Instant Web Publishing. There are some things
04:34that FileMaker Pro relies on, that are not controlled within a browser.
04:38Things like Preview mode really don't make sense, because when you print out of
04:43a browser, you are really just at the mercy of the browser, and then the driver
04:47that you have available there, rather than any layouts or constraints that you set up in FileMaker.
04:51So for that same reason printing; it is not that you can't print, it's that
04:56you're printing what you see in the browser.
04:58Instant Web Publishing uses a frameset, so it's not very elegant, you can't
05:02get very clean sort of letters that you can print out that are worthy of you
05:06sharing with clients or customers or something like that or reports or anything.
05:10Just like any other web page, you can print what you see on the screen and you
05:14can do your best to create print ready layouts, but for the most part, printing
05:18is not going to be the same experience that you have on the client.
05:21Things like Spell check Rich text editing, those are not available on
05:25the browser because the browser doesn't have Spell check or Rich text editing available to it.
05:30Container fields are interesting, you can insert items like videos or images or
05:34sound bites or even files into a container field in FileMaker.
05:38And it's possible to view the container field data from within IWP, but it's not
05:42possible to modify it.
05:44You cannot for example, insert images into container field via Instant Web Publishing.
05:48Files placed in the container fields in FileMaker Pro;
05:51that'll be viewable in downloadable from the web, assuming your browser is
05:54configured correctly to download and display these files.
05:57So this is something to take into consideration. IWP could be a great way to
06:01allow people access to different documents, and allow them to download them, but
06:05they just can't insert or replace anything that they see in the browser.
06:10Web Viewers work in IWP, but require some special considerations and testing to
06:14ensure that they function as they were designed.
06:16For example, a web page displayed in a web viewer may have a link with an
06:20associated attribute that when clicked will completely replace the IWP page.
06:24For example, the back and forward actions of the set web viewer are not
06:28supported in Instant Web Publishing, although it's possible to use the browser's
06:31shortcut menus back and forward buttons that are being emulated in those
06:35features in the web viewer, anyways.
06:37Additionally, if the URL calculated by a web viewer does not contain a colon,
06:42Instant Web Publishing will automatically add the http:// scheme to beginning of it.
06:47So these are things that you did not have to take into account on your
06:51Desktop, but you may have to take into account for Instant Web.
06:54Multiple windows; you can still initiate a script that opens a new window inside
06:58FileMaker's Instant Web Publishing, but it doesn't open a new browser window.
07:02What it does is it completely replaces the window that you're in already, with
07:06whatever the contents or the layout is in the new window that you're calling,
07:10then when you close that window, it just brings you back to the window before.
07:13So the layering of the new window is still intact, but every window opens up
07:18fully maximized, users can't resize it and they have no control over them.
07:23It's something that you have to take into consideration in your workflows.
07:27We talked about the User interaction, as far as prompting users for confirmation
07:30of edits and new records;
07:32those are things that you can probably train them for.
07:34There are some slight graphical elements where our things won't render correctly
07:37in IWP, maybe require more space, and things that are rounded look squared,
07:41those types of things.
07:43Layout object resizing and conditional formatting are not supported in Instant
07:47Web Publishing, any kind of keyboard shortcuts, custom menus or any local
07:52desktop interaction is not supported in Instant Web Publishing.
07:56The big one is Lookups, because of the request response pattern of web
08:00interaction, which is where you have to click into to put something into a
08:03field, and then hit Submit, and only at that point is it pushing that change
08:07back to the database.
08:08Because of that whole concept, picking a customer ID from a dropdown for
08:13example and having a populated bunch of related fields on the layouts, that's
08:16not going to work until after you hit Submit.
08:18So any kind of Lookups or any sort of Updating of related values that will
08:22populate other fields on a layout, all require that you submit the change before
08:27you can actually see those reflected in Instant Web Publishing.
08:31Instant Web Publishing does a great job of reproducing FileMaker Pro layouts
08:34with an HTML and CSS driven browser environment. With that said;
08:38there are a few things that do not translate well from FileMaker Pro clients to
08:42the browser, and a few things that require different approach than you might
08:46typically take in FileMaker Pro.
Collapse this transcript
Scripting in IWP
00:00Support for FileMaker Pro Scripting is one of the most powerful features of
00:04Instant Web Publishing but not all the script steps in FileMaker Pro can be
00:08executed from web, although many can.
00:10The way that you can see which ones are compatible, which ones are not, is to go
00:14into the Manage Script dialog, pick really any one of your scripts and you'll
00:19notice in the bottom left-hand corner, there is a Show Compatibility dropdown.
00:23If you choose Instant Web Publishing, it will show you all of the script steps
00:27in your authored script that are non- compatible, because they will show up as
00:31grayed out, but then also you can review all the different script steps on the
00:35left-hand side and see which ones are grayed out, verses which ones are still
00:39black and available to you.
00:41In general, the following categories of Script steps are not web compatible:
00:45anything that might interact with the local desktop environment, such as
00:48importing or exporting, or saving records as PDF, or Excel, or dialing the
00:53phone, those types of things; anything that edits container-field data such as
00:57Insert Picture, or File, or that type of thing, or even Export Field Contents;
01:02Script steps that manage multiple windows or adjust the size or position of
01:05Windows; or steps that manipulate the FileMaker Pro files, like Save copy As, or
01:10even Open file or Close file; Spellchecking;
01:15Script steps that open any element of the user interface, like Open Manage
01:19Database, or open up Help; even anything that involves Preview, because
01:23that's not supported;
01:24Or anything that involves presenting users with a dialog box, or something that
01:29they need interact with outside of a window, of course, the Windows will show up
01:33maximized, but any kind of dialog box with user interaction is not going to be
01:37available in Instant Web Publishing.
01:39The web Compatible Script Steps make the essential core of the FileMaker script
01:43functionality available to IWP based solutions.
01:46But constraints involving the lack of interaction with the desktop in the
01:49absence of a preview mode, are the principal areas where the workarounds may be
01:53needed. Also keep in mind that you don't have that multi window management.
01:57And it could seem like it's a significant deficiency, but many, if not most,
02:01multi window workflows can be configured to work in Instant Web Publishing's
02:04single window presentation style.
02:07So there are a couple of different things that you can do to sort of trap or
02:11workaround those limitations within your scripts.
02:13For example, we saw before a how when we went into our Instant Web Publishing
02:18Homepage and tried to open up our database, that we had a non-supported theme
02:24that wasn't the classic theme that was being presented, and therefore we
02:28couldn't log into that system.
02:30Now curiously the script that's being run was the culprit.
02:35So if you go under Manage Databases you'll see that there's a script called
02:39On First Window Open and that runs the first-time users are logging into a database.
02:45So right now we're not taking into account any of the IWP users and we're
02:49taking users to a default layout and apparently that layout doesn't have the classic theme.
02:55We do have a couple of different layouts that we've created, albeit it is not
03:00uber attractive, we are working within the bounds of the classic theme. Those
03:05are the customer details IWP and the Customers IWP layouts.
03:10What we've done is also set up a Privilege Set for web users that restricts
03:18them to only seeing those layouts.
03:25But the problem is if we have a script that's taking them to those layouts, we
03:29are going to get that error when the users try to login.
03:32So what we can do is modify the script. I am going to show you a technique
03:38here for how you identify that the user that logged into your database is
03:42logging in from Instant Web Publishing.
03:43And you get a bit of a clue here, because we can see it already. We've got a
03:47couple of If statements that you see that are using, If, PatternCount and then
03:52GetApplicationVersion.
03:54GetApplicationVersion is a function that will extract the user's client with
04:00some version information.
04:02But what's interesting is regardless of the version or the exact syntax it's
04:05being presented by the GetApplicationVersion there are some keywords that are
04:09available and we can do a PatternCount on those.
04:12So here we are doing PatternCount for iPad and for Pro.
04:17So what we are going to do is we are going to copy these and present another set.
04:26This time we are going to go and use the keyword of web, which will
04:30capture any instant web visitors.
04:34And we'll going to Layout mode Customer Details, and instead we will take them
04:39to the Customer Details IWP that we setup.
04:42And additionally, because there are some different script steps that don't
04:46affect Instant Web Publishing users, but do have some unsupported script
04:49steps, what we are going to do is we are going to exit the Script only if we
04:54detected that its web.
04:55So we will take them to the Layout, but then we will exit the script.
04:59So let's hit Save and see how their user experience differs, here's our
05:03database on the Network, and now here's our database, if we log in via Instant Web.
05:11And we see now with that error has gone away and it has detected that this is an
05:16Instant Web Publishing user, and in fact, taken the user directly to the layout
05:20that we designed for IWP.
05:22And now because of the Privilege Set that we also created for this web user,
05:26they are restricted to only the two compatible layouts.
05:31Now in addition to trapping users in doing different things or avoiding
05:35different things, if they happen to be logging in via Instant Web Publishing,
05:40we can also manage what happens when the user encounters a non-compatible script step.
05:45If an Instant Web Publishing user triggers a script that contains a
05:48non-compatible script step, there are a couple of possible outcomes.
05:52In most cases the script will simply stop once it reaches the
05:55non-compatible script step.
05:57On the other hand, if we were to go into a script like the one we're just
06:03working with, instead of exiting the script completely to avoid that, what we
06:08can do is add something called the Allow User Abort Script. Add that to the very
06:13top of the script and if we turn it off, then any script steps that follow, will
06:20be skipped and the execution will continue.
06:22So for example, we can run the script and even though we'll get to the set zoom
06:26level, instead of the script dying right there, it will just skip over it and
06:30continue on with the rest of the compatible scripts
06:32So in general, you want to avoid situations in which IWP users could trigger
06:36scripts that contain non-compatible script steps.
06:39Such Script steps could either stop your script dead, or force the script to run
06:43with critical steps skipped.
06:45But here's a way that you can mitigate that and skip it if you'd like to, but
06:49the more common approach is to detect what kind of user you have and then
06:54direct them to things or layouts possibly or features that are supported within
06:59Instant Web Publishing.
07:00There are also some special Script steps that you should be aware of.
07:05There are Script steps that do one thing inside FileMaker Pro, but perform
07:09in another way in the Instant Web Publishing. When you're creating these
07:12webs compatible Script steps, these are Script steps that you are going to want be aware of.
07:17These Script steps are the Open Record/ Request; executing the Script step is the
07:21equivalent to having the IWP user press the Edit Current Record button near the
07:25top of the Status toolbar or when they click into a field.
07:29So if you want to emulate that experience, if you are hiding the Status toolbar
07:32on the web for example, and want to have a scripted button to take the user into
07:36that mode, Open Record/Request is the one that you're going to want to use.
07:39And at the same time Commit Records/ Request is the equivalent to the user having
07:44to press the Submit button.
07:46So there's that Submit button that you see on screen, you can either script
07:50it, so it does it for them, or have a button on screen that has the Commit
07:54Records/Requests attached to it and it'll perform the same thing as a Submit button.
07:58Revert Record/Request is like the Cancel button in the IWP Status toolbar.
08:03Exit Application is a very important one. This will act like the Log Out button,
08:08and if your users can't see the Log Out button, or if you want to have some
08:12extra reminders in there that they should hit the logout button, then attach the
08:16Script step of Exit Application to any clickable button that has a script
08:20attached to it on screen.
08:22Support for FileMaker Pro scripting is one of the most interesting features of
08:26Instant Web Publishing, but knowing how to trap or avoid these incompatible
08:30Script steps, can help you create an environment in Instant Web Publishing that
08:33is smooth and fluid for your Instant Web Publishing users.
Collapse this transcript
Setting up your file for PHP
00:00Custom Web publishing or as I refer to it, CWP, comprises of a family
00:05of technologies that are more flexible and more powerful than Instant Web Publishing.
00:10With CWP, you have complete control over how FileMaker data is presented.
00:14CWP also lets you wrap your FileMaker Pro data in the look and feel of an
00:18existing website because you're using technologies that'll present it to a
00:22browser in different forms of HTML.
00:25However, this power comes at a certain price.
00:27CWP does not leverage any layout designs or screen elements that you may have
00:32created in FileMaker Pro.
00:33So although I can present customer data on the web, I can't show things like
00:38this layout or different buttons that I have designed or some of the dropdown
00:42menus, but all the data and even some of the ways that data are presented like
00:46in portals and dropdowns, those are compatible in PHP.
00:49They just have to be written or recoded in a PHP application.
00:53And it is up to you to design your application's web look and feel and
00:57eventually in something that'll look like HTML using whatever tools are best suited for the task.
01:02Now you must also create scripts in one of CWP supported programming languages,
01:07which most commonly is PHP.
01:10CWP solutions however require that you have FileMaker Server or FileMaker Server
01:15Advanced even for development purposes, because you're going to want to test your
01:19PHP application and be able to provide that application with data.
01:23Now I should note that members of the FileMaker technical network who have a
01:27FileMaker developer subscription do have access to a free FileMaker Server
01:30Advanced development license that can be used to build and test multi-user
01:34solutions without the need for a full version. Or you can do like we've done in
01:38this training and go and download the free 30 day trial version, which has full
01:44capabilities of FileMaker Server Advanced, which also allows you to be able to
01:49test your PHP applications.
01:51Now the PHP programming language is a very versatile tool or language that can
01:56be used to publish FileMaker data on the web.
01:59PHP is a text-based programming language.
02:01It's a very popular scripting language that is widely used in the open-source
02:05community and it excels at connecting many kinds of databases to the web.
02:09Now FileMaker Pro has its own connection library that employs PHP to connect
02:14FileMaker Pro databases and it's called the FileMaker API for PHP.
02:19So before you can start creating a PHP application, you need to set up your
02:23database so that it's accessible to PHP.
02:26If you want to allow your database to be accessed by PHP while it's hosted on
02:29FileMaker Server, you're going to need to set up some special layouts and then
02:34allow access to those layouts via the PHP extended privilege.
02:36Custom Web Publishing relies on layouts that are already defined within a
02:40FileMaker file. That's one of the interesting things; you have to set up all
02:44the fields that you want to work with on PHP into one layout and then you point
02:47all of your PHP coding activity to that one layout.
02:51So rather than inside your code talk about which fields you want, you can set up
02:56which is something similar to what a view might be.
02:59Instead of showing all of the different fields available, you can just set up
03:03separate little views that compartmentalize just the fields that you want.
03:06So let's do one of those for example inside of our file here.
03:09Let's go into Layout mode and we're going to go, New Layout. Let's say we
03:15want to be able to interact with the customer table via PHP. In this module I'm
03:20going to supply you with a already completed PHP application that does that very
03:24thing; allows you to add, edit or delete records in the customer table.
03:28So before we can do that we need to create a layout for us to be able to communicate with.
03:32So I'm going to pick the Customers table and I'm going to use a naming
03:36convention that allows me to see when I see this layout in the list that this is
03:42in fact one of my PHP layouts.
03:44I could prefix it with PHP, but in this case I use the suffix of PHP and I am
03:49going to pick the standard form although it really doesn't matter because PHP
03:52doesn't adopt anything like form or list view or table view from the layout
03:55that we're setting up.
03:57NowI'm going to carefully pick the fields that I want to have available to my PHP application.
04:04This of course will require some planning ahead of time, and this is something
04:08that you're going to want to do before you create the layout, so that you know
04:12exactly what you're going to need and what you're not going to need in your PHP application.
04:18Once I've chosen all the different fields that I want to have included, I
04:22can then move onto the next step, which is usually selecting the theme, but it doesn't matter;
04:27themes don't matter for PHP applications.
04:29Again, we're not adopting anything other than the data that's inside the fields.
04:33We're just compartmentalizing which fields we want to have access to.
04:35Anything, on the layout doesn't matter to PHP.
04:38So we'll just go ahead and pick Classic and be done with it.
04:41So you'll notice in Browse mode, it's a very plain layout, doesn't have all the
04:47fields that are available to us in the database, but that's fine.
04:51We actually don't want to have any layout objects or anything else like
04:55images or anything like that on this layout because it will have to be processed
04:59to some degree when it's being called upon from PHP.
05:02So we want to go with the very minimalist approach here.
05:04So now in addition to creating these PHP layouts, and by the way we created one
05:09just for customers here.
05:10But if we wanted to interact with the Invoices table or the Products table, we'd
05:14want to go and create isolated PHP layouts for those tables as well.
05:20So the example that we're going to do here, we are just going to create it for customers.
05:24So in addition to that, I need to have a Privilege Set under my Manage>Security
05:29that allows for PHP access. So it's a common practice to be able to set up a
05:35custom PHP Privilege Set and then I can go in and allow my application to
05:42create, edit and delete in all tables.
05:44But I would go in Custom Privileges and leave everything else off except for the
05:49PHP Layout that I just created.
05:52So we'll say records are modifiable, the layout is view-only.
05:55We can't modify a layout via the web browser so that's irrelevant.
05:58Then of course we want to make sure that this is accessible to the PHP
06:04application so we have to turn on the extended privilege for PHP.
06:09Now once we save this, we can hit OK;
06:12verify that we have access to the database.
06:14And now we can upload this database to FileMaker Server or FileMaker Server
06:18Advanced and make sure that FileMaker Server Advanced is set up to be able to
06:22host for a PHP application.
Collapse this transcript
Setting up to host files via PHP
00:00Getting ready to host files via PHP, or for XML for that matter, is a very straightforward process.
00:06An important distinction between Custom Web Publishing and Instant Web
00:09Publishing though, is that Custom Web Publishing requires FileMaker Server.
00:13It's not possible to use FileMaker Pro or Pro Advanced as a client to host the
00:17files for either PHP or XML access, as you can of course with Instant Web.
00:24To configure the FileMaker server for Custom Web Publishing access using the
00:28admin console is rather simple.
00:30So you will log into the admin console, you'll click over to the Web Publishing
00:34option under Configuration and you'll choose PHP. All you have to do is make
00:40sure that the box is labeled Enable PHP make sure that that's checked.
00:45Having XML on is not required but if you wanted to setup your server for XML
00:51hosting and the same thing applies here. Just click in and Enable the XML publishing.
00:55Then you'll need to upload a database that's been configured to be accessible via PHP.
01:01You'll select the Upload Assistant, choose the location and we're going to
01:07pick the exercise file in our next movie so that we can connect it to a PHP application.
01:16Upload this file, go through the normal steps that you are used to and what you
01:22want to confirm at the end of this process is that you see the PHP extended
01:27privilege turned on, on that database or series of databases that you hope to connect with via PHP.
01:33One important thing to note of course is that the server running the PHP
01:38engine must also have the web server running. You are going to want to see
01:43documentation for both PHP engine, the PHP engine as well as your web Server,
01:47whether it be Apache on Mac or IAS on Windows for details on how to turn those on.
01:53Now if you views the demo FileMaker Server Advance from TechNet or if you own a
01:57server installation on a single machine, all those components are already going
02:01to be on one machine, so you're going to want to make sure that you've got
02:05FileMaker server running. If you go into the Overview, you want to make sure
02:08that you have a nice green checkbox next to the Web Publishing Engine and you
02:12want to make sure that you have a nice green checkbox next to the Web Server and
02:16then also that you show PHP enabled.
02:18Once those are all setup, you're ready to create your PHP web application or
02:22even host the web application and have it interact with your database.
02:26So any FileMaker database can be set up for access via PHP by simply creating
02:30layouts that isolate the fields that you wish to use and then enabling the PHP
02:34extended privilege for that layout.
02:37Once enabled you can upload your PHP ready database to FileMaker Server or
02:43FileMaker Server Advanced and now it's ready to be connected to from your PHP application.
Collapse this transcript
Example of a FileMaker PHP application
00:00Custom Web Publishing technologies are programming technologies in the traditional sense.
00:05A programmer writes program code in one or more text files and then a web
00:09Application Engine interprets those files.
00:11As with certain programming languages, syntax errors can stop your program cold
00:15and there can be significant learning required to become proficient with PHP.
00:20Custom Web Publishing offers great power, but it does not offer the same easy
00:24use as the mouse driven development tool set of native FileMaker Pro.
00:27But as we've established earlier in this discussion, when you need Custom Web
00:31Publishing, you need something that doesn't have access to the client.
00:34So all the same for certain classes of problems, Custom Web Publishing is
00:38certainly the best choice for Web Publishing your FileMaker data.
00:43Although authoring PHP pages is outside the scope of this title, I have gone
00:48ahead and created a simple set of PHP pages that communicate with the
00:52Invoices_11_09 database.
00:54And I have included the database and the entire set of PHP Application Files in
01:00the exercise files for you to work with.
01:02However, they are there for you to pick apart and try to get some exposure to PHP.
01:07Please do not contact the author or lynda.com support if you're
01:10experiencing issues or want to make modifications. See the FileMaker Server or
01:15Web Server support documentation only, but I have provided this application to
01:20you for learning purposes.
01:22But what I do insist that you do, do is to consult the lynda.com online training library.
01:29If you go into the online training library and search for PHP, you'll find a
01:33plethora of courses that will help you to get familiar with PHP, from having
01:38no experience whatsoever, or even into more advanced programming knowledge regarding PHP.
01:44So again, we provided you with an entire PHP Web Application and its supported
01:49database inside the exercise files for this course.
01:52But we'll ask you to refer to other resources for support or learning more about PHP.
01:57Because quite frankly we can talk for weeks to you about PHP and all the
02:01different great things it can do.
02:03So first thing that you are going to have to know is that all the PHP files are
02:07going to need to be placed in a certain directory inside your web server.
02:11So you'll notice that we have entire folder with PHP files in it. This is the
02:17entire family of files, including error pages and CSS, and every thing that you
02:21are going to need to run this in a web browser.
02:24And it has to be placed in a specific location and it's a very easy place to find.
02:28I'm on a Mac, so I'm running Apache, so the way that you get to the Apache web
02:33root folder is to click on Library, then WebServer and then it's the Documents folder,
02:38that's where the web root folder is on Mac.
02:41On Windows the path is the www.root folder, and any folder that you place inside
02:47there will then be inside the web root.
02:50So all we have to do is take these files, drop them into the documents
02:54directory, and we we'll authenticate, and now anything that's in the web root,
03:01like any other root, can be accessible by just putting in the IP address of this
03:05machine, and then forward slash (/) with the directory name.
03:08So the directory name is php, and I've got a page in here called home.
03:13So let's open up Safari and type in the IP address of the web server, or if
03:20all the different components are running on the same machine, it's the IP
03:23address of that machine.
03:24So IP address/PHP/home.php.
03:35So all you have to do is do the IP address/the directory where all your PHP
03:41files live, and then forward slash any one of those PHP files.
03:45So in this case I have created a very generic homepage with all the different
03:49navigation you need, and when you hit Enter, you will be able to see your PHP application appear.
03:55So nothing fancy, what I've done is created a style sheet that is nearly devoid
04:00of any style, but it's called White.CSS and I'll show that in the second.
04:05But the homepage contains references to navigation, and some brief text that
04:09I put on here, but I wanted to show you some of the basic ideas behind what you can do with PHP.
04:16So here's an example of finding all the records in the database.
04:19So you'll notice that I've found 1535 Records, if I go back to the database and
04:26navigate over to Customers details, we see that we in fact do have 1535 records.
04:34I can delete one of those records if I'd like to, just to show you that we have
04:39got no tricks up our sleeve and we are going to go back.
04:44And you'll see now by simply refreshing, we have got 1534, now that refresh
04:48action is very important.
04:50Because right now, I'm looking at data from a FileMaker database, but I am in
04:55the browser, but I am not connected to the database.
04:58I do not have a database session.
05:00I'm not using a thread on the database. Unlike Instant Web Publishing where,
05:03in between when you are connected and you log off, you are using up one of those threads.
05:08With PHP the only time I actually interact with the database, is when I press one of these buttons.
05:14So for example, if I simply click on the button to show me the detail page
05:17for one of my Customers, I've communicated just for that split second with the FileMaker database.
05:24So when we talk about having a limitation of either 100 concurrent users
05:29supported by FileMaker Server for Custom Web Publishing, or in FileMaker Server
05:33Advanced we have upto 200 concurrent users.
05:36It's extremely important to take into account what we are talking about, when we
05:40talk about users and their session.
05:42So right now I just hit the Edit button and in less time than it took to
05:47refresh this page, I was communicating with the database server, and therefore I had a session.
05:52If several other web users and I, all hit that button at the same time, 200 of
05:57us will be able to get a request back in that split second.
06:00And any one beyond that will just be queued up and then a second later will get their request.
06:05So we're not going to get errors, people aren't going to be kicked out.
06:08It's really, really important that you don't frame up the limitations for PHP in
06:13the same way that they are for IWP. Throw out all that understanding. There are
06:17no database sessions. As long as you have an application that it only receives
06:22requests of up to 100 concurrent at a time or 200 at a time, you're well within
06:26the bounds of FileMaker.
06:27So what this actually translates into, depending on what you have going on with your application,
06:32like right now I have been sitting here talking to you, and I haven't actually
06:34interacted with the database more than a few times.
06:37So while I've done that there could be hundreds, possibly even thousands of
06:40other users out there doing the same thing.
06:43So you can simply do the math determining what kind of actions you're
06:46expecting. If people are just adding records to the database, well then, think
06:49about how many records you expect to be added in the 24 hour period.
06:53Do some math depending on how many hours that would be, and then within those
06:57hours get it all the way down to a second, and that can tell you how many records
07:01being added you can support within a 24-hour period or even an hour period.
07:05So that's the math that I used to determine the transaction.
07:08Now don't get me wrong you can create new amazon.com or google.com
07:11with FileMaker as a back end, it just doesn't make sense.
07:14You are not going to have the multiple thousand transaction abilities that you have in those cases.
07:19But for several hundred or thousands of users over a 24-hour period, it's very
07:25likely that you can pull this off.
07:26I've created applications over the last 10 or 15 years that have supported that kind of a load.
07:31And FileMaker Server 12 has just recently been reengineered and the web
07:35Publishing Engine completely tore down from scratch, which of course serves Custom Web Publishing.
07:41In order to be able to accommodate even more users or twice as many
07:44transactions as it's been able to do in the past.
07:46So trust me when I tell you these are not the limitations that Instant web
07:50Publishing has, as a matter of fact, they are not even in the same conversation.
07:54So let's get back to showing you some demonstrations.
07:56I want to add a record, a Customer record,
08:05I am just going to put a couple of pieces of data in here. And now I'm going to hit Save.
08:09Again, just communicated, done communicating; even in less time than it takes me to actually say it.
08:14But now if I go back to the database I want to show, you the Company's name is
08:20Sample, and now I see Sample, and I see that that record has now been added and
08:26I am back up to 1535 records in my database.
08:29And also, I can go in here in Edit and call it Super Sample, go back, save my change,
08:38and we can go back into the database and without even refreshing we see that's updated.
08:43So the idea here is you can have live interaction with your FileMaker database,
08:47and enforce any rules that you might have inside your PHP application.
08:50This is about as low end of a PHP application as you can get, but it can do
08:55things like Find, and I do a search, I see I have three records, I can click on
09:02one of them, and again like I said, I can do my editing, or I can look at all my
09:07records at once, find all them. Then I added something interesting here, it's
09:11called the Customer Summary Report.
09:13I want to show you that there is no layout in the FileMaker database.
09:19There's Invoices summaries, printing, Customer PHP, that's it.
09:24No Customer Summary, there is not even Customer Summary fields created inside the Schema.
09:30As a matter of fact, we have no summary fields created in the Customer Table.
09:34But what I was able to do in PHP is create essentially a SubSummary Report
09:40that groups all 1500 contacts, and you saw it had a brief delay, but it didn't take long to do that.
09:46Groups them all by state then gives me a count of each state.
09:49I did all this programming inside of PHP. So that I don't have to bother the
09:54database with this processing, instead I can have this happen on the browser
09:57side, and let the client manage this.
09:59So just an example of what can be done with PHP.
10:03So what's going on in the backend of these files, here I am showing you the
10:09same files that we've been working with inside of a Text Editor just to give you
10:12a glimpse of what PHP code looks like.
10:16There are a couple different types of files.
10:18First I have got a CSS file, if you're familiar with any kind of cascading
10:22stylesheets, you can see I've set it up in the same way. I've got header
10:27declarations in here, container stuff, page navs.
10:30I have got every possible CSS that FileMaker could use within its API, but
10:35really I didn't actually populate them with anything more than just black and white color.
10:40But if you're familiar with CSS, this format should look very familiar to you as well.
10:45I've got things like Add Record Pages. And you'll see I am doing things like
10:50calling other pages like FM View and Error PHP.
10:54The FM View is a page that's very critical for you to be able to control, or any
10:59FileMaker application that you create in PHP requires an FM View file.
11:03This is where all sorts of things live, like, the Usernames and Passwords for logging in,
11:08how your session management happens and all these different functions that
11:12are happening are all written inside this FM View, and then you'll notice that
11:18other pages throughout the application, all call the FM View.
11:22So instead of having to write all of that code in each one of these individual
11:26files, I just call it. I will write it inside FM view and I refer to it here.
11:30The same is true for the error pages.
11:34You see that I write an error page and then I'm calling it from various
11:38different records in the database.
11:40The report is the one that does that SubSummary Report without going into it.
11:46You'll see some things that are kind of familiar though. See things like
11:49variables declared and if statements, in the same kind of formats as you might
11:54be used to, a lot of use of variables. And then you see common HTML.
11:59This is so that we can render all the data that's being produced by all
12:04these functions into something that can actually be interacted with inside of a web browser.
12:10So I implore to you take a look at all these different files and try to get
12:13familiar with PHP, and again, consult the lynda.com online training library for
12:18more information on what all of this means when you're inside the code.
12:21Now at the very least you can take the files that I provided to you and point
12:26them to your database instead, and maybe work a little bit with the CSS and
12:29possibly end up with an application after some slight modifications that will
12:33allow you to use it with your own database. Not the least of which is changing
12:37the database name inside these files to your database name, and the layout name
12:42to your layout name and then the rest is customizing the application.
12:46PHP and FileMaker combine to offer great power, but it does not offer mouse
12:50driven development tool set of native FileMaker Pro, but it doesn't have to.
12:54So you should set that expectation before you jump into PHP, you can completely
12:58customize the user's experience and do all sorts of things that you don't even
13:02have to do inside of FileMaker, just by using the FileMaker PHP API, along with
13:07the database and FileMaker PHP applications.
13:10All the same, for many classes of users and requirements, PHP is certainly the
13:14best choice for web publishing.
Collapse this transcript
Conclusion
Goodbye
00:00Well I hope you enjoyed FileMaker Pro 12 in Depth.
00:03If you aren't sure about anything I have covered in this course, feel free to
00:07come back and check out these chapters for a refresher.
00:10This is by no means a comprehensive list of features of the FileMaker product,
00:14but it just serves as a great way for you to enhance your FileMaker development skills.
00:18Although lynda.com has all the best online training available, if you're looking
00:22for some additional resources online, you can check out the
00:25filemaker.com/technet and for free you can join the FileMaker Technical Network.
00:32This will give you access to dozens and dozens of technical briefs on white
00:35papers, some of which I've referenced inside this course.
00:39And also you can find me at isolutionstraining.com where I have all sorts of
00:44free videos and papers that I've linked to on this page and I'd also like to
00:48hear from you if you have any questions about training.
00:50But most important, good luck on those databases and we'll see you next time.
Collapse this transcript


Suggested courses to watch next:

Up and Running with FileMaker Go (1h 15m)
Cris Ippolite


FileMaker Pro 12 Essential Training (10h 28m)
Cris Ippolite

HTML Essential Training (5h 34m)
Bill Weinman


Are you sure you want to delete this bookmark?

cancel

Bookmark this Tutorial

Name

Description

{0} characters left

Tags

Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading
cancel

bookmark this course

{0} characters left Separate tags with a space. Use quotes around multi-word tags. Suggested Tags:
loading

Error:

go to playlists »

Create new playlist

name:
description:
save cancel

You must be a lynda.com member to watch this video.

Every course in the lynda.com library contains free videos that let you assess the quality of our tutorials before you subscribe—just click on the blue links to watch them. Become a member to access all 104,141 instructional videos.

get started learn more

If you are already an active lynda.com member, please log in to access the lynda.com library.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Get access to all lynda.com videos

You are currently signed into your admin account, which doesn't let you view lynda.com videos. For full access to the lynda.com library, log in through iplogin.lynda.com, or sign in through your organization's portal. You may also request a user account by calling 1 1 (888) 335-9632 or emailing us at cs@lynda.com.

Access to lynda.com videos

Your organization has a limited access membership to the lynda.com library that allows access to only a specific, limited selection of courses.

You don't have access to this video.

You're logged in as an account administrator, but your membership is not active.

Contact a Training Solutions Advisor at 1 (888) 335-9632.

How to access this video.

If this course is one of your five classes, then your class currently isn't in session.

If you want to watch this video and it is not part of your class, upgrade your membership for unlimited access to the full library of 2,025 courses anytime, anywhere.

learn more upgrade

You can always watch the free content included in every course.

Questions? Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com.

You don't have access to this video.

You're logged in as an account administrator, but your membership is no longer active. You can still access reports and account information.

To reactivate your account, contact a Training Solutions Advisor at 1 1 (888) 335-9632.

Need help accessing this video?

You can't access this video from your master administrator account.

Call Customer Service at 1 1 (888) 335-9632 or email cs@lynda.com for help accessing this video.