IntroductionWelcome| 00:00 | (music playing)
| | 00:04 | Hi! I'm Cris Ippolite and welcome
to FileMaker Pro 12 In Depth.
| | 00:08 | In previous FileMaker titles, we've
talked about the fundamentals of building
| | 00:11 | FileMaker databases.
| | 00:13 | But now, I'm going to put-on my developer
hat, and show how to control access to
| | 00:17 | your databases, and how to
share them with other users.
| | 00:20 | We'll dig deeper into calculation functions
and the various ways that you can
| | 00:24 | use them throughout the FileMaker application.
| | 00:26 | I'll show you how to build compelling
and advanced reports, and we'll take a
| | 00:30 | closer look at scripts and some
of the key scripting techniques.
| | 00:35 | I'm also excited to introduce you to
some of the options for sharing your
| | 00:38 | databases with other users either
on the network, or by publishing your
| | 00:41 | databases to the web.
| | 00:43 | And 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:00 | FileMaker 12 in depth builds off of
fundamental skills that we've covered in
| | 00:04 | FileMaker 12 Essential Training.
| | 00:07 | If you're not comfortable with concepts
like building calculations, scripts, or
| | 00:10 | even relationships, please take a moment
to go back, and watch the FileMaker 12
| | 00:14 | Essential Training, or, even the Relational
Design with FileMaker Pro titles.
| | 00:20 | In this course, I cover several core tools
and techniques that will help make
| | 00:24 | your FileMaker databases more robust.
| | 00:27 | I'll also cover sharing your databases
on the network or web, so if you find
| | 00:31 | that some of the early techniques are
too familiar, stick with it to the second
| | 00:34 | half where I discuss sharing options in depth.
| | 00:37 | I also have several movies based on techniques
that I've never shown anywhere before.
| | 00:41 | So please take the time to check out
each chapter even if some of the concepts
| | 00:45 | are familiar to you.
| | Collapse this transcript |
| Using the exercise files| 00:00 | If you are a premium member of the
lynda.com online training library,
| | 00:04 | you will have access to the exercise
fles used throughout this title.
| | 00:07 | The way that the exercise files are
laid out is that they all come in one
| | 00:11 | exercise files folder, broken
down into each one of the chapters.
| | 00:15 | And if you look inside each chapter,
you'll see that there's a folder for each movie.
| | 00:21 | So for example, if you want to watch
the movie for 01_04, just go into the
| | 00:26 | 01 folder, and down to the 01_04
subfolder, and open this file.
| | 00:31 | Each of the movies has its own dedicated
FileMaker file, so you can start from
| | 00:35 | any point in this title by just finding
the correct folder, and opening the
| | 00:38 | correct Exercise File.
| | Collapse this transcript |
|
|
1. Managing Access to Your DatabaseCreating accounts| 00:00 | Security is primary concern for both
developers and end users of databases.
| | 00:05 | It governs whether a person can open
a given database and determines what
| | 00:09 | functions and data are accessible
to the user once they do open it.
| | 00:12 | The topic of security is often overlooked
though when you're developing in
| | 00:15 | FileMaker because it's not just something
that's there to limit access to
| | 00:19 | the entire database;
| | 00:20 | in fact, there are some very sophisticated
ways to set up security within your
| | 00:24 | database system that will allow you to
limit access to certain functionality or
| | 00:28 | maybe just to the whole file itself.
| | 00:30 | However, you should be looking at
setting up security as not only determining
| | 00:34 | who can log in, but what
they can do once they log in.
| | 00:38 | So it's also a way to identify users
for other tasks that are not related to
| | 00:41 | restricting access, like taking them to
certain layouts or showing them certain
| | 00:44 | font sets and stuff like that.
| | 00:46 | So think of security as
identifying who your users are.
| | 00:50 | Administrators of FileMaker Pro databases
will work primarily with two security
| | 00:54 | elements and both can be managed under
the File>Manage>Security dialog and those
| | 01:01 | two elements are Accounts and Privilege Sets.
| | 01:03 | We're going to talk about Accounts in this
movie and Privilege Sets later in this chapter.
| | 01:07 | In the Manage Security dialog, you
see you have a tab here for Accounts and
| | 01:12 | you'll see your accounts in list view
and it lists all the accounts that are
| | 01:15 | already set up in your system.
| | 01:16 | FileMaker recommends that the best
practice is to establish a unique account for
| | 01:20 | every individual user of the database.
| | 01:23 | This practice is more secure than having
multiple users just share one account
| | 01:27 | and it also enforces the concept of
identifying your users so that you can
| | 01:31 | customize their user experience.
| | 01:33 | User accounts will then be associated
with one and only one of the Privilege Sets.
| | 01:38 | We're going to talk about Privilege Sets
here in an upcoming movie, but you'll
| | 01:41 | notice here that we've got a list of
Accounts and there is a column here for
| | 01:45 | Privilege Sets, so one account can
only be assigned to one privilege set.
| | 01:48 | By default, any new FileMaker file or a
starter solution or a freshly converted
| | 01:53 | FileMaker file is set up in
what's called a permissive state.
| | 01:57 | This means that it's got an Account
set up already and this account has
| | 02:01 | the Account Name of Admin and the Password
of blank and it's set up with Full Access.
| | 02:06 | So this account will allow users to
log in to the file and do anything they
| | 02:10 | want inside the file.
| | 02:11 | This permissive state that I'm talking
about is enforced by the fact that under
| | 02:16 | the File menu, you'll notice
there is an option for File Options.
| | 02:20 | You'll see here that there are two
selections that you have in the first screen
| | 02:23 | for the Open tab, that's Log in using and then
the Admin account is actually set up that way.
| | 02:30 | So that's why when you open up this
file, you'll see when I close the file, and
| | 02:34 | can go back into the file, you'll see
that I'm not prompted for a password.
| | 02:38 | That's because each file is set up to
automatically log in with the Admin account.
| | 02:44 | Nowwe can override that, as you'll
see when I open up the File>Recent.
| | 02:50 | On Windows, I can hold down the Shift
key at this point or on Mac, I can hold
| | 02:53 | the Option key down and this will
prompt the Open dialog to appear, which allows
| | 02:59 | me to enter in a new Account Name and
Password and at this point, I could just
| | 03:03 | enter in the Admin account.
| | 03:04 | So it's really a good practice to go
under the File menu to File Options and
| | 03:10 | disable this account.
| | 03:12 | In the exercise files, throughout the rest
of this title, I'm going to leave this on.
| | 03:16 | But in your actual real-world
production databases, I advise you to turn
| | 03:19 | this off and give all your users a password
so that they are prompted when they login.
| | 03:24 | Now back under the Manage>Security
dialog, you'll also notice in the Account
| | 03:29 | list by default there is a Guest Account set up.
| | 03:32 | It's set up to be inactive, but if you
turn it on and make it active and then
| | 03:37 | log out of the database, you'll notice
that we're getting prompted anytime
| | 03:40 | we make a change in Manage Security to
enter in the Full Access account. This
| | 03:44 | is just FileMaker's way of making sure that
you don't lock yourself out of the database.
| | 03:48 | Now notice when we go to log into
this database, I'm going to hold down the
| | 03:52 | Option key again here, again, it could
be Shift on Windows, you'll notice now
| | 03:56 | that there's a Guest option that's
available and when users select this, they
| | 04:00 | can get into the database, but you see
by some of the grayed out options that
| | 04:04 | they have limited access to the
database that they're opening up.
| | 04:08 | Log in back into the database now
and log in using the Admin and blank.
| | 04:16 | So back under Manage>Security, under
the Accounts tab, you'll notice that if
| | 04:21 | you create a new account by
hitting the New button, or if you were to
| | 04:24 | double-click on one of the existing
ones that will open up the same dialog,
| | 04:28 | you'll see that you really only have a
few different options to select here.
| | 04:31 | You've got how you're going to
authenticate, whether it's FileMaker's internal
| | 04:35 | authentication, which is what the
default is, or External Server which we'll
| | 04:40 | cover in the next movie.
| | 04:41 | You can leave that at its default
FileMaker authentication and then you're
| | 04:45 | prompted to enter an
Account Name and a Password.
| | 04:47 | You should know that it's best
practice to provide both an Account Name and a
| | 04:51 | Password, even though you can leave the
Password blank and that you should know
| | 04:55 | that the Password is case-sensitive
although the Account Name is not.
| | 04:58 | So if you just sort of commit
yourself to knowing that both they are
| | 05:01 | case-sensitive, that'll be a discipline
that will allow you to not get yourself
| | 05:05 | into trouble there, but it's important
to provide an account and a password for
| | 05:08 | every individual user of your system,
at which point you can then turn this
| | 05:12 | account on, meaning it's active or make
it inactive if you plan on not using it
| | 05:16 | till later. and then you just
simply select one of the Privilege Sets.
| | 05:19 | So you're going to have to select your
Privilege Sets before you set up your accounts;
| | 05:23 | we're going to talk about
Privilege Sets later in the course.
| | 05:26 | Now FileMaker Pro will require that at
least one account that's set up in the
| | 05:29 | system is associated with a
Full Access Privilege Set.
| | 05:32 | Now you can remove the Full Access
Privilege Set as long as you have configured
| | 05:37 | another Privilege Set that does have
Full Access, but there must be at least one
| | 05:40 | account set up in the system to allow this.
| | 05:42 | This is of course so that you can get
in and do stuff inside the database or
| | 05:47 | change other accounts if you don't have
a Full Access account, for example here,
| | 05:50 | if I go in and I edit and I make this
Data Entry and hit OK and hit OK again,
| | 05:55 | FileMaker is prompting me with a
message that basically says I need to have one
| | 05:58 | of these accounts allow
Full Access into the system.
| | 06:02 | But before we set up our accounts, we
must first have Privilege Sets configured
| | 06:07 | and the accounts themselves will
allow you to identify who your users are.
| | 06:10 | So each user gets a unique
combination of a username and a password.
| | 06:13 | And once you know who is going to be
accessing your database, you can not only
| | 06:17 | restrict them from certain data and
functionality, but you can also make their
| | 06:21 | user experience more customized by
showing them only data and functions that
| | 06:24 | might be specific to them.
| | Collapse this transcript |
| Using external authentication| 00:00 | FileMaker Pro databases can be
authenticated in one of two ways;
| | 00:04 | by FileMaker Pro itself where an account
name and password credential are stored
| | 00:08 | within the file in an encrypted form,
or in another way which is called by
| | 00:12 | External Authentication.
| | 00:13 | External Authentication is another means
by which user's credentials can be verified.
| | 00:18 | It's still managed under File>Manage>Security.
| | 00:22 | And although when you set up a new
account, you'll notice that 'Account is
| | 00:26 | authenticated via' is an option
inside the Edit Account window.
| | 00:30 | FileMaker is the default, but
External Server is another option.
| | 00:34 | So let me talk for a second first about
what External Authentication really is.
| | 00:39 | When you choose External Authentication,
that means that the log in into the
| | 00:42 | file or the username and the password
access to the file is going to be managed
| | 00:46 | by another system completely.
| | 00:48 | And although there's very little to do
inside your FileMaker database, really
| | 00:51 | all the heavy lifting happens
over in these other systems.
| | 00:54 | So what you will you do before
you even get to this point in your
| | 00:58 | FileMaker database is coordinate with
whomever is in your IT department or
| | 01:01 | maybe it's yourself.
| | 01:02 | You will have to go into either active
directory, or open directory and set up
| | 01:05 | a series of groups.
| | 01:07 | And then once those groups are set up
in your external authentication system,
| | 01:10 | you can set up each group inside
of FileMaker as if it's an account.
| | 01:14 | But really what you'll end up doing is
just bridging the group in the external
| | 01:18 | authentication system with a
privilege set inside your FileMaker database.
| | 01:23 | So External Authentication
requires a lot of coordination between the
| | 01:26 | FileMaker Pro developer, you;
| | 01:28 | and the network administrators.
| | 01:30 | So in that case, the naming of the
groups in your authentication server
| | 01:33 | environment, and in FileMaker Pro
must really be managed in parallel.
| | 01:37 | So by the time you get to this screen
in the Edit Account dialog, you will have
| | 01:41 | already had a group name or a
series of group names set up in your
| | 01:44 | authentication system.
| | 01:45 | So what you're going to do then is
open up a new account and choose External
| | 01:50 | Server, and then type-in the Group Name
with the exact syntax as was provided by
| | 01:55 | your network administrator; for example,
GroupName, if that's the exact syntax
| | 02:01 | and spacing and everything that was given to me.
| | 02:03 | You can either choose to turn them on
or inactivate them, so that they can be
| | 02:06 | turned on or activated later, and
then you'll pick the Privilege Set.
| | 02:10 | And that's really all you have to do
to set these up inside of FileMaker.
| | 02:14 | However, External Authentication
requires FileMaker server.
| | 02:17 | Because of this, a single-user file
cannot be externally authenticated.
| | 02:20 | So you need to be able to host a
file on server in order for this to work.
| | 02:25 | For FileMaker server to interact with
an authentication server, it needs to be
| | 02:28 | properly configured.
| | 02:29 | And we'll talk about the couple of
different steps that are required to
| | 02:32 | configure it later on in this
course in the server chapter.
| | 02:35 | So the way this works is that when
a member of one of these external
| | 02:38 | authentication groups logs into
their database or let's say they log into
| | 02:42 | Windows and they enter a username
and password, then when they open up a
| | 02:45 | FileMaker Pro database, his or her
account name that they use to log into
| | 02:49 | Windows, for example, will be
passed to the authentication server.
| | 02:53 | And then once that server determines
that the proper credentials have been
| | 02:56 | provided, it returns to FileMaker server a
list of all the groups to which that user belongs.
| | 03:02 | This list is then compared to the
group names that were set up inside your
| | 03:05 | FileMaker Pro database file, and the
first valid match in the account list
| | 03:12 | determines the privilege set
that's available to the user.
| | 03:15 | So here, you'll see the type of external
server if you have many different ones in here.
| | 03:19 | You'll have a group name, and the
first group name it encounters, that has
| | 03:23 | the correct syntax.
| | 03:24 | So in this case, if there's a group
name called GroupName, it will provide any
| | 03:28 | user who logs into that group using
external authentication with the privileges
| | 03:32 | allowed by the Privilege Set called
Full Access in the FileMaker file.
| | 03:36 | Nowkeep in mind that authentication is
determined on an account by account basis.
| | 03:41 | A single FileMaker file could
contain accounts that are authenticated by
| | 03:44 | FileMaker Pro, mixed in with accounts
that are authenticated by an external server.
| | 03:49 | And you could have one user with a
FileMaker authenticated account and an
| | 03:53 | externally authenticated account
depending on whether or not they're accessing
| | 03:56 | from within their network or not.
| | 03:58 | The biggest benefit of using External
Authentication is that your users can
| | 04:02 | log into their system one time, and then
not be bothered by FileMaker to log in again.
| | 04:06 | This way, they don't have to remember a
separate set of usernames and passwords
| | 04:09 | just to be able to access your FileMaker database.
| | Collapse this transcript |
| Understanding the default privilege sets| 00:00 | The bulk of the work that you'll do
inside your FileMaker database to set up and
| | 00:03 | enforce security is actually going to
be done before you even get to FileMaker.
| | 00:08 | It's going to be done in your planning stage.
| | 00:10 | This is where you're going to identify
all of your users and each one of those
| | 00:14 | users gets their own account that
we've talked about in previous movies.
| | 00:17 | But then also those users who need to
be part of user groups or they need to
| | 00:21 | have similar functionality and once
you've defined what those different
| | 00:24 | groups are, those get set up in your
FileMaker database in something that's
| | 00:27 | called a Privilege Set.
| | 00:28 | And you can find Privilege Sets
and manage Privilege Sets under the
| | 00:31 | File>Manage>Security dialog on the
tab right next to the Accounts one.
| | 00:37 | Accounts will allow users to log into
your database, but these Privilege Sets in
| | 00:41 | FileMaker Pro determine what aspects
of the database like database features,
| | 00:45 | operations and data that a given
user class may view, create or edit.
| | 00:50 | This is where developers will have a
wider range of tools with which to work.
| | 00:55 | The separation between Accounts and
Privilege Sets allows developers to
| | 00:58 | define Privilege Sets without being
concerned with the individual user
| | 01:01 | passwords themselves.
| | 01:03 | It's a good practice to look at all of
the different users of your database and
| | 01:06 | then put them into groups of users.
| | 01:08 | When I say groups, I'm not talking
about groups like Sales and Accounting and
| | 01:12 | Production and that type of thing.
| | 01:13 | But rather, one group may only be
able to access customer and phone
| | 01:16 | cannot delete records.
| | 01:17 | Well, let's say another group can
access only product data and so on.
| | 01:21 | So once you've defined what these groups are,
you're going to go in and set up Privilege Set.
| | 01:25 | Now you may have determined that you
have certain user groups and they fall
| | 01:28 | into pretty general classes.
| | 01:30 | And in that case, possibly the three
default Privilege Sets that are already set
| | 01:34 | up in your database, which are the
Full Access, Data Entry and Read-Only
| | 01:37 | Privilege Sets may suffice.
| | 01:39 | So by default, any new database or
converted database or even starter solutions
| | 01:43 | that you might use will have the Full
Access, Data Entry and Read-Only Access
| | 01:47 | Privilege Sets already assigned.
| | 01:49 | And you'll notice that the Admin Account,
that's the default account, and even the
| | 01:53 | Guest Account are already assigned
to two of those three Privilege Sets.
| | 01:57 | These default Privilege Sets cannot be deleted.
| | 02:00 | Anytime you see brackets around something in
FileMaker that means they can't be deleted.
| | 02:03 | You'll notice that when I select it,
the Delete option or the Duplicate option
| | 02:07 | are not available to me.
| | 02:09 | But developers can create their own
custom Privilege Sets when necessary.
| | 02:12 | Nowyou'll notice a Full Access
Privilege Set if I select it and hit Edit,
| | 02:17 | everything is grayed out, but
essentially it allows you to access all the
| | 02:21 | Records in the database, Create, Edit
and Delete them, all the Layouts, all the
| | 02:25 | Values Lists and all the Scripts.
| | 02:27 | You'll notice that your
access sort of cascades down a bit.
| | 02:30 | For instance, Data Entry allows you to
create, edit and delete in all tables,
| | 02:35 | but then only view the Layouts and view
the Value List and view the Scripts.
| | 02:39 | Then finally, down at Read-Only Access
when you hit Edit, you've got the ability
| | 02:44 | to view only all the records, and then
view only all the other elements like the
| | 02:48 | Layouts, Values and Scripts.
| | 02:50 | So again, you may have evaluated all
the different users that are going to
| | 02:54 | access your database and they may
fit into one of these three categories.
| | 02:57 | But if you do need additional access or more
customized access for these user groups,
| | 03:01 | then you can move on to creating
customized Privilege Sets.
| | Collapse this transcript |
| Customizing privilege sets| 00:01 | FileMaker Pro provides three default
Privilege Sets, under the Manage Security
| | 00:06 | window, and sometimes those three
default Privilege Sets do not address all of
| | 00:10 | the security requirements a
given database solution may call for.
| | 00:14 | So you may need to create your own
customized Privilege Sets and take
| | 00:18 | advantage of some of the real granular
level of security that's available on
| | 00:22 | these Privilege Sets.
| | 00:23 | So the way that you create a
customized Privilege Set is by going into the
| | 00:27 | Privilege Set tab and hitting the New button.
| | 00:29 | So here we're going to creating new
one just to that I can give you a tour of
| | 00:33 | all the different options
that are available to you.
| | 00:35 | Once you know all the different
options that are available when configuring a
| | 00:39 | Privilege Set, this might help you
further define what those actual user access
| | 00:43 | groups are going to be when you're in
the planning stage of your database.
| | 00:47 | So first you want to give your
Privilege Set a name, this of course will allow
| | 00:50 | you to differentiate the different
Privilege Sets in your list, and a little
| | 00:54 | Description can help maybe other users
or administrators of the system know what
| | 00:57 | this Privilege Set is intended for.
| | 00:59 | Here's where you can really
define who the user group is.
| | 01:02 | So customizing any Privilege Set
really boils down to these aspects here,
| | 01:06 | Records, Layouts, Value List and Scripts.
| | 01:09 | You'll notice that in each one of
these you've got a series of dropdown
| | 01:13 | options, and they kind of match the
Full Access, Data Entry and Read-Only
| | 01:18 | options that you saw in
the default Privilege Set.
| | 01:20 | So you see here, this is really the
Full Access, this is the Data Entry and
| | 01:25 | this is the Read-Only.
| | 01:27 | And the same is true for
Layouts, Value Lists and Scripts.
| | 01:32 | So you could just emulate the default
ones by just picking all the top options
| | 01:37 | for a full access, and all the middle
options for a data entry, and so on.
| | 01:42 | But what I really like to show you is
the options that you have available in
| | 01:46 | each one of these Data Access and
Design categories that allow you to really
| | 01:50 | customize the accesses.
| | 01:51 | So for example, under Records if you
choose Custom Privileges, you'll notice
| | 01:55 | that you invoke another window that's
called the Customer Record Privileges and
| | 01:59 | what this allows you to do is go
table by table within your database and
| | 02:03 | determine what rights to either the
records in that table or the fields in that
| | 02:07 | table your users are going to have.
| | 02:09 | So here for example, I could say, I
determine that there's a user group that
| | 02:13 | only deals with Customers; let's say I
have a customer service group, and any
| | 02:16 | member of this Privilege Set
can only interact with Customers.
| | 02:20 | So in that case, I would leave all
of the different tables as they are.
| | 02:25 | You'll notice in any new Privilege Set
in FileMaker that everything is turned
| | 02:28 | off, it's in what's called a pessimistic
state. This way you don't inadvertently
| | 02:32 | setup a Privilege Set that allows full
access to a system, instead you have to
| | 02:36 | go from no access at all and build up the access.
| | 02:38 | So when you're looking at this window
here, what this tells us is that no tables
| | 02:42 | have any View, Edit, Create,
Delete or Field Access whatsoever.
| | 02:46 | So what I can do is pick the different
tables I want, in this case let's just
| | 02:49 | say I pick Customer, and I can say
all right, can they View records in this
| | 02:54 | table, I can say either yes or no.
| | 02:56 | Can they Edit records in this table, either yes or no.
| | 02:59 | Can they Create records in his table, we'll
leave that at no, and let's say Delete no as well.
| | 03:04 | Now the Field Access allows us to choose
either all of the different fields that
| | 03:08 | are defined in that table are then
available to users in this Privilege Set or
| | 03:11 | not, or I can pick this limited option,
which brings up a list of all the fields
| | 03:17 | in the table, and I can select them
individually, and allow them to be either
| | 03:21 | modifiable or view only, if I'd like,
or I can hold down the Shift key and pick
| | 03:25 | groups of them and change them all to
view only or modifiable if I'd like to.
| | 03:31 | Modifiable of course means the user
can click into the field; and view only
| | 03:35 | means they can just see the contents of
the field; no access, means they cannot
| | 03:38 | click in, nor see the contents of the field.
| | 03:41 | So basically you can go through
different combinations of tables and records
| | 03:45 | within tables or even fields
within those tables and create a real
| | 03:48 | customized group of access.
| | 03:51 | So with this level alone allows you to
control, View, Edit, Create, Delete and
| | 03:55 | Field Access on all of the
tables or different groups of tables.
| | 03:59 | So this right here shows you how
really granular these different levels of
| | 04:02 | access can be within your Privilege Set user groups.
| | 04:06 | Layouts have a little less depth. Here
when going to Custom Privileges, you
| | 04:11 | see all the different Layouts that
are defined. You can see over on the
| | 04:14 | right-hand side you see these are
Layouts already in your file and which table
| | 04:18 | they're associated with, so some of
this you're already managing when you
| | 04:21 | setup access the tables.
| | 04:22 | But for example, you can say the
Company Info field for this group is not
| | 04:27 | accessible, but anything dealing with
Customers, I'll hold on my Shift key
| | 04:31 | to select them both.
| | 04:33 | I can say they're view only, and if I
say modifiable, that actually means I'm
| | 04:37 | allowing the user to go into Layout
mode to make changes to the Layout.
| | 04:41 | So likely in most cases unless it's a
developer group, you're going to allow
| | 04:44 | them to view Layout, and then any
records within that Layout can either be
| | 04:48 | viewed, modified or no access whatsoever.
| | 04:52 | So I'll say they can view any amount
of the Customer Layouts, basically a
| | 04:56 | layout based on Customer table, and then they
can actually modify data within the records.
| | 05:02 | Value Lists; if you don't choose one of the three
default options, you can go into Custom
| | 05:06 | Privileges and you can say, this
Value List is not accessible, this one is
| | 05:10 | and so on and so forth.
| | 05:11 | And the reason you might do this
because sometimes your Value List might be
| | 05:15 | based on the contents of a field and you
don't you want users to see the
| | 05:19 | contents of the field or the index of
that field, so you might turn it off.
| | 05:22 | If you have a Value List assigned to a
field and you select no access, the user
| | 05:27 | will not see dropdown lists or pop-up menus.
| | 05:30 | But in the case of a checkbox or
radio buttons, they're going to see no access,
| | 05:34 | next to each one of the values that
were previously there inside your Value List.
| | 05:38 | So you can go through all of
them, of course, this is set for
| | 05:41 | pessimistic settings again.
| | 05:43 | And Scripts are very similar to Value
Lists, in that you can pick individual
| | 05:48 | Scripts, you can go into each Script
and pick it and say, whether or not it can
| | 05:53 | be executed, which means it can be
triggered and run, or there is no access
| | 05:56 | whatsoever, or even modifiable,
meaning that they can actually go into the
| | 05:59 | Manage Scripts window and modify the
script if you allow them access to.
| | 06:03 | As a matter of fact, you should be
aware that that under the Manage Scripts,
| | 06:08 | if you choose one of the Scripts in
your database, almost close to the bottom
| | 06:12 | left-hand corner, you'll see an option for
run the script with full access privileges.
| | 06:16 | This will supersede any Settings that
you've set up in the users Privilege Set
| | 06:21 | and allow them to run it, as if
they had full access Privileges.
| | 06:24 | Of course they'll sent back to their
Privilege Set defined level of access to
| | 06:29 | the database, once the script is over.
| | 06:31 | But this will allow you do things like
maybe set the values in a field in a table
| | 06:35 | that maybe they don't have access to
during their normal user session.
| | 06:40 | So back in the Manage Security,
| | 06:44 | the only other options that you might
want to configure are over here on Other
| | 06:48 | Privileges. They're pretty self-explanatory,
for the most part, you'll notice
| | 06:51 | you've got either the ability to Allow
printing or Allow exporting. Keep in mind
| | 06:55 | that choosing Allow printing, means not
only to print hard copies to printers,
| | 07:00 | but also to save records as PDF.
Allow exporting not only controls your
| | 07:06 | exporting options available under the
File menu, but in addition also allows you
| | 07:10 | to control whether or not users can save as Excel.
| | 07:13 | So you can't separate exporting features
from Save As Excel, those two are fused
| | 07:17 | together by either turning them on
or off, by checking the box here.
| | 07:21 | You can also allow them to Manage
their own extended privileges, which
| | 07:24 | we're going to talk about in the next
movie, or Allow the user to override
| | 07:28 | data validation warnings.
| | 07:29 | So if you setup fields with data
validation, you can allow entire Privilege
| | 07:33 | Set or all the users assigned to
your Privilege Set to override those
| | 07:37 | validation warnings.
| | 07:38 | This might be one that you might just
want to reserve to you, the developer, or a
| | 07:42 | Privilege Set that you setup with Full Access.
| | 07:44 | You'll also notice your Disconnect user
from FileMaker server when idle. That is
| | 07:48 | something that is also controlled on the
server side, so if you setup a time out
| | 07:52 | of 15 minutes, any user that has this
checkbox checked, will then be kicked off
| | 07:58 | the server or their user session
terminated after that 15 minutes, let's say,
| | 08:03 | time has been achieved.
| | 08:04 | Now you as a developer, you might want
to allow user to override data validation
| | 08:09 | warnings and maybe uncheck the disconnect,
so that you can leave your system
| | 08:12 | idle and not get kicked out.
| | 08:13 | But one thing I want to quickly point
out if you go into the Accounts window and
| | 08:19 | hit New or Edit, you'll notice there
is an option here for User must change
| | 08:23 | password on next login.
| | 08:24 | Now if you select this on an account,
you have to make sure that account
| | 08:29 | is assigned to a Privilege Set that has
the Allow user to modify their own password.
| | 08:33 | Because of course you could be requiring
them to modify, and then not allowing
| | 08:37 | them to do so, that could be problematic.
| | 08:39 | Now finally don't forget the Available
menu commands, its in a pessimistic state
| | 08:43 | when you first create a Privilege Set
and it's often overlooked.
| | 08:46 | You'll see here that it's set to Minimum,
which means that most of the menu
| | 08:50 | values, very similar to what you
see as I scroll over these, are not
| | 08:53 | available to the user.
| | 08:54 | So you're going to want to make sure to
either allow them all of the different
| | 08:58 | options or editing only which is copying
and pasting stuff like that, or Minimum
| | 09:02 | which is basically just allowing
them to open and close the file.
| | 09:05 | So make sure that I you don't
forget the available menu commands.
| | 09:09 | Implementing a proper security model
often goes well beyond controlling whether
| | 09:12 | or not someone can just log in to the database or not.
| | 09:15 | FileMaker Pro includes a robust set of
features for controlling which users have
| | 09:19 | access to which information, and
then also what they can do with that
| | 09:22 | information, and that's all done by
setting up Privilege Sets for each user that
| | 09:27 | was previously defined in a user group.
| | Collapse this transcript |
| Applying extended privileges| 00:00 | When you're going through the exercise
of determining what users are going to be
| | 00:03 | need to be access in your database, and
then of course what groups they belong to,
| | 00:07 | you also want to take into consideration
during that exercise that you want
| | 00:11 | see what types of technologies they're
going to be using to access the database.
| | 00:15 | We've already talked about the
different options under the Manage Security
| | 00:19 | window for setting up accounts, which
you want to have each user have their
| | 00:23 | own individual account and password
combination, and then you'll have to
| | 00:26 | assign those accounts to an existing Privilege
Set, which I like to refer to as User Groups.
| | 00:31 | You can use one of the default
Privilege Sets or go on and create your own
| | 00:35 | customized Privilege Set.
| | 00:36 | Once you have a Privilege Set created and
accounts assigned to it, you'll notice
| | 00:40 | that under the Edit Privilege Set,
you'll see in the bottom left-hand corner
| | 00:44 | there's a section for Extended Privileges,
you'll also see Extended Privileges
| | 00:49 | under the Extended Privilege tab.
Now what is an Extended Privilege?
| | 00:52 | Well, think of them as nothing more then
on and off switches that will allow you
| | 00:56 | to turn on different technologies that
users can use to log into the database
| | 01:01 | and access your data.
| | 01:03 | So for example, as you see here we've got iwp,
which stands for Instant Web Publishing
| | 01:07 | and what that means is if you turn on
the fmiwp Extended Privilege
| | 01:14 | within a Privilege Set, that means
that any account that logs into this
| | 01:19 | Privilege Set, can login using Instant Web Publishing.
| | 01:24 | You'll also notice that we've got
options for xdbc, which means that external
| | 01:28 | applications or user accounts that you
setup for those applications that might
| | 01:32 | be accessing file FileMaker data via an
ODBC connection, they would need to have
| | 01:36 | the extended privilege for
the xdbc Privilege Set enabled.
| | 01:41 | And the most important one, this
FileMaker Network, this means that if you
| | 01:45 | want to share your database on
FileMaker server, you're going to need to make
| | 01:49 | sure that you have at least one Privilege Set
with the fmapp Extended Privilege enabled.
| | 01:55 | Otherwise you can upload this file to
FileMaker server, and turn it on and make
| | 02:01 | it available on the network.
But no users will be able to see it.
| | 02:05 | You'll notice that there are some other types
of technologies that are specific to the web.
| | 02:09 | If hit Cancel and go over in to
Extended Privileges window, you'll see that
| | 02:12 | we've got a web technology and Instant
Web Publishing and we've also got PHP.
| | 02:18 | So if you want users to be able to access
your database via a PHP application,
| | 02:22 | you need to make sure that you have at
least one Privilege Set with the fmphp,
| | 02:26 | Extended Privilege active.
| | 02:29 | Same is true for XML, so if there's
another application or another series of
| | 02:32 | users that want to extract data from
your database via XML, then there has to be
| | 02:37 | a Privilege Set with the fmxml,
Extended Privilege activated.
| | 02:41 | And the two new ones that you may not
be familiar with, even if you've seen
| | 02:45 | Extended Privileges in pervious versions,
are the re-authenticate, which are
| | 02:49 | specific to FileMaker Go. We'll talk
about these later in the course when we
| | 02:53 | have the discussion on FileMaker Go.
| | 02:55 | But what they do is they manage
whether or not a user can access your
| | 02:59 | database through the FileMaker Go
application on either an iPad, iPod Touch or an
| | 03:06 | iPhone, and then the authenticating
the number after it determines how long
| | 03:10 | before a user has to be prompted to log in again.
| | 03:14 | Now keep in mind that you can
select multiple technologies for a single
| | 03:17 | Privilege Set as you see here; you
can select them all, if you'd like to,
| | 03:21 | doesn't really present much more of a
security risk. That's allowing users
| | 03:25 | to access the database using various
technologies, but they would only use one account.
| | 03:30 | Now keep in mind also that, if a user
can login to a database that's hosted on
| | 03:35 | the network, but that same account
can't be used for let's say, logging in to a
| | 03:39 | web application or via FileMaker Go,
the place you want to look to make sure
| | 03:43 | that all those are enabled is going
to be under the Edit Privilege Set.
| | 03:47 | So I can into Edit Privilege Set and
choose which different technologies or
| | 03:51 | Extended Privileges will allow access,
or I can go under the Extended Privileges
| | 03:57 | tab and I can choose for example,
access via FileMaker Network and select which
| | 04:04 | Privilege Sets I want to have those
turned on. You'll notice then, when we
| | 04:08 | go into the Privilege Sets,
you'll see that those are turned on.
| | 04:12 | So you can manage these by
Privilege Set or by Extended Privilege.
| | 04:16 | Now this might be an obvious point, but
of course you want to make sure to test
| | 04:20 | your database under every Privilege Set.
| | 04:21 | You also want to them under all the
technologies that you're allowing access to.
| | 04:25 | This will help you shake out any problems
that you might have where you turned
| | 04:29 | on an Account or Privilege Set combination under
one technology but didn't turn it on under another.
| | 04:33 | FileMaker Pro allows users to access
their database from a variety of different
| | 04:37 | technologies and the Extended Privilege Sets
allow you control those for each
| | 04:42 | user group that you've defined in your system.
| | Collapse this transcript |
|
|
2. Calculations: Extending Text FunctionsExploring the PatternCount, Position, and Length functions| 00:00 | Given the wide range of uses for
Calculation formulas within FileMaker Pro,
| | 00:05 | establishing a solid familiarity with
them is essential to becoming a proficient
| | 00:08 | FileMaker developer.
| | 00:10 | Now if you're new to Calculations in
FileMaker, I strongly urge you to go back
| | 00:14 | and watch the FileMaker 12 Essential
Training title and specifically the
| | 00:18 | chapters on Calculations, and then the
other one on Calculation function basics.
| | 00:24 | For those of you that are familiar with
Calculations, I'm going to introduce you
| | 00:27 | to the Calculation functions
that I find to be the most useful.
| | 00:30 | I'm going to start first with the
largest group of functions in FileMaker and
| | 00:34 | those pertain to investigating
and manipulating text strings.
| | 00:37 | Unlike some groups of functions in
which only a few are used on a regular basis,
| | 00:42 | nearly the half of the Text functions
are frequently used in FileMaker Pro solutions.
| | 00:46 | In this chapter I'm going to focus
on about a half dozen or so of these.
| | 00:50 | And I'm going to start first with the
PatternCount Position and Length functions.
| | 00:55 | In order to understand the purpose of
these functions, first we have to define
| | 00:59 | what a text string is.
| | 01:00 | I am going to be talking about text strings
and manipulating those or evaluating those.
| | 01:05 | A text string is really nothing
more then a sequence of characters.
| | 01:08 | It could be anything like this value
in the Part Number field or it could be
| | 01:12 | this entire value and the Description field
or a single word or a single
| | 01:16 | character, whatever it might be.
| | 01:17 | FileMaker doesn't really know
the difference between a series of
| | 01:21 | characters and a word, so for instance
when it sees a word REPAIR, it doesn't
| | 01:27 | now the difference between that word and just
the character R E P A I R, all strung together.
| | 01:33 | The contents of this Description field
can be thought of in the same way. When a
| | 01:37 | computer processes a string it treats
it simply as an ordered set of characters
| | 01:41 | devoid of any meaning or value.
| | 01:43 | Punctuation and white spaces are
merely other types of text characters that
| | 01:47 | are processed by FileMaker, so things
like this little comma we see here, and
| | 01:52 | the spacing between those words, those are all
characters and those will be evaluated as such.
| | 01:57 | So the text functions that I want to
review here are those that give information
| | 02:01 | about a text string. In three that
I've chosen for this movie, PatternCount
| | 02:07 | Position and Length, all result in a numeric value.
| | 02:11 | The first of which is PatternCount.
PatternCount returns the number of times that
| | 02:15 | the specified search string is
contained within a give piece of text.
| | 02:19 | So basically, it counts patterns and
a pattern can be as small as a single
| | 02:24 | character, as long as a phrase.
| | 02:27 | So let's use our imagination a little
bit and say that someone has asked you to
| | 02:30 | determine how many times the word Bike
is used inside the Notes field that you
| | 02:34 | see down here, on the bottom
left-hand corner of your screen.
| | 02:37 | Sure you could do research, find all the
records with the word Bike in the Notes
| | 02:40 | field by simply going into Find mode
and searching for that as your criteria.
| | 02:44 | But you'd have to manually count
all the number of words from there.
| | 02:47 | Bike could be in the field for 5
times and it would only show up as one
| | 02:51 | record in your file count.
| | 02:53 | So instead, let's say we want to create a
Calculation field that we're going to call BikeCount.
| | 02:57 | So as with any other field, we go under
File>Manage>Database and I'm going to
| | 03:03 | use this in the Products table, so we
see that it opens up to the Products table
| | 03:08 | context, and we type in BikeCount.
As I mentioned before, I'm going to make
| | 03:13 | this a Calculation field.
| | 03:15 | But keep in mind that Calculation
functions can be used widely throughout
| | 03:18 | FileMaker, not the just in fields, but
in the next couple of movies we're going
| | 03:22 | to focus on using Calculation
functions and Calculation fields.
| | 03:25 | So now when I hit Create, we see our
Calculation dialog and up in the upper
| | 03:29 | right-hand corner we can see
all the different functions.
| | 03:31 | They are broken down by groups, so
if I pick the Text functions, you can see
| | 03:36 | all the different ones that
either Count or Result and Text.
| | 03:40 | Now we're looking for the one called PatternCount.
| | 03:42 | PatternCount is pretty simple because
it's only got a couple of parameters.
| | 03:46 | You see that's some of these other
functions have several different parameters all
| | 03:48 | strung together by semicolons.
| | 03:50 | But PatternCount is easy, it just says;
| | 03:52 | what's the text that you want to make
your observation on, and what is it that
| | 03:57 | you're searching on.
| | 03:58 | So here the text is actually going to
be the Notes field I described earlier.
| | 04:02 | So let's pick our Notes field, and the
search string that we're looking for,
| | 04:08 | is going to be word Bike.
| | 04:09 | Any time you reference text inside
of a Calculation function you have wrap
| | 04:14 | it in quotes, so that FileMaker
doesn't think it's a field name or a function
| | 04:18 | that you're referencing.
| | 04:19 | As with the any other Calculation field
you want to pay attention to result.
| | 04:22 | In this case we're going to result in a number,
because we want to know how many times
| | 04:26 | the word Bike appears in that field.
| | 04:28 | So now let's hit OK, I'm going to hit OK again.
| | 04:31 | You'll notice that the field
was automatically added to the Layout.
| | 04:36 | If I go into Layout mode, I can scroll
down and see it on the bottom.
| | 04:43 | I'll hold down my Shift key and grab those too
and move it above the bottom of our screen.
| | 04:50 | If your field didn't automatically
show up on screen, that's because you have
| | 04:55 | wisely turned off the FileMaker Pro
Preference under the Layout section that
| | 04:59 | says Add newly defined fields to the
current Layout, we'll go ahead and turn
| | 05:03 | that one off as well, for the rest of these exercises.
| | 05:06 | Now in Browse mode, we've saved that.
| | 05:09 | Now we can see as we go through, we can
see which records in our database have
| | 05:15 | the word Bike inside the Notes field.
I can actually go into Find mode now.
| | 05:19 | Find, and even enter in greater than zero,
and this tells me that three records
| | 05:25 | contain the word Bike in the Notes field.
| | 05:27 | And it tells me how many times that
pattern or the characters B-I-K-E were found.
| | 05:32 | Now you'll notice in some of these
fields there's actually the word Bikes.
| | 05:36 | You'll see here for example in the
Men's Mountain Bike, minimum for all Bikes
| | 05:41 | is in here, we're still just looking
for the text string B-I-K-E, not the word
| | 05:46 | Bike, so this actually does count
as one of the PatternCounts.
| | 05:51 | By default the PatternCount function
is not case sensitive, so even though I
| | 05:55 | capitalized the B in our Calculation
function that you see inside the field
| | 06:01 | for BikeCount, you'll notice that it still
finds a match when it's either a capital
| | 06:07 | or lower case B, so PatternCount
is not case sensitive.
| | 06:10 | But now for more practical example,
let's open up the Manage Scripts.
| | 06:14 | You'll notice that there's a
bunch of scripts already created in here.
| | 06:17 | And if you look at the On First Window
Open, you'll notice that this script has
| | 06:22 | a series of different if functions; and
of course, an if function in a script is
| | 06:27 | another area where you can use
the specified Calculation dialog.
| | 06:29 | And you'll notice that there are
several of them in here that use the
| | 06:33 | PatternCount option. What it's
looking for there, it's using a get
| | 06:37 | function called Get(ApplicationVersion) and
looking for the occurrence of the different device.
| | 06:42 | So here we're saying count how many
times the word iPad shows up in the
| | 06:45 | Get(ApplicationVersion) result,
or Pro or iPhone for example.
| | 06:51 | And this is a way that the PatternCount
can be used to extrapolate which
| | 06:55 | different device or which client
is being used to access this database.
| | 07:00 | Sometimes you might not want to find
out just number of occurrences of a
| | 07:03 | value in a text string, but perhaps a
location of those characters within a
| | 07:07 | text string as well.
| | 07:08 | So for example, you might want to find
out where the comma is inside of a text
| | 07:13 | string, so later on in this course
we're going to be using a technique where
| | 07:18 | we're going to parse out the city and
state and zip, from a city state zip field.
| | 07:22 | And in that case its very important for us
to find out for example where the comma is.
| | 07:27 | So in that case, you're going to use a
function, you'll notice if I just use the
| | 07:31 | BikeCount, you'll see that there's a another
function under Text that's called Position.
| | 07:37 | Position has various different parameters.
| | 07:41 | It basically says within which text do
you want to find a string and what is the
| | 07:45 | text string that you're looking for?
| | 07:47 | So PatternCount tells us how
many different occurrences of it occur.
| | 07:51 | Here we're saying give me the
character Position and we can start at
| | 07:54 | the very first character and give the
character Position of the very first
| | 07:58 | occurrence of such.
| | 07:59 | So Position just slightly different
from Pattern; not doing the counting, but
| | 08:03 | actually giving us back a number value
that represents the character Position.
| | 08:07 | We'll use this in an example later on in this course.
| | 08:11 | But for example, let's say I want to
create something that tells me in any
| | 08:16 | part number that has a dash in it, tell me
what character position that dash is in,
| | 08:19 | we could then use this later to maybe
parse all the values out after the dash or
| | 08:22 | parse all the values up before the dash,
or whatever. So if I create a field called
| | 08:28 | Dash make it a Calculation, hit OK.
| | 08:33 | First I can determine by adding a condition,
my test is going to use PatternCount.
| | 08:41 | So the test is going to be if, and
I'll just type in PatternCount, so in the
| | 08:47 | Part Number field, If there is a Dash
| | 08:57 | and if the number of those Dashes (-)
is greater than zero;
| | 09:00 | that basically means that if the Part
Number field has a Dash (-) in it,
| | 09:03 | then what we're looking for is the Position.
So here I'll go down a Position again
| | 09:13 | in the Part Number field.
| | 09:16 | So I want to know the Position of the Dash,
so we do quote dash quote, "-"
| | 09:21 | and I want to know starting with the very
first character in that Part Number,
| | 09:26 | give me the first occurrence, and otherwise if
it doesn't have one, don't give a number back.
| | 09:33 | This will tell me result in a Number,
so I know I hit Number and hit OK.
| | 09:38 | In Layout mode, just for example purposes,
we'll throw this Dash let's say right there.
| | 09:45 | So now we're going to back into
Browse mode, you'll see that it's the sixth
| | 09:49 | character in this one, so we've got
123456 and next one, number 4, 3 and so on.
| | 09:59 | And in some of these cases, if we do
Show All, we'll see that there's no value
| | 10:03 | because there is no Dash in that Part Number field.
| | 10:06 | So this way if we wanted to extract all the
numbers before the Dash or after the Dash,
| | 10:10 | this tells us which character number we can start with.
| | 10:13 | Also in this case, it might be useful to know
the full number of characters in this text string.
| | 10:17 | So for example we could subtract the
Dash Position from the full Length of the
| | 10:21 | characters, and that would tell us how
many characters we need to extract.
| | 10:24 | That function is a very simple one,
it's called the Length function.
| | 10:29 | I'll show you a simple calculation we can create,
and we'll type in Length.
| | 10:38 | So in the case of Length, we'll go to Part
Number, this will tell us, for every one of
| | 10:47 | these, how many different
characters there are in this field.
| | 10:52 | Now of course we won't usually be
putting these fields on the Layout,
| | 10:57 | but this is just to kind of visually give you a
demonstration of finding the different values,
| | 11:01 | and that you could do some math here.
| | 11:04 | So for example, I could tell, I could
subtract one value from the end of this,
| | 11:08 | which is the difference between Length
and the location of the Dash,
| | 11:11 | and that would help me trim off any
character after the Dash.
| | 11:14 | So some text functions, like the three
we've discussed here, can return numbers
| | 11:18 | telling us the location or a number of occurrences
of certain elements within a text string.
| | 11:23 | Establishing a solid familiarity
with them is essential to becoming a
| | 11:26 | proficient FileMaker developer, as
they can help us with doing things like
| | 11:30 | extracting text or adding conditions to our programming.
| | Collapse this transcript |
| Understanding the Left, Right, and Middle functions| 00:00 | We talked about text functions that
provide a numeric result when used in a
| | 00:04 | formula, and in this movie I want to
show you a family of functions that return
| | 00:08 | a text value as the result of the text function.
| | 00:11 | These families of functions are commonly
used to extract or parse text out of
| | 00:16 | another text string and we like to
call them the left, right and middle
| | 00:20 | functions, sort of a group or
a family of functions together.
| | 00:23 | Let's take a look at these.
| | 00:25 | First, the Left function has two different
parameters the text that's going to
| | 00:29 | be parsed and the number of characters
that we want to extract from the left.
| | 00:33 | So it returns a string that contains the first
left, however many numbers that we indicate.
| | 00:38 | So example "Hickory, dickory, dock"
returns H-i-c-k or the word "Hick."
| | 00:44 | Now writes the same thing
conversely, it will return the
| | 00:47 | Right number of characters that we specify.
| | 00:50 | So for example here we might say
"Hickory, dickory, dock" again, number 4,
| | 00:54 | meaning the number of characters we want to
extract and that will give us "dock"
| | 00:58 | so the last four characters from the right.
| | 01:00 | Now Middle is a little bit different,
because middle is used to slice
| | 01:03 | information out of the middle.
| | 01:05 | So we don't get it from the beginning,
we don't get it from the end, but
| | 01:08 | instead we take it out from the middle.
| | 01:10 | So for example we might say "Hickory,
dickory, dock", we see that we've
| | 01:13 | got an additional parameter, we have to
tell it at which character do we want to start.
| | 01:15 | So here we can see in "Hickory, dickory, dock"
we are going to start at the
| | 01:19 | fourth character and give
us the next three characters.
| | 01:23 | So in this case in Hickory H-I-C-K are
the first four characters, and starting
| | 01:28 | on the fourth character we want to take
three characters out of the middle and
| | 01:31 | that's where we get our KOR.
| | 01:34 | Now let's say in our example database
where we have already created this
| | 01:37 | calculation for the dash field.
| | 01:40 | If we go into Manage>Database and look
at the dash (-) field, we see that we
| | 01:46 | added an if condition.
| | 01:48 | So we say if there are more than 0 dashes
inside the Part Number Field, then we
| | 01:55 | want to extract the position or the
character number that represents the
| | 01:59 | location of the dash.
| | 02:00 | So let say we what they wanted to do
is extract all the Part Number characters
| | 02:05 | from the left of the dash.
| | 02:06 | So in that case we could use the Left
function, make some space for it, and I
| | 02:13 | just click down the L, so I can get
to down the Ls and there is my Left.
| | 02:17 | So the Left function tells me, I want
to know what text we are going parse.
| | 02:22 | So in this case we are going to
be parsing the Part Number field.
| | 02:29 | So first in the text we'll put the
Part Number field. Now the parameter for
| | 02:32 | the numbers of characters isn't just
going to be a number, but instead it could
| | 02:37 | be a different number from record to record.
| | 02:39 | So this is what we want to insert a
formula that will then tell us the number
| | 02:44 | of characters dynamically.
| | 02:45 | So instead of hard coding in however
many numbers we want to extract,
| | 02:49 | because we don't know if we look at the
Part Number; in this it happens to be
| | 02:52 | extracting the first three, the next
one, it could be the first ten, the next
| | 02:56 | one can be five or so on.
| | 02:58 | So instead of putting a hard coded
number into numberOfCharacters, we are
| | 03:00 | going to put a formula in there that
will result in a number and that will
| | 03:03 | actually be the correct number of values that we
want to extract from the Left record-by-record.
| | 03:09 | This is where the Position function
that we created earlier, we copy and paste
| | 03:17 | that here, now that will dynamically
produce the numberOfCharacters that we need
| | 03:21 | to extract from the Left in order to
pull everything from the Left of the dash.
| | 03:26 | So let's take a look it what that will
look like and we have Number and in this
| | 03:32 | case we want to change our
result to Text, hit OK and hit OK.
| | 03:36 | Now we look in the dash, we notice
that it is including the dash
| | 03:42 | and any relevant record, so that of course is
because we've said take everything from
| | 03:47 | the position of the dash to the Left.
| | 03:48 | So what we can do is move that a bit
and we'll simply do there as we say the
| | 03:56 | result of this formula, will give
us our number, minus (-) 1 character.
| | 04:02 | So let's say for example it gave us a 4
that would be the Position of the dash,
| | 04:06 | give us 4-1, so it always shave one of
them off dynamically and you'll notice now,
| | 04:12 | by doing that you see that dynamically
where appropriate, it just give us
| | 04:16 | all the values to the Left.
| | 04:18 | This is an example of nesting different
text functions together to do some parsing.
| | 04:23 | There are some very common uses of these
functions for the purpose of parsing text.
| | 04:28 | So here you can see some examples:
pull the first character of a string,
| | 04:33 | everything except the first character,
everything but the delimiter, which is
| | 04:36 | the one we just did with the dash.
These might be things that you might want
| | 04:40 | to try out within your own applications
just to kind a get some practice at to
| | 04:44 | nesting different functions together.
| | 04:46 | You see all of them use Left, Right and Middle.
| | 04:48 | So on almost every text parsing exercise, you
are going to see Left, Right, or Middle up here.
| | 04:52 | Now you'll notice a lot of these functions
use the Left or Right, but we haven't
| | 04:56 | talked about the Middle function yet.
| | 04:59 | Let's go back into our Database and
instead of in Product Details,
| | 05:03 | let's navigate over to the Customer Details
Layout and I am going to show an example
| | 05:07 | of using the Middle function to extract
data out of the Middle of a text string.
| | 05:11 | So for example, let's say that we've
got the website field here, each one of
| | 05:16 | these customer records has a website in
it, some of them don't, some of them do.
| | 05:21 | But what I want to do is pull the domain,
and what I mean by domain, it's the
| | 05:24 | value that comes in between the www.,
and the dot whatever .com or .net or
| | 05:30 | .org, or whatever it is.
| | 05:31 | And this might be something that
you need to do in order to be able to
| | 05:35 | dynamically generate email addresses
from within a customer or do different
| | 05:39 | searches, or see if you've got the same
domains for different customers across
| | 05:43 | the group, whatever it might be.
| | 05:44 | So this case what we want to do is
we want to splice out the middle just
| | 05:48 | anything in between the
first occurrence of a period (.)
| | 05:51 | and the second occurrence of a period (.)
| | 05:53 | and anything in there, we
will consider the domain.
| | 05:56 | So let's go into File>Manage>Database
create a field called Domain, and we will
| | 06:03 | make a Calculation and hit Create.
| | 06:06 | So in this example we are going to be
using the Middle function, so I'll click
| | 06:10 | into the All functions by name, type
in M to bring me down to the Middle and
| | 06:14 | double-click Middle.
| | 06:15 | Now I am going to use some spaces here, it
won't effect the outcome of our formula.
| | 06:20 | So on the first line, I am going to
just indicate what field we are going to be
| | 06:26 | parsing out and that's website.
| | 06:28 | And now here I need to know where I am
going to start pulling data,
| | 06:33 | so that's going to be the Position of
the period (.) inside websites.
| | 06:36 | So what we want to do there, we'll
click into functions again, type in P, and
| | 06:41 | go down to the Position.
| | 06:43 | So here we'll say in the website
field we are looking for the period (.),
| | 06:50 | which is text, so we'll wrap that in
quotes ("") and we want the very first
| | 06:55 | Position, so we'll start at the very
first Position that's the first one and
| | 06:59 | then we want the first occurrence.
| | 07:01 | So this is going to tell us
the position of that period (.).
| | 07:04 | That's where we want to start extracting
data and then now we have to tell it
| | 07:08 | how many characters we want.
| | 07:09 | So in this case what will we really
want is anything that's in between the
| | 07:13 | character positions of the second period (.)
| | 07:15 | and the character position of the first period (.)
| | 07:17 | So here we can do a little copying and
pasting, and say this character position
| | 07:25 | of the second occurrence of the period (.)
| | 07:30 | minus (-), if I paste in the character
position of the first occurrence of the period (.)
| | 07:35 | and in this case our result is going to
be Text, we'll hit OK, we'll hit OK again.
| | 07:41 | Now if we go into Layout mode and drop
our Domain field on the Layout,
| | 07:51 | we can take a look at this in Browse mode.
| | 07:52 | So let's see what we get.
| | 07:54 | So you'll notice here that we have almost
extracted all the data that we want to,
| | 07:58 | but again, this is important, we're
counting the first characters, we want
| | 08:02 | to trim off that period (.) in there
in order to get the proper Domain.
| | 08:05 | So to fix this, we'll go into our Calculation
and will move our starting point over by 1.
| | 08:12 | So here we will say 1 plus (+) the
first position; we are going to move our
| | 08:18 | start over, then we are going
to subtract one less character.
| | 08:22 | So now you see we remove our starting
position over one to compensate for the period (.)
| | 08:27 | and then we splice off one
less character as a result.
| | 08:32 | So there you see how the Middle
function can allow us to extract data
| | 08:35 | dynamically from within
the middle of a text string.
| | 08:38 | So you do not always get the data in
the format that you prefer if you are
| | 08:42 | getting it from other sources, but
using a Calculation function for parsing out
| | 08:45 | text, you can really solve that problem.
| | 08:47 | So the Left, Right and Middle functions
can be used in combination with
| | 08:51 | other text functions to help you parse
out data, just the way you need it
| | 08:54 | from any text string.
| | Collapse this transcript |
| Understanding the LeftWords, RightWords, and MiddleWords functions| 00:00 | In a previous movie we saw how the Left,
Right and Middle functions can allow
| | 00:04 | you parse out characters
from within text strings.
| | 00:07 | Now FileMaker also provides you with
similar functions to parse out entire words
| | 00:12 | from within Text strings rather than
just the characters. These functions are
| | 00:16 | similarly named, they just
have 'Words' at the end of them.
| | 00:20 | So in the case of LeftWords we see we
still have two parameters, the text and
| | 00:24 | the numberOfWords in this case, not Characters.
| | 00:26 | And it will give the first numberOfWord.
| | 00:28 | So for example if we had to sentence
("the mouse ran") and we say give us two
| | 00:33 | words, it we give us 'the,' and the 'mouse.'
| | 00:35 | Conversely RightWords returns the
x-numberOfWords from the end of the text
| | 00:41 | so ("up the clock") 2 would be "the clock."
| | 00:43 | Now in the case of MiddleWords of course,
we do have that third parameter here,
| | 00:46 | we've got the text that we're parsing,
the word where we want to start and
| | 00:50 | then the numberOfWords.
| | 00:51 | The difference between the Left, Right and
Middle of course is where we want to start.
| | 00:55 | So in this case let's say we wanted
to do ("the mouse ran up the clock"),
| | 01:00 | starting at the 2nd word, give me one
word, and that of course would be "mouse".
| | 01:06 | Now back in our database, let's say for example
we wanted to be able to create a sort field.
| | 01:12 | So you notice here in Item, we've got
a couple of different products that have
| | 01:16 | the word Men's or the Women's at the beginning.
| | 01:19 | But when we sort these in our catalog,
we don't want it to sort by the M or the W;
| | 01:23 | we wanted to sort by
whatever the actual product is.
| | 01:25 | So we are going to use a couple of
things, we are going to first identify
| | 01:29 | whether or not the word Men's or Women's
actually exists, and if it does we just
| | 01:34 | want to show whatever the remaining words are.
| | 01:37 | So this involves a couple different things.
First we have to detect or put
| | 01:41 | a if statement in to say, how many
occurrences of the word men's or women's are there.
| | 01:47 | And if they are greater than (>0), then
strip off the first word, and then give
| | 01:50 | us however many remaining words there are.
| | 01:52 | So let's go Create a new field for this.
We will call it ItemSort,
| | 02:01 | and of course it's going to be a Calculation.
| | 02:04 | And now in this case the first thing
that we want to do is ask a question:
| | 02:08 | Are there any occurrences of the word
Men's or Women's? So in that case
| | 02:12 | we'll create an if statement,
and will use PatternCount.
| | 02:17 | So PatternCount can not only be used just to
detect certain text characters, but entire words.
| | 02:22 | So here if I say inside the Item String,
look for -- and I am pasting this,
| | 02:29 | because I have to have copied earlier,
and I copied it by the way, because of the
| | 02:33 | apostrophe ('). Sometimes apostrophes (')
can be recognized differently,
| | 02:36 | just as a little tip there when
you're identifying certain text.
| | 02:40 | So if the PatternCount of the occurrences
of the word Men's is greater than >0,
| | 02:46 | Or -- and now I can add another criteria to my
test, just copy this instead of Men's,
| | 02:54 | I'll say Women's. So basically what I
have said here is, if the value inside
| | 02:59 | Items has either the word Men's more
than zero times, or the word Women's more
| | 03:05 | than zero times, then we
want our function to kick in.
| | 03:09 | So I'll put the delimiter at the end
here, to indicate that my test is done
| | 03:13 | on the if statement, and give myself some
space. Here's where I will use MiddleWords.
| | 03:18 | So we'll see MiddleWords, very similar
to the Middle, and parse out Item, and we
| | 03:25 | want to say which word, do we want to start with.
| | 03:28 | So we have determined that, If Men's
or Women's occur more than zero times
| | 03:32 | in the ItemField that is the only time then
that this sequence here will even be evaluated.
| | 03:39 | So in this case what I want to do
is say the second word will be our
| | 03:42 | StartingWord, because here we have
already identified that the first word is
| | 03:45 | either Men's or Women's. So now the
tricky part here is to determine how many
| | 03:51 | different words we want to extract,
because in this case it could have three,
| | 03:57 | in another case it could have
five, or two, or whatever it is.
| | 04:00 | So there's another function I
want to introduce you to, which is
| | 04:02 | called WordCount, which tells us
how many different words there are
| | 04:07 | inside the ItemFields.
| | 04:08 | So it tells us the total number of words
and of course, if we've gotten this far,
| | 04:12 | we've determined that one of
the words is either Men's or Women's.
| | 04:16 | So I will subtract one total word from
the WordCount. So now what we are
| | 04:22 | telling it to do is when we detect Men's
or Women's at the beginning of our Item,
| | 04:26 | start at the second word, thus
skipping over Men's or Women's and give me
| | 04:31 | all the other words, minus the Men's or
Women's, thus then being able to sort by
| | 04:36 | the actual product name, rather than
the prefix of the word, Men or Woman.
| | 04:42 | Now we'll add my closing parens ()
and my result is going to be Text and
| | 04:48 | let's take a look at how this thing looks.
| | 04:51 | So now in Layout mode, let's change dash
to ItemSort
| | 05:04 | and now in Browse mode, let's see what we get.
| | 05:06 | So this one has Men's and it just stripped
off Men's and has just given us Mountain Bike.
| | 05:10 | Here it hasn't stripped anything,
because it determines that the value doesn't
| | 05:14 | need to be sorted, same here.
| | 05:19 | So you will look and we'll see if we have
Men's or Women's, there's Men's or Women's.
| | 05:24 | So you can see that it's only performing
this function when we need it to.
| | 05:28 | And it's doing it dynamically no matter how many
different words there are inside the ItemFields.
| | 05:32 | Now a quick note, since we are talking
about words here, I want to tell you a
| | 05:36 | little bit about what
FileMaker actually considers a word.
| | 05:39 | The four Word functions that
we've been talking about: WordCount(),
| | 05:42 | LeftWords(), MiddleWords(), and RightWords()
all depend on FileMaker knowing
| | 05:47 | what constitutes a word.
| | 05:49 | This logic is driven by a list of Characters
that FileMaker Pro considers word delimiters.
| | 05:53 | So you can assume things like spaces,
or tabs, or carriage returns, and most
| | 05:59 | punctuation marks are
considered word delimiters.
| | 06:01 | So FileMaker Pro considers characters
between those delimiters words.
| | 06:06 | Note however, a very interesting exception to that.
| | 06:10 | Punctuation marks that serve as a
valid date and time separators are not
| | 06:14 | considered word separators when
the characters on either side of the
| | 06:17 | separator are numbers.
| | 06:19 | So for example in ("x-y-z") if we did
that wrapped in WordCount that will tell
| | 06:26 | us that's three different words, they
happen to be one character words here,
| | 06:29 | but it's three different words.
| | 06:30 | But if I did numbers on each side of
the dash, so for example, in 12-31-2012
| | 06:37 | that tells us that that's one big word.
| | 06:40 | So FileMaker, the rule is anytime a
punctuation is surrounded on both sides by
| | 06:47 | a number, it does not consider that a
word delimiter. And that comes into play
| | 06:51 | when it comes into dates and phone
numbers, Social Security numbers, all those
| | 06:55 | types of things that you would want to
treat as one single word, FileMaker has
| | 06:59 | this rule kick in so that it doesn't
separate them, as it would, here in the
| | 07:03 | ("x-y-z") circumstance.
| | 07:05 | So once again, you don't always get
data in the perfect format, but if you're
| | 07:09 | familiar with using Calculation functions
for parsing out the text, then you
| | 07:13 | can solve that problem.
| | 07:14 | The Left, Right and MiddleWord functions
can be used in combination with
| | 07:18 | other 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:00 | We've discussed how FileMaker can
extract characters or words from
| | 00:04 | different text strings.
| | 00:06 | The FileMaker also has a family of
functions that will allow us to extract
| | 00:09 | values from a list of different values.
| | 00:12 | But first, what are a list of values?
| | 00:16 | In FileMaker, list of values are determined
by a return delimited list of data.
| | 00:20 | In other development environments,
these are commonly referred to as arrays.
| | 00:24 | The functions that we're going to
discuss here operate on a return delimited
| | 00:28 | list of data and each item in a
list is referred to as a value.
| | 00:33 | Return delimited list are encountered
frequently in FileMaker Pro, so knowing
| | 00:37 | how to manipulate this kind of data is imperative.
| | 00:40 | If you look inside the exercise file,
you'll notice that I've created a layout
| | 00:46 | where I gave three different examples of
functions within FileMaker that create lists.
| | 00:52 | The following functions for example
generate return delimited lists.
| | 00:55 | So you see here we've got the GET
ExtendedPrivileges. We talked about
| | 00:59 | ExtendedPrivileges before; and there is a
GET function in FileMaker that extracts
| | 01:04 | whatever the ExtendedPrivileges are
from the Account that I use to login.
| | 01:08 | So in my account I clearly have the
Instantweb, PHP, FileMaker go authenticate0
| | 01:14 | and the XML ExtendedPrivileges active.
| | 01:17 | Due to the nature of that GET function,
it gives me those in a return delimited list.
| | 01:23 | So that is one way to create a list.
| | 01:26 | We also see GETWindowNames.
| | 01:28 | This is another GET function that will
give me return delimited list of all the
| | 01:32 | different windows that are open.
| | 01:33 | So each time you open a window,
you'll see that you've got 02_04 - 2,
| | 01:38 | these haven't changed the name, so I
don't have a new name for those.
| | 01:42 | But if I open these up in a script and
I name them something different,
| | 01:46 | I am going to get a return
delimited list of window names.
| | 01:49 | Also you'll see the ValueListItems.
| | 01:51 | So I can create what's called a Value
List inside FileMaker. Here you see
| | 01:57 | we've got a Company Value List that
points to the field in the customer
| | 02:02 | table called Company.
| | 02:03 | Now what we're actually doing here when
we use a field to create a Value List in
| | 02:11 | FileMaker is that we're using the field's index.
| | 02:13 | So one way that you can extract and
work with the index of a field is to create
| | 02:18 | a value list, in this case the
company one I just showed you.
| | 02:21 | And then what it will do is show me
all of the different values inside that
| | 02:25 | value list, but it's actually showing me all
the different values inside that field index.
| | 02:29 | It's a very valuable tool in case you're
ever trying to extract different values
| | 02:33 | from a field index or even display a
field index that's available to you from a
| | 02:38 | programming standpoint.
| | 02:39 | Also though you can create lists inside
FileMaker by attaching what's called a
| | 02:44 | checkbox control style to a field.
| | 02:47 | You'll notice in Layout mode in the Inspector,
when I select Preferences, you
| | 02:52 | see that I've got what's called a Checkbox
set Control style; and attached to it
| | 02:57 | is another value list where I've gone
in and typed in the different values.
| | 03:01 | Value Lists are very common in FileMaker.
| | 03:04 | And in this case you can see it's
used to provide your users with different
| | 03:08 | options on items that they can
select within certain control styles.
| | 03:11 | Here with the checkbox you'll notice
that when I check on something, it
| | 03:15 | is actually creating in the background
a list of values or an array of
| | 03:21 | return delimited values.
| | 03:22 | It's the same field, this one just
happens to have the checkbox set to it and
| | 03:28 | this one is just showing me
the values inside the fields.
| | 03:31 | So you can see that as I click these
values, they are not only showing up in
| | 03:35 | a return delimited list, but they are also
showing in the order in which I'm selecting them.
| | 03:39 | So you can use this for Preferences or
which items would you prefer, and click
| | 03:43 | them in the order that you'd
prefer them, that type of thing.
| | 03:45 | So all of these are different
ways that you can construct a return
| | 03:48 | delimited list of values.
| | 03:49 | However, my favorite way to construct
a list of values is to compile a list
| | 03:54 | using what's called the List function.
| | 03:56 | The List function really just has one parameter.
| | 03:58 | So in FileMaker anytime you see those
squiggly brackets inside the parameters of
| | 04:03 | a calculation function, those means
that those are optional parameters.
| | 04:07 | So in this case we could put one field
inside the parentheses or we can put a
| | 04:10 | series of different fields that
are all separated by the semicolon.
| | 04:14 | And 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:19 | So if you look at some of these examples,
they are not too compelling.
| | 04:23 | For example we could take
FullName; Street1; Street2; CityStateZip.
| | 04:27 | All of these together would give us one
big list of really just the same thing
| | 04:31 | that we're seeing there but return delimited.
| | 04:33 | Same thing here, if we just did the
words Hello and then the word, World, it
| | 04:37 | would just give us Hello and
World with return delimited.
| | 04:41 | The reason that I like the list
function so much is because we can reference
| | 04:44 | fields or a related field inside
the function as my field parameter.
| | 04:49 | So this will create a list of
related values in a parent record that has
| | 04:54 | related child values.
| | 04:56 | So it will show you nothing if there
are no related child records, let me give
| | 05:00 | you an example of this.
| | 05:01 | So if we go back into our file and we
navigate over to the Customer record,
| | 05:08 | you can see that some of the customers
have Invoices and some of them do not.
| | 05:17 | But in the cases of the ones that do
have invoices, this is what's called the
| | 05:20 | customer record and these are
called the related invoice records.
| | 05:24 | We're showing these inside of a
portal which is something that you're
| | 05:26 | probably familiar with.
| | 05:27 | But what it's doing, it's showing us
records from the related invoice table.
| | 05:32 | So In this case what I could do is I
could construct a calculation field that
| | 05:36 | shows me an array of all the
different invoice dates, so I'd get a return
| | 05:40 | delimited list of invoice dates.
| | 05:42 | So let's say we'll use that as our example.
| | 05:44 | So what I want to do is I want to go in
and define a field. The list function
| | 05:49 | concept that I am sharing here with you
only works if I'm defining the field in
| | 05:53 | the parent table in the relationship.
| | 05:55 | So the parent table is the term that's
commonly used to refer to the table that
| | 05:59 | acts as the one, in a one to many relationship.
| | 06:03 | And if you want to brush up a little
bit more on those concepts, you can watch
| | 06:07 | the FileMaker Pro 12 Essential Training
title on the Chapter on Relationships
| | 06:12 | or even in the Relational Design With
FileMaker Pro Title,
| | 06:16 | also here in the online training library.
| | 06:18 | So here I am in the parent, in customers,
and I am going to call this
| | 06:22 | InvoiceDateList, make it a Calculation,
hit Create. All I am going to do is
| | 06:30 | pick the List function and instead of
all of these parameters. I am just going
| | 06:38 | to put one field parameter in it. Not a
field from the customer table, because
| | 06:42 | of course, that would only give me one value.
| | 06:45 | Instead, I'll go down into a field
from the related table, pick Date and so
| | 06:50 | now even though I am putting one
field reference in there, it actually will
| | 06:53 | represent a return delimited list of all
the different invoice dates that I do have.
| | 06:59 | So if this one customer that we see in
the background has two related invoices,
| | 07:03 | I'll see two dates with a
return delimiter in between them.
| | 07:06 | And this result is going to be text,
and we hit OK, hit OK again.
| | 07:12 | Let's go into Layout mode
and drop this one on the layout.
| | 07:23 | And in InvoiceDateList, I'll go back
into Browse mode and you'll see now
| | 07:30 | that where there are customers that
don't have related values, nothing shows
| | 07:34 | up inside that field.
| | 07:36 | But in customers that do have related
values, you see that it takes the dates in
| | 07:40 | the same order that we see them here
in the portal, and I'll explain that in a
| | 07:44 | moment, but we see them here with a
return delimiter in between each one.
| | 07:48 | So we can get a list of all the
different dates for this particular
| | 07:51 | customer's invoices.
| | 07:53 | Now note that the order of the fields
matches the order that they are displayed
| | 07:56 | in the portal, but this is because the
relationship used in both the portal and
| | 08:00 | the List function is one that's called Invoices.
| | 08:04 | See here Invoices, and you'll also
notice in the field that I just created,
| | 08:11 | I am using the Invoices relationship.
| | 08:14 | And if we look at the Invoices relationship
in our Manage Database window,
| | 08:19 | that's this one right here, and by
clicking on the equal sign in between these
| | 08:23 | two table occurrences, we can
change some of the parameters.
| | 08:26 | And you'll notice that one of the
parameters is that I'm sorting the child
| | 08:30 | records, or the invoice records by the date.
| | 08:34 | So when I am constructing a list or I am
displaying something in a portal, I can
| | 08:39 | be deliberate about the order in which
these values are going to appear,
| | 08:41 | because of the sort order inside
the criteria of the relationship.
| | 08:45 | So as you can see, FileMaker provides
a bunch of different ways that you can
| | 08:49 | construct lists dynamically by using
the FileMaker Calculation engine inside
| | 08:55 | of your database.
| | Collapse this transcript |
| Parsing lists of values| 00:00 | A FileMaker provides various different
ways that you can construct lists or
| | 00:04 | arrays of data within the FileMaker platform.
| | 00:07 | Now once you have lists constructed or
if you are pointing to lists that are
| | 00:11 | constructed elsewhere, FileMaker also
has mechanisms that allows you to extract
| | 00:15 | values from those lists.
| | 00:17 | But the key there is that you should look
at the different words in a list as values.
| | 00:22 | So for example if you look on screen
here in the calculation we did in the
| | 00:26 | previous movie for the InvoiceDateList,
each one of these dates is what's called
| | 00:31 | a value; and really they're just
delimited by return characters at the end of
| | 00:35 | each value, thus showing them in a
list like you see here on screen.
| | 00:40 | FileMaker has a series of functions
and these might look familiar to you,
| | 00:44 | because they are LeftValues,
RightValues and MiddleValues.
| | 00:48 | LeftValues has two different parameters;
| | 00:50 | the text, and this text of course has to
be a list or a return delimited list of
| | 00:55 | values and then the
numberOfValues that you want to extract.
| | 00:58 | So for example LeftValues from Red,
Green and Blue, number 2 it gives you
| | 01:03 | Red and Green, keep in mind you're
also getting the return characters.
| | 01:07 | And of course if you have another
field that you're referencing, in this case
| | 01:11 | myList, tell it how many
different values that you want to extract.
| | 01:15 | Now Left, when we're talking
about lists means from the top.
| | 01:19 | So in Red, Green and Blue you see that
I get the first two values from the top
| | 01:23 | of the list, or from the left if you
just flatten it all out, but if you're
| | 01:27 | looking at it from top to bottom,
it's the top ones. Then in the case of
| | 01:31 | Right, it gives me the bottommost values,
so in this case the bottom two values
| | 01:36 | are in my list, it gives you the
last three values from that list.
| | 01:39 | There is also MiddleValues, which of
course has the additional parameter.
| | 01:43 | It's the text which represents the list.
| | 01:46 | Then the startingValue, so if you want
to pull the last two you can start from
| | 01:50 | the second last value and
pull a number of two values.
| | 01:53 | So Red, Green or Blue in the
case that I just mentioned.
| | 01:56 | We would start at the second value and
give us two values, that gives me green
| | 02:01 | and blue for example.
| | 02:02 | Or myList; 3; 1 returns the third value from the list.
| | 02:05 | Well let's use these inside of our database.
| | 02:08 | So let's say that we've got this
calculation field here already, but what we
| | 02:12 | want to do is we want to have another
field that just tells us what the oldest
| | 02:17 | invoice date is for each customer.
| | 02:18 | This could be very compelling
information for us to do searches in the database
| | 02:22 | and find out if there are customers who
haven't placed an order with us for over
| | 02:26 | a year or a quarter or a week or whatever it is.
| | 02:29 | So in order to do that we want to
isolate from this list of related invoices
| | 02:33 | what the oldest most invoice might be.
| | 02:35 | And of course we already talked about in
the previous movie how the relationship
| | 02:39 | that's used between customers and
invoices, which is called Invoices;
| | 02:43 | already has a sort value on here that
is sorting the invoices in ascending
| | 02:47 | order based on date.
| | 02:50 | So in this case we're going to use
LeftValues as a function because we want
| | 02:53 | to get the top date from the value of the
list that tells us what the oldest one might be.
| | 02:58 | So you can see here the newest one is on
the bottom or the right in our list and
| | 03:03 | the oldest one is on the top or the left.
| | 03:05 | so basically we just want to extract
the leftmost value from this array.
| | 03:08 | So let's go and create another field in
the Customer table.
| | 03:16 | We'll call this FirstOrder, make it a Calculation
and I will find the LeftValues function, there it is.
| | 03:28 | And instead of text really what we're
looking for is which formula will result
| | 03:32 | in a list or which field contains
a list and that of course is the
| | 03:35 | InvoiceDateList field. I want how many
values, in this case just the one.
| | 03:42 | I would like FileMaker to treat it as
a date, so why don't we pull this as a
| | 03:47 | data and see what we get.
| | 03:48 | We'll hit OK, we'll hit OK again and
now I'll go into layout mode and drop
| | 03:55 | this field right there, FirstOrder, alright.
Let's take a look at what we get in Browse mode.
| | 04:04 | So now we see that in this record, it
dynamically pulls the oldest invoice date
| | 04:10 | from the list. That of course, is a
combination of us creating a list or an
| | 04:14 | array of invoice dates using the list
function and then extracting the leftmost
| | 04:19 | value from that list, because we know
based on our sort order that the top or
| | 04:24 | the leftmost value is the oldest invoice.
| | 04:26 | Now we can do searches on date ranges
and find out when the first time somebody
| | 04:29 | ordered what this was, or I could
reverse this and find out when the last time
| | 04:34 | they ordered where this might be. We
could create a LastOrder field that just
| | 04:38 | simply does the opposite.
So FirstOrder, Duplicate,
| | 04:48 | and change that name and all I have
to do here is just type in Right, okay.
| | 04:59 | When I go into Layout mode, now
I've got the first time they ever ordered
| | 05:05 | and then the last time they ever ordered as well.
| | 05:10 | Both of those I can use in searches.
I don't have to go in and manually
| | 05:14 | update these fields, because if we
look at other records in our found set,
| | 05:19 | it does it dynamically based on the
related values in the unstored calculations.
| | 05:23 | Let me show you some of the other
value functions inside FileMaker.
| | 05:28 | We've got one that's called FilterValues
so we show the text that we want to
| | 05:31 | filter and then the FilterValues.
| | 05:33 | So in this case what we'll actually get --
we'll return all the items in the
| | 05:37 | textToFilter that are also in filterValues.
| | 05:40 | So we'll tell it which ones we want to filter out.
| | 05:42 | So better example is, here we want to
filter out Red, Blue or Green and if the
| | 05:48 | values that we're planning to say White,
Blue and Red, then you end up with Red and Blue.
| | 05:52 | So we're basically telling it only extract
out values that match the certain
| | 05:56 | criteria that I am providing.
| | 05:57 | And here there might be a list of fields
for Departments, and in this case we've
| | 06:02 | got one that's called User Privileges (UserPriv)
and return a list of all the
| | 06:06 | items 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:13 | which items in a return delimited
list each list has in common.
| | 06:17 | There is also Value Count.
| | 06:19 | So just like we add length, which counts
all the characters or word count, which
| | 06:23 | counts all the words, this one simply
counts all the different values in your
| | 06:27 | array, whether it's a calculation that
constructs a list or a list that you put
| | 06:32 | in by yourself like the Red, Blue and Green.
| | 06:33 | There is also GetValue.
| | 06:36 | Now you may have noticed in the calculation
that I had before over in our
| | 06:42 | database, that I was using LeftValues.
| | 06:44 | Now I'm getting the date, I am getting
the first date which was the FirstOrder
| | 06:48 | date or the LastOrder date, but I'm
also getting the return character after it.
| | 06:51 | now if that's something that I don't
want, because it could be a little bit
| | 06:55 | sloppy data or if I am not expecting
that to be there because it's invisible
| | 06:58 | to the user, I can instead use this
function called GetValues.
| | 07:02 | let me show you how that might work.
| | 07:03 | So what you are actually seeing here,
you might not notice, but you are getting
| | 07:07 | the value and a return character after that
value, so it's kind of hidden to the user.
| | 07:12 | But instead what I can do is go into
Manage Database and in FirstOrder,
| | 07:17 | I can instead construct this to say
GetValue, which is under the Gs,
| | 07:28 | and my listOfValues is going to be InvoiceDateList.
| | 07:36 | And then now I have to tell
it which number I want to grab.
| | 07:39 | So based on the sort order I can tell it
I just want to grab the first one.
| | 07:46 | So now you'll see that we still have
the FirstOrder, but it's nice and clean.
| | 07:50 | I'm not gathering anything in here but
you'll see were my cursor goes, I am only
| | 07:54 | grabbing the value not the
return delimited value after it.
| | 07:58 | So GetValue as an alternative to Left,
Middle or Right value will help you grab
| | 08:02 | the value itself not the return character.
| | 08:04 | And one last little tip that I'll give you
is that if you want to create an array,
| | 08:08 | like we did with the List function,
I could do something like FirstOrderComma.
| | 08:17 | I could instead of showing a list with
the return delimiters, I could instead
| | 08:21 | show it with comma delimiters; pretty
simple, I would just say list and then in
| | 08:27 | this case I would pick, let's just pick the ID.
| | 08:32 | But what I would do is I would use
another text function that's called substitute.
| | 08:38 | So here is my List and the search string
I am looking for.
| | 08:46 | You might wonder why there is this return
character in FileMaker, right there.
| | 08:51 | I am going to replace it instead with
some other text, a comma and a space and
| | 08:57 | make that result in text, hit OK.
Now let's look at that in Layout mode, FirstOrder.
| | 09:09 | And we go back into Browse mode and
just take a look at that, you'll see.
| | 09:13 | So there is a way to show a list of IDs
and in this case I pick the customer ID,
| | 09:20 | but we could have picked something
more useful, like for example,
| | 09:27 | something that not every record has in common,
how about the InvoiceID, there we go.
| | 09:32 | So now basically we can create a list
and use any delimiter that we want
| | 09:35 | by substituting out the return delimiter
with whatever we want to use,
| | 09:39 | in this case I used the Comma.
| | 09:41 | The functions discussed in this movie
operate on return delimited lists of data.
| | 09:45 | Each item in a list is referred to as
a value, and return delimited lists are
| | 09:49 | encountered frequently in FileMaker Pro,
so knowing how to manipulate this kind
| | 09:53 | of data can be very powerful.
| | Collapse this transcript |
|
|
3. Calculations: Logical FunctionsReviewing the If and Case functions| 00:00 | Thus far in this course I've
used the If calculation function.
| | 00:04 | And if you've not yet worked with
either the If or Case functions, you'll
| | 00:08 | probably want to review those and
you can do so by going to the online
| | 00:11 | training library and reviewing the FileMaker
12 Essential Training title for more details.
| | 00:16 | Several of the logical functions,
including If and Case, are used for performing
| | 00:21 | what are referred to as conditional operations.
| | 00:24 | In other words, the value returned by
these functions depends on whether one or
| | 00:27 | more of those conditions that
you specify are true or not.
| | 00:30 | For example, if such and such is true
then return X, if not, return Y. The basic
| | 00:35 | concept behind conditional function is
that you provide a test and if that test
| | 00:39 | is true, then you get one result,
otherwise if it's false, you get another.
| | 00:43 | So in plain English I like to say,
it's raining, I bring an umbrella,
| | 00:46 | otherwise bring sunglasses.
| | 00:48 | So if it's raining is the test,
umbrella is true, sunglasses would be false.
| | 00:53 | So the case function, which I have an
example of here under Customer Name,
| | 01:00 | you'll notice that there already is a Case
function here. Case function provides
| | 01:04 | multiple different tests and then a
corresponding true whenever one of those
| | 01:08 | tests comes back with the true.
| | 01:10 | So for example, here we're saying show
in the Customer Name field the Company
| | 01:16 | value if this is true.
| | 01:18 | So if the First and Last name fields
are empty, then show Company. If this
| | 01:23 | is false then move onto this test, and so on
and so on, until you reach a true statement.
| | 01:28 | The moment you reach the true statement,
the Case function stops processing.
| | 01:33 | Some of the core elements that we're
going to talk about moving forward,
| | 01:36 | and in the conditional functions,
they are really the most useful that
| | 01:39 | are available to you.
| | 01:40 | You can use them inside calculations;
| | 01:42 | you'll use them inside scripts
and other areas where you can find
| | 01:45 | calculation dialogs.
| | 01:46 | But be careful not to confuse the If
function with the If script step, which we
| | 01:51 | will also be talking about later in this course.
| | 01:53 | Both are tools that involve conditional tests,
but they serve two different
| | 01:56 | purposes within FileMaker Pro.
| | 01:58 | The If function evaluates a test and
returns one of two possible results,
| | 02:03 | while the If script step is used for
conditional branching within a script.
| | 02:06 | I'll talk about that more when we
get into our discussion on scripting
| | 02:11 | later in this course.
| | 02:12 | So again, if you feel like you need a
refresher or some more information on this
| | 02:16 | or if you haven't looked at these at
all before, I urge you to check out the
| | 02:20 | FileMaker Pro 12 Essential Training
title in both the scripting section and
| | 02:23 | calculation section under Logical Functions.
| | 02:26 | Understanding how to integrate
conditions into programming using either the
| | 02:29 | If or the Case function are one way to really
take your FileMaker programming to the next level.
| | 02:34 | The conditional functions are among the
most useful functions available to a
| | 02:38 | FileMaker Pro developer.
| | Collapse this transcript |
| Using the IsEmpty logical function| 00:00 | While conditional functions are among
the most useful functions available to
| | 00:03 | FileMaker Pro developers, another set
of logical functions perform specific
| | 00:08 | tests and return a Boolean result.
| | 00:11 | These functions include IsEmpty and IsValid.
| | 00:14 | Boolean results simply mean you will
either get a true or a false answer to your
| | 00:19 | question, so to speak.
| | 00:21 | With conditional functions you can
determine what your test or question will be,
| | 00:25 | and also what your response will be if
true. That's the case in the If function,
| | 00:29 | as well as the Case function.
| | 00:31 | With Boolean, in the case of "IsEmpty"
or "IsValid" you're simply a going to get
| | 00:36 | a true or a false answer to your "question."
| | 00:39 | So for example, IsEmpty tests whether
or not the data passed to it is empty.
| | 00:43 | If you pass it a blank string, it returns of a 1,
or a true statement, otherwise
| | 00:48 | it returns a 0 or a false statement.
| | 00:50 | Most often this function is used to
determine whether not specific fields
| | 00:54 | have been left empty.
| | 00:55 | So IsEmpty is commonly used as a
test within a conditional function.
| | 00:59 | Let's take a look in the Manage>Database
for example, to show you a field called
| | 01:04 | Customer Name. I showed this in the
previous movie, but what we are going to do
| | 01:08 | here is turn Customer Name from
a Text field into a Calculation.
| | 01:13 | Now let say for example we need the
Customer Name field to have a value,
| | 01:18 | because we need to print it off into different
reports and we can't have it be blank.
| | 01:22 | But we've discovered that even though we
need this field to contain a value that
| | 01:26 | we get weird different types of
information for each customer.
| | 01:29 | Sometimes we have names, sometimes we
don't, sometimes we have companies,
| | 01:32 | and sometimes we don't.
| | 01:33 | So this a classical conditional logic and
we can address this by using a calculation.
| | 01:39 | So let me first change this to a
Calculation field, and by the way this will
| | 01:45 | blow out any data that was
in the field prior to this,
| | 01:49 | now that I am turning it into a
calculation. Anytime I am using a
| | 01:53 | Calculation, it's just going to show the
result of whatever formula that I'm adding.
| | 01:56 | So the rule here that we will employ is,
if both the First and Last name fields
| | 02:01 | are empty, we will display
the Company Name field value.
| | 02:03 | So for example, if we don't have a
Contact to show the Company Name.
| | 02:07 | But if only the First is empty, then display
the Last name field by itself, otherwise
| | 02:11 | if the Last is empty, we will
display a First name field value.
| | 02:14 | I'll go over all these again, but the
idea is we are adding all these different
| | 02:18 | conditions, and of course, some
of them we would rather see happen.
| | 02:21 | So if we have both the First and Last
name fields, that would be great.
| | 02:24 | If not, then we'll go to Company.
| | 02:25 | So there's some logic to the order
of which were putting these conditions
| | 02:28 | into our Calculation.
| | 02:31 | This is a classic conditional argument
and it also has multiple tests.
| | 02:34 | So what we are going to use is the
Case function here to accommodate our
| | 02:37 | multiple test, because of course, the
only other alternative to put a condition
| | 02:40 | into a calculation is the If function,
but that only allows us one test.
| | 02:45 | So let's put a Case function in here.
A lot of optional information in the
| | 02:49 | Case is not necessary, so, we'll
just open up the parenthesis and give
| | 02:54 | ourselves a little bit of space to work
with. So now on the first line what
| | 02:58 | I am going to do is put in our first test.
| | 03:00 | So based on the rules that I mentioned
before, I am going to use a function
| | 03:04 | that is called IsEmpty. All it
does is ask whether or not the field that
| | 03:08 | I reference using this function or this
parameter in the function, is empty or not.
| | 03:12 | What I can do, is I can include
more than one field if I would like.
| | 03:16 | I can say First and I'll concatenate (&) that with Last.
| | 03:21 | So really I am creating a concatenated
field with the two together, but I'm
| | 03:25 | really asking it, are both of them empty?
| | 03:28 | So if I combined the two together and
it's still empty, that means that both
| | 03:30 | fields are empty, that's the
logic that I am using here.
| | 03:33 | So that's our test. If these are in
fact empty, then based on the rules
| | 03:38 | I indicated earlier, we are going to
show the value in the Company field.
| | 03:42 | So if this will say Scott or Lightningfast,
it will show Lightningfast Racing Co.
| | 03:46 | So that's our first test and our first true. I am going
to put at the end of that line the semicolon (;)
| | 03:52 | so that it delimits where I am going to next test.
| | 03:55 | In the Case statement -- and this is important
to understand -- the case statement will
| | 03:59 | only evaluate the second test,
if the first test is false.
| | 04:04 | If the first test that I have was true
then it's just going to stop evaluating
| | 04:08 | and it's going to show whatever
we've told it to show when it's true.
| | 04:11 | But in this case what I'm doing is I'm
writing something that'll happen if it
| | 04:15 | determines that the first test is false.
| | 04:17 | So with that in mind I want to
provide all possible scenarios as a test.
| | 04:21 | So the next one that we are going to do
is see whether or not the First or Last
| | 04:25 | name are empty, and if so,
provide a different value.
| | 04:28 | So for example, if the function
already passed IsEmpty First and Last, that
| | 04:32 | means that those two are not empty,
so I have to determine which one of the
| | 04:37 | two is in fact empty.
| | 04:38 | So let's use IsEmpty again, and we
will say IsEmpty First, and if that's true,
| | 04:45 | then let's show Last name field.
| | 04:50 | And if that's false, we will go down to
the next test. We will just switch
| | 04:57 | them up, we will say if the Last
name field IsEmpty, show the First.
| | 05:03 | It might seem like we're getting a
little redundant here, but this is what we
| | 05:06 | know by the order of operations.
We are doing this on purpose.
| | 05:09 | We are saying, if these fields are empty,
so we know for sure that the fields
| | 05:13 | aren't empty if you make it this far.
| | 05:15 | Now we are checking to see if
the First name field is empty.
| | 05:19 | But if this is true, and this is true, that
means that the third one has to, in fact, be true.
| | 05:24 | So the order of operations are very
critical here. We've selected the tests
| | 05:29 | in a specific order on purpose. So the
first one we're saying if both of those
| | 05:33 | fields are empty, then put in Company.
| | 05:35 | But if both of them are empty that
means that one of the two of them isn't,
| | 05:39 | so that's what the next test is all about.
| | 05:41 | Is the one that's not empty the First
name field? If so, put in Last, otherwise
| | 05:45 | if that's also false, then we can
narrow it down to saying, all right, the one
| | 05:49 | that's empty is clearly the Last name field.
| | 05:51 | If it makes it past this, and we get
another false, that means that both the
| | 05:55 | First and Last name
fields are in fact populated.
| | 05:59 | So in that case I can say First and
concatenate (&) that with a space
| | 06:08 | and then say Last. I can cap that off and if
I would like to just put a default in
| | 06:15 | there, we will just say,
just show nothing in that case.
| | 06:18 | But here our logic makes sense, so
we say these are empty. If not, put in
| | 06:25 | Company. If they are empty, which one is
empty? Is it that one that's empty? No.
| | 06:28 | Is it that one that's empty?
| | 06:30 | If neither of those two are empty, then
we will show the values of both of those.
| | 06:34 | So pretty simple concept there; good
example of conditional branching.
| | 06:37 | Let's take a look at how this
works inside of our database.
| | 06:40 | You see I have got the
Customer Name field there.
| | 06:44 | In this case I have a
value in both of those fields.
| | 06:47 | So I don't have to worry about it.
Here's one where -- let's say if I just got
| | 06:52 | rid of Company Name or a First name
for example, it's just going to show Last
| | 06:59 | name, but if I get rid of the both
of them, it'll show New Customers.
| | 07:03 | So that follows our rules
just like we set up in the system.
| | 07:06 | So we can see that when we're using
conditions inside of our calculation formulas,
| | 07:10 | that the IsEmpty function can be a very useful test,
| | 07:12 | because it provides you with a true or false answer.
| | Collapse this transcript |
| Using the IsValid logical function| 00:00 | We talked about in the previous movie
how a Boolean function like the IsEmpty
| | 00:05 | function can be very useful inside of
something like an If or Case conditional
| | 00:10 | function as the test parameter,
because Boolean functions give you a very
| | 00:14 | true or false answer.
| | 00:15 | There is another one I'd like to take
a look at, which is called the IsValid
| | 00:19 | function and it does something very similar.
| | 00:20 | It, too, is a Boolean function, and at
first glance it may not seem as useful, but
| | 00:24 | it does have some powerful hidden values.
| | 00:27 | First let's take a look at what
the IsValid function is. IsValid;
| | 00:32 | its purpose is to return a (0) or False,
if the data is invalid, and a (1) or
| | 00:38 | True, if the data IsValid.
| | 00:40 | So for example the Parameters are
just going to be the field that we want to
| | 00:44 | check the validity of. And what it's
intended to be used for is really driven by
| | 00:50 | what an invalid value is.
| | 00:52 | So for example if a record contains an
invalid value, because of the field type
| | 00:56 | mismatch, for example, like if you
put a number field into a date field or
| | 01:00 | something like that;
| | 01:01 | or if you put bunch of text characters
into a number field, or something along
| | 01:05 | those lines; or if you're referencing a
field that's in a calculation reference
| | 01:10 | and it can't find it; or it's
been deleted from a related table.
| | 01:13 | Any of these things it will return a zero (0)
or false, otherwise it returns a true.
| | 01:18 | So if everything is okay as far as the
format of the data and the references of
| | 01:22 | the data, if everything is okay, it returns a 1,
| | 01:25 | otherwise a 0 of it's false.
| | 01:27 | Now sure, you may not find very many
uses for whether or not the value inside a
| | 01:31 | field is a valid format.
| | 01:32 | But when you're looking in the context
of a parent record, and a parent record
| | 01:37 | just as a refresher, is a table in a
relationship has either a parent or child
| | 01:42 | side, meaning the parent is the one, the
child is the many so, any record in any
| | 01:45 | of those tables is either a
a parent record or a child record.
| | 01:49 | So if you're defining a calculation in
the context of a parent record, it can
| | 01:52 | be extremely useful to determine
whether or not any related records exist.
| | 01:58 | Let's say we want to create a field in
our customer table that tells us whether or
| | 02:02 | not a customer has any related Invoices.
| | 02:03 | This can be very useful when it comes
to scripting, or we just might want to be
| | 02:07 | able to do one simple search to
determine whether or not a customer has any
| | 02:11 | Invoices at all, so to do that we
would create a Calculation field.
| | 02:16 | So let's go into File>Manage>Database
and we are going to use a Conditional
| | 02:20 | function, the if function in this case,
because we will only have one test,
| | 02:24 | that's, does this customer
have any Invoices, yes or no?
| | 02:28 | So we'll do one thing if it's Yes or True
and another thing if it's a No or a False.
| | 02:32 | So what we'll do more specifically is
create a field called ActiveInvoices,
| | 02:40 | make it a Calculation and we are
going to choose the if function.
| | 02:44 | By the way you don't have to double-
click from the functions list, if you know
| | 02:50 | the different parameters involved,
you can just type the function name.
| | 02:54 | So I've got if, and so what I
really want to say here is, if the related
| | 02:58 | field IsValid or if any one of the
related Invoice fields are valid, then that
| | 03:03 | means that this client has Invoices or
we'll them Active, and if not they are Inactive.
| | 03:09 | So the trick here is to pick a field
that we are going to use in our IsValid,
| | 03:15 | so there's IsEmpty, IsValid.
| | 03:17 | So the trick here, we are in the context of
the Customers, so we are in the parent table.
| | 03:22 | We want to pick a field from the
related Invoices table that we know will
| | 03:26 | always have a value.
| | 03:28 | So whatever a nonempty field that it
is going to be, so, we know that there
| | 03:32 | will one field that will
always contain a value in that case.
| | 03:35 | And that field is the foreign key value,
so inside Invoices, if the Customer
| | 03:40 | foreign key value contains a
value, then we have a relationship.
| | 03:44 | If there is no related values that
means that no records have the InvoiceID in
| | 03:48 | the CustomerID field.
| | 03:49 | So the trick here when I'm picking
the field is to pick a field in the
| | 03:53 | related child table, which is the Invoices
table here that we know will always have a value.
| | 03:59 | If we use our principles of relational
databases, we know that the foreign key
| | 04:03 | field will always have a value if a
related record exists in the child table.
| | 04:08 | So in that case, in the relationship
between Customers and Invoices the
| | 04:12 | _CustomerIDfk field is the foreign key value.
| | 04:16 | So based on that principle, if there's
related record, this field will have a value in it.
| | 04:20 | So I am simply going to say if IsValid,
and then I am going to point to that
| | 04:25 | field that I know will never be empty.
| | 04:27 | And I am going to say in that case, put
the word Active, otherwise, in the case
| | 04:34 | of the False, we will say InActive and
this will say we want Text, we'll hit OK,
| | 04:41 | we'll hit OK again and I am going to go
into Layout mode and we put this field
| | 04:45 | on the Layout, right there, ActiveInvoices.
| | 04:50 | And let's go back to Browse and
take a look, sure this one has related
| | 04:54 | records, that's correct, this one does too,
this one does not, that one does not, and so on.
| | 05:00 | By the way this technique is also
widely used with the if script step, prior to
| | 05:04 | running a go-to related record step.
| | 05:06 | And the reason for that is because
you don't want to go run a script step
| | 05:09 | that requires there to be related values. So
you could do this in any context that makes sense.
| | 05:14 | You could use this technique anytime
the next action you're going to perform
| | 05:17 | requires that there are
related values in the child table.
| | 05:20 | So you can use this as your test or
your condition to determine whether or not
| | 05:24 | that action happens.
| | 05:25 | So becoming familiar with the IsEmpty
and IsValid functions can prove to be
| | 05:29 | very useful as test parameters in
all of your conditional functions
| | Collapse this transcript |
| Using the Let logical function| 00:00 | As a trainer I am commonly
asked what does the Let function do?
| | 00:04 | The Let function is something that
you'll run into if you're looking around in
| | 00:07 | databases that have been created by
someone else, or even starter solutions or
| | 00:10 | in other training materials.
| | 00:12 | And the answer really is that it
doesn't do anything. The Let function is a
| | 00:15 | unique function that actually doesn't
add any additional programming features
| | 00:19 | to your calculations.
| | 00:20 | But rather creates an environment
within the calculation, or the calculation
| | 00:24 | dialog window, where you can declare
variables and those variables can be used
| | 00:29 | elsewhere within the calculation itself.
| | 00:31 | Now what's the purpose of something like that?
| | 00:33 | Well, if we look at Let function, we
can see that all the Let function is
| | 00:37 | is that inside the brackets you see there,
you will declare these variables and
| | 00:42 | then you just run a calculation formula.
| | 00:44 | So whatever calculation formula
you write in the second parameter
| | 00:48 | calculation, it'll run that.
| | 00:50 | But the nice thing about it is, if you
look at this example here, I can say I'm
| | 00:56 | going to declare a variable
and a variable can be anything.
| | 00:58 | A variable can be any word that you make
up or series of characters, or whatever
| | 01:02 | it is that is not already
being used by FileMaker somewhere.
| | 01:05 | So it can't be a field name, or
function name, or a logical operator or
| | 01:09 | something like that.
| | 01:10 | So when we look at CurrentDate or
curDate that's just a term that we made up.
| | 01:14 | We can declare it by saying what does it equal?
| | 01:17 | Well, it's going to equal
whatever the result of the function
| | 01:21 | Get (CurrentDate) might be.
| | 01:22 | So the same with mo, it is going
to use the CurrentDate function.
| | 01:26 | So you use see that if I have already
declared a variable, I can then use that
| | 01:31 | in another calculation function.
| | 01:32 | So, mo=Month of the CurrentDate,
yr=Year of the CurrentDate and so on.
| | 01:37 | The reason we do that is because we'll write a formula,
Date ( mo ; 1 ; year ).
| | 01:44 | So here what we've done is declared all
the variables and then we have used the
| | 01:47 | variables mo and yr down below.
This will of course return the date of the
| | 01:53 | first day of the current month.
| | 01:54 | So, I'll look at another example,
because another real use for Let functions is
| | 01:58 | because nested functions, or the
alternative to writing a Let function can be
| | 02:02 | very difficult to write visually and tough to see.
| | 02:05 | So for example, let's say we've a
function here where we're declaring three
| | 02:08 | variables: one is called add, one is
called len and one is called comma; and
| | 02:12 | each of them are declared as a formula.
| | 02:15 | The Trimming of the address field,
the Length of the Address field, or the
| | 02:19 | Position of the comma (,) for example.
| | 02:20 | And then when we close out those
declared variables, we run the Calculation
| | 02:24 | formula, which is just
Right (add ; len - comma ).
| | 02:28 | And what that's going to give us,
it's going to return everything after the
| | 02:31 | comma in the Address field.
| | 02:32 | We are actually going build something
like this into our database is just a
| | 02:37 | second, but the idea behind this is
the alternative can be very difficult.
| | 02:40 | So you see here, we have got Right
and then Trim (Address) and the semicolon,
| | 02:44 | Length Trim Address minus
Position, Trim Address and so on and so on.
| | 02:47 | But the other interesting advantage here
is that when you use a Let function and
| | 02:52 | you declare variables, so in this case,
we declared the variable add, it equals
| | 02:58 | the Trim Address functions.
| | 02:59 | So we take the Trim function,
we put the Address field in there.
| | 03:02 | Now this Calculation below, if we
wrote it like that, we are going to get the
| | 03:06 | same result as we get, if we write
it with the Let function on the top.
| | 03:10 | But the advantage is we're only
processing the Trim function against the
| | 03:13 | Address field one time in the Let function above,
on the bottom it's happening three different times.
| | 03:19 | Now this can get very unwieldy and
provide a lot of overhead and potentially
| | 03:23 | processing overhead if you're maybe
processing that 50 times in a calculation or
| | 03:27 | something like that, or even
three really makes a difference.
| | 03:29 | So let's take a look at how we might
actually write this inside of our database.
| | 03:34 | So here I am in the exercise files,
and you notice that I've got an Address 2
| | 03:38 | field. Let's say we've got some kind of
garbage data and either users entered it
| | 03:42 | in this way, or we got it from another
source where there is a comma and
| | 03:45 | then it gives, like in this case, Suite 4,
or Second Floor, or something like that,
| | 03:49 | that's stuff that we want to
have in this other field.
| | 03:52 | So, let's say I go into Manage>Database
and I go into Address 2 --
| | 04:00 | Sctually let's create another one,
we're going to call it TrimmedAddress,
| | 04:06 | create a Calculation field and hit Create.
| | 04:09 | So we could write this formula as
Right(Trim(Address); Length(Trim(Address))- Position
| | 04:28 | So you can just see even writing this,
it's a lot more potential room for error.
| | 04:33 | And we can leave this as
a Number or Text in this case.
| | 04:44 | So you see we have got a little bit
of error here. Oh, I need is Address 1.
| | 04:48 | Okay, now I got to change that three
different times. That's fine, I mean it's
| | 04:53 | hand typed. This I could have avoided just
by double-clicking on these values of course.
| | 04:57 | But will the function not perform properly?
Well, I'll go and make my changes.
| | 05:03 | And, here we go, we see there is another area.
| | 05:06 | Again, those could have been easily avoided.
| | 05:09 | But in this case I could go into Layout Mode
and I could pick TrimmedAddress here
| | 05:18 | and we get the value that we were looking for.
| | 05:20 | But the alternative to this, using the
Let function by going here, let's say I
| | 05:26 | knock this down -- and one thing I should
tell you is that you can comment out
| | 05:30 | different lines in your Calculations.
| | 05:31 | So by the way if it's all one line I can
o slash (//) and comment that out.
| | 05:36 | So I can leave it here and it's a
good idea by the way if you're updating
| | 05:40 | calculations kind of drastically, maybe
leave the old calculation there, just in
| | 05:43 | case you need to revert back.
| | 05:44 | And by the way I could either do slash slash (//),
or slash asterisk (/*)
| | 05:50 | if it's more than one line, and then
close it out with asterisk slash (*/).
| | 05:54 | So, a little sidebar there on
how you can comment these out.
| | 05:57 | So let's comment out the old one.
Let's create the new one and I am going
| | 06:01 | to declare a Let function first.
| | 06:04 | So Let function, and we will
get rid of all the stuff, okay.
| | 06:11 | So first let's open up the bracket
and declare our first variable.
| | 06:16 | Our first variable is going to be
called add and that's going to be
| | 06:21 | Trim(Address 1), so I only have to do
that one time, and I'll separate that
| | 06:27 | with the semicolon (;)
| | 06:28 | then we will say, this next variable I
am going to len, len= and then that's
| | 06:32 | just going to be the Length function.
| | 06:35 | And I am going to use the,
add that I declared here.
| | 06:40 | So, the order, if I would have done this
one first, it would be confusing,
| | 06:44 | so I have to declare it first before I can use it.
| | 06:47 | So hopefully that makes sense.
| | 06:48 | Then the last one is comma and that
will equal the position of add
| | 06:59 | we were looking for comma, the first
occurrence, and so now let's close our brackets
| | 07:07 | out and add our semicolon.
| | 07:10 | So now we want to have our formulas.
So our formula is going to be
| | 07:13 | Right(add; len-comma). Let's close this out
and see if we get any issues with it.
| | 07:24 | We need to close that line out first, so here
we go, see that we get an error in that case.
| | 07:30 | So what we need to do is get rid of,
here we just need to get rid of that, okay.
| | 07:43 | So now when we close this out, you
see we get the same value, little less
| | 07:51 | overhead from a programming standpoint.
We do get the same value, it's a little
| | 07:56 | bit easier for us to look at and work with,
| | 08:00 | if we need to. As you can see, as opposed
to the other one, it's all nested, cleaner.
| | 08:04 | This isn't as dramatic as if you get
into Calculations that could be
| | 08:08 | three or four pages long. Then organizing it
differently in the Let function has
| | 08:12 | a pretty dramatic effect.
| | 08:13 | Although Let functions do not add
any additional functionality to your
| | 08:17 | calculations, they can make nesting
functions significantly easier to write and
| | 08:21 | even reduce processing time and allow
you to set different variables that can be
| | 08:26 | used within the Calculation itself.
| | 08:29 | So 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:00 | The Self function is unique function
that has somewhat limited use, but it's
| | 00:04 | really good to understand how it's used.
| | 00:07 | Now by definition, the Self function
returns the content of the object in which
| | 00:12 | the calculation is defined.
| | 00:14 | Now this is -- got some very specific
use, mainly with conditional formatting.
| | 00:18 | The most common place that
you'll see it is in Layout mode.
| | 00:23 | You grab an object, let's right-click
or Ctrl+Click on this object and say
| | 00:28 | Conditional Formatting.
| | 00:29 | Now this is where you may have encountered
the Self function, because you'll
| | 00:33 | notice when you add something and you
change it over to formula, this is where
| | 00:37 | Self function appears.
| | 00:39 | And really this might be one of the few
isolated areas where the Self function
| | 00:43 | actually makes sense, because inside
this formula, you could reference the
| | 00:48 | Layout object or the field in
this case, within the formula.
| | 00:53 | So you could say for example, if the
Grand Total field is empty then make
| | 00:57 | the Text Color red.
| | 00:59 | Now the option that you have there is to
actually implicitly say the Grand Total
| | 01:03 | field in the formula or you could just use Self.
| | 01:06 | So self means me, or the object in which I am.
| | 01:10 | This is the Grand Total or Self.
| | 01:13 | So let me give you an example of this.
| | 01:15 | So for example, let's say we want to
create a formula that says if the Grand
| | 01:20 | Total field is greater than or equal to 500.
| | 01:27 | So I could say the Grand Total field,
Invoices Grand Total if I wanted to,
| | 01:33 | or I could just say Self.
Self is greater than or equal to 500.
| | 01:37 | So let's say if it's greater than or
equal to 500, we'll make it green and bold.
| | 01:42 | Let's take a look at what that
might look like in browse mode.
| | 01:46 | So here you see that it works.
| | 01:48 | It's the two that are above 500 are
bold and in green. We'll do another
| | 01:54 | example in the upcoming chapters in
the course where we show Conditional
| | 01:58 | Formatting, but this one is a real simple one.
| | 02:00 | If the value is greater than 500,
apply bold and green.
| | 02:03 | Now what's the advantage of using
the Self function over just implicitly
| | 02:06 | referencing the Grand Total function?
| | 02:08 | Well, if we go back in
the Layout mode, you'll see.
| | 02:11 | So now, let's say I've got this
Grand Total field, which is in a different
| | 02:16 | occurrence of the field I should say.
| | 02:18 | Here, I'm going to copy it.
| | 02:21 | And you'll notice that when you copy a
field in FileMaker, it carries with it
| | 02:28 | the format, the size of the field, the
value that it has been referenced and
| | 02:32 | you'll also notice by these little
diamond shape called Badges in FileMaker
| | 02:38 | Layouts that it also inherits the custom value.
| | 02:43 | So now you'll notice it also inherits the
conditional formatting and so you'll notice,
| | 02:49 | when we go in the browse mode that
that's the same field in a
| | 02:54 | different relationship, so a different
related field, and it still carries with
| | 02:57 | it that same formula.
| | 02:59 | This will be a completely different
relationship if I wanted it to be and I can
| | 03:02 | still apply the conditional formatting.
| | 03:05 | So the idea is, when you reference
Self that means that then the formula will
| | 03:09 | reference whatever object that it's
applied to. So I could have five or six
| | 03:13 | different fields on this layout and I
could just drag copy each one of them and
| | 03:18 | in each case it would apply the
if the value inside me or the field to which
| | 03:23 | it's referenced is greater
than 500, then apply this.
| | 03:25 | So it's just a real nice and clean
compact way to write a formula almost
| | 03:29 | specifically in a conditional formatting
environment that then can be copied and
| | 03:34 | applied to other fields without having
to go in, of course, and change the field
| | 03:39 | name that's referenced.
| | 03:40 | We could've said in this formula, the
Grand Total field; I could have wrote
| | 03:45 | that in, but then if I copy this to the
Subtotal field instead, I would had to
| | 03:49 | go back into the Conditional
Formatting and change it from Grand Total to
| | 03:54 | Subtotal, instead, I just say Self and I can
copy and apply that formula all over the place.
| | 03:58 | So the Self function is very useful when
defining formulas for conditional formatting.
| | 04:02 | It returns the content of the object
in which the calculation was defined and
| | 04:06 | you could use the Self instead of implicitly
naming the object that you want to
| | 04:10 | apply conditional formatting to.
| | 04:11 | So it allows you to copy the formula
quickly to other objects and lets you
| | 04:15 | reuse that same conditional formula elsewhere
on the same layout or even other layouts.
| | Collapse this transcript |
|
|
4. Other Uses of the Calculation DialogWorking with calculated replaces| 00:00 | Understanding calculation formulas can
arguably be one of the most useful skills
| | 00:04 | when working within FileMaker Pro.
| | 00:07 | This is not only because of creating
calculation fields, but because the
| | 00:10 | calculation dialog can be found in
several other places throughout the
| | 00:13 | FileMaker Development experience.
| | 00:16 | In many cases it performs a logical check
to determine if a condition is true or
| | 00:19 | false which is often referred to
as a Boolean operation.
| | 00:23 | In other cases, it generates a result
that is then used internally by another
| | 00:27 | feature in FileMaker Pro.
| | 00:29 | In this section I want to take a look
at the different ways that FileMaker can
| | 00:33 | use calculation dialogs and try to
demonstrate to you how useful understanding
| | 00:38 | FileMaker calculations and formulas can be.
| | 00:40 | So the first place that we're going to look at
this is and what's called a Calculated Replace.
| | 00:45 | Now first of all that's kind of
an official term, but what's really
| | 00:48 | happening here is there's a function
in FileMaker, you'll notice, if you
| | 00:51 | click inside a field like Import Source,
you go under the Records menu, down
| | 00:55 | towards the bottom about three up from
the bottom is something that's called
| | 00:58 | Replace Field Contents.
| | 01:00 | Now this is something where you can
create a Found Set of records in your
| | 01:04 | database and click into one of them
and you've a few different options here.
| | 01:08 | You could replace all of the 1524
records in the Found Set with that value
| | 01:14 | that's in the first record, or I could
serialize them by starting by a value
| | 01:19 | that I provide and incrementing by
another value, or I could do the third
| | 01:24 | option, which is Replace every record
as I go through all these 1524 records,
| | 01:30 | evaluate some formula that I write
inside this Specify Calculation dialog and
| | 01:35 | then insert that into the record.
| | 01:37 | So I can do a batch update of a bunch
of non-calculated fields by applying a
| | 01:42 | calculated formula to each
of the records in a Found Set.
| | 01:45 | So this is a Replace Field Contents
operation, but I'm using the calculation
| | 01:49 | option and that's commonly
referred to as Calculate Replace.
| | 01:54 | So let's try an example of calculated replace.
| | 01:57 | Say for example, we were given this
database and when we imported the data in
| | 02:03 | and this is actually kind of
a common thing that happens.
| | 02:06 | The data that was provided to us has
the City a comma, the State and then the
| | 02:11 | Postal Code all in one field.
| | 02:14 | And what we want to do is parse it into
its own individual fields, which is more
| | 02:18 | normalized, more useful to us
from a data management standpoint.
| | 02:22 | But what I'm going to do is I'm going
to come up with a calculation formula and
| | 02:26 | I'm going to use it in the calculated
replace. The advantage there, instead
| | 02:30 | of creating a calculation field, is
that once the calculated replace is done,
| | 02:34 | it's gone and evaluated all these records.
| | 02:36 | Then the field is just a regular text field.
| | 02:38 | So I could go in and update the city
if I get more information on this client
| | 02:41 | or change some values or do whatever I want.
| | 02:44 | So of course, I could easily just go
in and create a calculation for this
| | 02:48 | City field right here, but then users can't
click inside of it and they can never change it.
| | 02:52 | So that's one of the big reasons
why a calculated replace might be more
| | 02:56 | advantageous than creating a calculated field.
| | 02:59 | So in addition to normalizing, we're
also going to put everything in its right
| | 03:02 | spot and allow it to be updated in the future.
| | 03:04 | So how we're going to do that?
First, let's start with the City field.
| | 03:07 | Again, I'm going to perform this
Calculated Replace against wherever the Found
| | 03:11 | Set is, so let's say I just create a Found
Set of All the records in the entire database.
| | 03:16 | We'll go to the first one.
| | 03:18 | I'll click inside the field that I want
to perform the calculated replace within
| | 03:22 | and I'll go under Records, to Replace
Field Contents and I'll choose the third
| | 03:27 | option, thus invoking this
Specify Calculation dialog.
| | 03:31 | You'll notice it's not exactly like
the calculated field dialog, because we
| | 03:35 | don't have any options below here.
| | 03:36 | We can't choose what the result is
going to be, because there's already a field
| | 03:40 | that we're putting data into and
that field already is some data type.
| | 03:43 | In this case, it looks like it's a Text field.
| | 03:46 | Also, there are no storage options,
because this isn't a calculated field, so
| | 03:49 | there is no storage issues involved.
| | 03:51 | We just have to use the
dialog to create a formula.
| | 03:55 | So what we want to do here is create a
formula that's going to extract the City
| | 04:00 | name out of the Import Source field.
And that function we're going to use in
| | 04:05 | that case, let's use the Left
function that we used earlier in this course.
| | 04:10 | So say, click in there and do L, we
go to Left and the text that we want to
| | 04:17 | extract the left value from is this
one called Import Source, the one that
| | 04:22 | we can see down here.
| | 04:25 | So Left Import Source and what
we want to do is pull whatever
| | 04:29 | numberOfCharacters are in that formula
that come before the comma. So let's find
| | 04:37 | the position of the comma, of course,
we did all this earlier in the course.
| | 04:42 | So the Position of Import Source and the
searchString, it's going to be the comma.
| | 04:54 | Let's start with the very first character,
and we want to find the very first
| | 04:58 | occurrence and we don't want it to
include the comma, so I'm going to move it
| | 05:03 | over 1 position, give me everything to
the left of the position of the comma
| | 05:08 | minus 1. So in this case, it would give us all
of San Francisco, but not including the comma.
| | 05:13 | So I'm going to wrap that up with a
closing parens and let's see what we get. Good!
| | 05:19 | Tells us that we need to check our
Import Source so, we'll double check
| | 05:23 | everything and there we go.
| | 05:27 | We get rid of one of those, perfect.
Now we're all set.
| | 05:30 | Thank you FileMaker, checks our syntax.
Now here's the thing.
| | 05:32 | Before you go ahead and hit Replace, you
should know that there is no undo for a replace,
| | 05:37 | or more specifically, a calculated replace.
| | 05:39 | This is a good time to mention that
because it's probably a good idea
| | 05:43 | when you're testing these things out
to first of all test your calculated formula
| | 05:46 | inside of a field or if you've got a copy
of FileMaker Advanced you can
| | 05:50 | use a data viewer or you can certainly just
create a backup of this and try it on the backup.
| | 05:55 | So we are confident that our calculation
is correct so here I'm going to say Replace.
| | 05:59 | And now, you'll see what it's
done, pretty instantaneously,
| | 06:02 | it's gone through all the records
in our 1500 record found set and it's
| | 06:06 | extracted out either the one word or two
word, City name from all the records in
| | 06:11 | the entire found set.
| | 06:13 | That one was pretty easy.
Let's go ahead and do the State.
| | 06:16 | State, same thing click inside the State,
go to Replace Field Contents and in
| | 06:21 | this case, we're going to use Middle.
| | 06:23 | And again, this is the formula
that we used earlier in this course.
| | 06:27 | So we're going to say in the pull from
the Import Source, starting at the let's
| | 06:39 | say the Position, and in this case,
we're also going to be looking for the comma.
| | 06:47 | So we'll say Position(Import Source;
| | 06:51 | let's look for the comma and we want to
find the first occurrence of the comma.
| | 06:57 | Start with the first character
and do the first occurrence.
| | 07:00 | But in this case, what we want to do
since we're using the State, we want to not
| | 07:03 | include the comma and not include the
space next to the comma either,
| | 07:06 | so here I'm going to do +2 characters.
| | 07:11 | So Middle(Import Source;
Position(Import Source
| | 07:16 | all the way through number 2
How many characters do you want to extract?
| | 07:23 | Just the 2, because every State
abbreviation is going to have two characters
| | 07:27 | and we close that up. So, let's
check our syntax, looks good.
| | 07:31 | And we run that calculated replace.
| | 07:32 | And again, what's nice about this is
that we can go in here after the fact and
| | 07:36 | make a change if we'd like to.
| | 07:38 | So it's not a calculated field.
| | 07:40 | It's fully editable.
| | 07:42 | So it's really good for like a
one time data cleanup for example.
| | 07:45 | And finally, we'll do one
more of these just for posterity.
| | 07:49 | This one is much easier.
| | 07:50 | We can just say Right(Import Source:
| | 07:56 | and we'll pull in 1, 2, 3, 4, 5 characters
and run that against our Found Set.
| | 08:06 | So Calculated Replaces let you use
the power of the FileMaker calculation
| | 08:09 | engine to apply a formula across an
entire Found Set of records without
| | 08:13 | having to create a calculated field,
which of course, your users can't edit
| | 08:17 | or update in the future.
| | 08:18 | So you're left then with an editable
result that does not have the restrictions
| | 08:22 | of a normal calculated field.
| | Collapse this transcript |
| Using calculations for the Auto-Enter and Validation tabs in the Field Options dialog| 00:00 | Another area where you will see
the FileMaker calculation dialog is
| | 00:04 | under field options.
| | 00:06 | Of course we define our fields
under the File>Manage>Database section.
| | 00:10 | And if you look into any one of the
fields that are already defined, you'll
| | 00:13 | notice that there's an
Options button that appears.
| | 00:16 | And if you're just defining a field
for the first time, you have to create it
| | 00:20 | before the Options button will appear.
| | 00:21 | Now when you click on the Options
button, you'll notice that there is a
| | 00:25 | Calculated value option here under
Auto-Enter and also under Validation.
| | 00:31 | A field set to Auto-Enter using a
calculated value differs in many regards from
| | 00:35 | a calculation field and we can see that
difference when we hit Specify, because
| | 00:39 | in the Specify Calculation dialog
that appears here, you see we don't have
| | 00:43 | options down here for which type
of value is going to be stored.
| | 00:48 | It's just going to take on whatever the
field type is from the field that we're
| | 00:52 | configuring options for.
| | 00:53 | And then also, there's no
storage or any other options like that.
| | 00:57 | The same is true in the
window that appears for Validation.
| | 01:01 | In the case of Validation, this is
one of those Boolean calculation dialogs.
| | 01:05 | So the statement that we're going to
create here is either going to be true or false.
| | 01:09 | And if it's true then it
passes the validation rule.
| | 01:12 | If it's false, it does not,
then an error shows up.
| | 01:15 | So let's look at a couple of
examples of these two things.
| | 01:17 | First in Auto-Enter, now, just as a
refresher the Auto-Enter option is intended
| | 01:22 | to automatically enter a value into
a field whenever a record is created.
| | 01:25 | Now the only field option here in the
Auto-Enter tab that performs a little bit
| | 01:29 | differently is the Calculated value option.
| | 01:32 | So let's take a look at that.
| | 01:33 | So let's say for example, you're
having trouble with users putting leading or
| | 01:38 | trailing spaces in the Company
name field during data entry.
| | 01:41 | They are copying and pasting from
another form or they're just sort of doing
| | 01:46 | something on the keyboard that's
putting in leading spaces at the beginning or
| | 01:49 | the end of the Company field and that's
throwing off some of your reporting or
| | 01:53 | searching, it's just way that the data looks.
| | 01:55 | So what we can do is actually set up an
Auto-Enter calculation to take the data
| | 01:59 | that the user is entering into the
field and performs a function against it and
| | 02:03 | then save the data to the field after it commits.
| | 02:06 | Nowthis is a concept of commit,
if you are not familiar with commit.
| | 02:10 | Although it appears that FileMaker
automatically saves anything that you type
| | 02:14 | into a field, as you'll notice here.
| | 02:17 | You click into a field and
go ahead and type something.
| | 02:20 | No message pops up that
says, Do you want to save.
| | 02:23 | Well, that's because FileMaker
automatically commits these values.
| | 02:26 | That's what saving is in FileMaker.
| | 02:27 | However, FileMaker doesn't commit until
you perform some type of commit action.
| | 02:31 | The most popular commit action is
to click outside of a field and that
| | 02:34 | will perform the commit.
| | 02:36 | But what's interesting is that there is
a brief moment in time in between when
| | 02:40 | you type something into a field and
when it actually gets committed to the
| | 02:44 | database that that data can be manipulated.
| | 02:45 | And one of the ways that we can do
that is under the Auto-Enter Calculation.
| | 02:52 | So any formula that I write here will
take the data that the user has typed
| | 02:56 | into the field, then perform this function
against it before it commits it to the database.
| | 03:02 | So this is a great way for you to
capture stuff that's being data entered.
| | 03:06 | Change it or manipulate it or filter it
or apply some rules to it before it gets
| | 03:10 | saved to the database.
| | 03:11 | So this gives you complete control
over the format of the data before it hits
| | 03:14 | the database so, let's try this out for a second.
| | 03:17 | So we open up the Company field here as
you see on screen and this is the field
| | 03:20 | that we're allegedly having
problems with leading or trailing spaces.
| | 03:23 | And we see that the result is going
to have to be Text and that's because,
| | 03:26 | the Company field as you see down below here
is already have been set up to be a Text field.
| | 03:32 | So I'm going to pick a calculation
function that's called Trim and Trim is
| | 03:36 | really easy one, it just has one
parameter in it and that's the Text field and
| | 03:40 | so what it does is it trims leading
or trailing spaces off of the data.
| | 03:44 | So what I'm going to do though in the text
parameter, I'm going to pick the Company field.
| | 03:49 | Let's pause for a second because
this might seem a little strange.
| | 03:52 | Nowhere in any of our calculation
dialogs when we're defining fields for
| | 03:56 | example will we use the
field itself in the formula.
| | 04:03 | But since we're talking about Auto-Enter
calculation, I can use the Company
| | 04:06 | field in the formula for the Company
Auto-Enter. The reason for that is
| | 04:11 | usually where we put a parameter in
here for text, it's either going to be a
| | 04:14 | formula that results in a text or a field,
and it's very common to use fields in
| | 04:18 | calculation formulas.
| | 04:19 | Usually that acts as a placeholder for
the value that gets entered into the field.
| | 04:24 | That's what we're doing here.
| | 04:25 | So instead of the Company name being
the Company name value that's already in
| | 04:30 | there, we're going to say trim the
value that the user types into the field
| | 04:34 | before it gets committed to a database.
| | 04:36 | That's really what you're doing when
you're referencing the field in its
| | 04:41 | own Auto-Enter formula.
| | 04:43 | So right now this formula simply
says take the value that the user typed
| | 04:46 | into the field, trim any leading or
trailing spaces on it and then commit it,
| | 04:50 | it's really that easy.
| | 04:52 | So we hit OK and now, you'll notice
there's one more option here and although,
| | 04:57 | admittedly it's not very clear, it's a bit
cryptic as to what it actually does.
| | 05:00 | It's key to this technique actually working.
| | 05:03 | This option Do not replace
existing value or field if any,
| | 05:08 | is currently unchecked.
By default, it is checked.
| | 05:11 | And when it's checked, it means that
whatever formula we put in there, will not
| | 05:14 | be performed against the data
that the user entered into the field.
| | 05:19 | So what we want to do is uncheck that,
so it's the combination of picking
| | 05:22 | calculated value, putting in the
formula, referencing the field, referencing
| | 05:26 | itself and then unchecking that Do
not replace existing value field if any.
| | 05:32 | So now, let's look at that in action.
| | 05:35 | So here I'm going to click in, I'm
going to add a bunch of trailing spaces.
| | 05:39 | And of course, I haven't committed this
to the database yet, so now I'm going to
| | 05:42 | commit by clicking outside the field.
| | 05:44 | So what it's actually done is then take
the value that I typed in, perform the
| | 05:48 | calculation function against it, which
we can see the evidence of that here,
| | 05:51 | is that I don't have trailing spaces
after that s, and then that's what gets
| | 05:54 | saved into the database.
| | 05:55 | So instead of trying to train your
users not to do things like add leading
| | 05:59 | spaces or trailing spaces or whatever,
you can just grab the data, do the clean
| | 06:02 | up for them and let them type
wherever they want in there.
| | 06:05 | This same formula can be applied
using a Substitute function, where you can
| | 06:10 | substitute return characters or
specific values that you don't want entered
| | 06:13 | into the field with blanks or you can
do a Filter function where you can just
| | 06:17 | say the entire alphabet ABC, all the
way through Z and then numbers and avoid
| | 06:23 | special characters.
| | 06:24 | So you can just use Trim, the Filter
function or Substitute to perform the same
| | 06:28 | task here to clean up that data
that gets entered into the system.
| | 06:32 | Another way to prevent data from
entering the system of course is in the
| | 06:35 | field Validation options.
| | 06:37 | You'll see that here under Options again,
in the second tab called Validation.
| | 06:43 | Nowthe option to choose a calculated
formula to help you validate is really
| | 06:48 | just saying use the calculation
dialog window to create a statement that will
| | 06:53 | either be true or false.
| | 06:54 | That's of course indicated by where
we have the calculation result must be
| | 06:58 | Boolean down at the bottom left-hand corner.
| | 07:00 | Now it the statement is true, then this
passes muster, and we allow the value to
| | 07:04 | be entered into the field.
| | 07:05 | If it's false, that means it doesn't
pass muster, we have to show an error and
| | 07:09 | tell the user that this is not an
acceptable entry and they have to change that
| | 07:13 | in order for the validation to pass.
| | 07:15 | So let's take a look at this technique
by applying a calculated validation to
| | 07:19 | the Phone Number field making sure that the
user enters the correct Phone Number format.
| | 07:24 | So you'll notice that we've got a
Phone 1 and users are entering in various
| | 07:30 | different formats and we
want a consistent format.
| | 07:32 | So let's say we've come up with a
series of rules where we need it to be
| | 07:36 | certain length and we need
there to be the dashes in there.
| | 07:39 | We can't have slashes all that type of stuff.
| | 07:41 | So we're going to create a
customized field validation for it.
| | 07:44 | So we go to Phone 1.
| | 07:45 | We hit Options and we don't see
anything in here that's specific to how many
| | 07:49 | dashes there should be or maybe
maximum number of characters, but not minimum
| | 07:52 | number of characters or the
exact number of characters.
| | 07:54 | So we're going to use the
Validated by calculation option instead.
| | 07:58 | So since the calculation result is
just going to be true or false, I can add
| | 08:02 | something like let's say Length.
| | 08:04 | The length of this field Phone 1 and
here I'm again referencing the field inside
| | 08:12 | the Calculation dialog
window for field options.
| | 08:16 | So I'm going to say field
Length is going to equal 12.
| | 08:20 | Now I could just leave it at this and we
can test it out here, you'll see, I say
| | 08:25 | OK, we go in and I say 1, 2, 3, 4, 5.
| | 08:28 | I click outside the field and it tells
us that something did not pass muster.
| | 08:33 | We could use a customized message there
if we'd like to, but if I go back to the
| | 08:39 | Phone Number, I can now add additional rules.
| | 08:43 | So I can say the Length of Phone 1
must be 12 and how about PatternCount.
| | 08:49 | Remember the PatternCount
function of this same field again.
| | 08:56 | Let's say we want to make sure
that there is a dash, or actually more
| | 09:03 | specifically, we want two dashes, so
let's say, =2, so we want to type in 12
| | 09:08 | characters, but we also need to make
sure that at least two of those characters
| | 09:11 | are a dash and you'll see that here as well.
| | 09:15 | So we could say 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 12.
| | 09:16 | There is 12, but still it doesn't pass
because there are no dashes in there.
| | 09:24 | So I could add a couple of more these
as well, just to kind of show you that
| | 09:28 | all you have to do is add the "and"
any time you have a Boolean like this.
| | 09:32 | I can just simply add the "and" operator
and that's the logical operator that we
| | 09:37 | see here in the middle.
| | 09:38 | And I can add as many of these as
I'd like, so another one would be the
| | 09:43 | Position of the dash.
| | 09:44 | So if we say Position, Position in Phone 1,
searchString is going to be the dash.
| | 09:54 | So we're saying not only do we need two
dashes, but they need to be in a specific spot.
| | 09:59 | So say, 1, and again 1 here, so
that position will need to be 4.
| | 10:09 | And we could actually do the same thing again.
| | 10:14 | And by the way these are pretty legit
phone formatting options, so feel free to
| | 10:20 | use this in your own databases.
| | 10:22 | But here the second occurrence, so
that's where the number 2 is there, needs to
| | 10:27 | be in the 8th position and then finally,
we'll use the Filter function to make
| | 10:33 | sure that only numbers, so
textToFilter that's going to be Phone 1.
| | 10:37 | And then the text itself will be just
012345689 and a dash of course, because we
| | 10:46 | are requiring dashes and so we don't
want to filter those out. There we go.
| | 10:50 | And that needs to equal, once we filter all that
out, that's got to equal the value in Phone 1.
| | 10:55 | So all of this we'll add and then
we could even do custom message that
| | 10:59 | explains that you need 12 characters and that
you need to have it formatted a certain way.
| | 11:04 | You could say Must Format as "XXX-XXX
- XXXX" and so, this way then the users
| | 11:18 | would get a little bit more information.
Say Ah! Yes, okay.
| | 11:21 | So here I'll say, see if that
passes, sure enough it does.
| | 11:29 | FileMaker allows you to use
calculation functions and the calculation
| | 11:32 | dialog to enforce data entry rules
and to filter data entered into a field in
| | 11:37 | the field options dialog.
| | 11:38 | And both of these techniques can really
improve the integrity of the data that's
| | 11:41 | entered into your database.
| | Collapse this transcript |
| Using calculations in the security settings| 00:00 | Another area where you'll see the
FileMaker calculation dialog is under the
| | 00:04 | Manage>Security section.
| | 00:06 | We've talked about this in the first
chapter where you can create your own
| | 00:09 | Privilege Set. One of the things
you'll notice in the Custom privileges under
| | 00:15 | either Records, Layouts, Value Lists, Scripts,
| | 00:17 | when you get down to the Custom Records
Privileges window, you'll notice that over
| | 00:23 | here on Field Access, or even Edit, or
Create, or Delete, you'll notice that is
| | 00:27 | just third option. This options called
limited. We discussed this earlier in this
| | 00:31 | course about how you can manage
View, Edit, Create, or Delete.
| | 00:34 | But there is also this option for limited.
| | 00:36 | Now if you choose limited, let's say
under Delete, you'll see that it presents
| | 00:42 | the Calculation dialog window and
this is one of those Boolean calculation
| | 00:45 | dialog window as you see in
the bottom left-hand corner.
| | 00:48 | And a common security requirement for
developers is to isolate specific records
| | 00:52 | from some users, that's pretty easy, you
can just say you can't see these or you
| | 00:56 | can't edit those or can't delete them
all across the board. Sometimes you
| | 01:00 | might want to do this in sort of a
conditional fashion. One of the very
| | 01:05 | straightforward approach is to
controlling record access will rely on
| | 01:07 | determining who the user is when they
are logged in to the database and possibly
| | 01:11 | allowing them to Edit or Delete
records that they originally created.
| | 01:16 | So for example, we have a field here,
and just to refresh your memory, we've got
| | 01:20 | the ability to Delete or Edit.
| | 01:22 | So let's say I say okay, in customers,
we don't want you to Delete or Edit
| | 01:25 | anything that you didn't create.
| | 01:27 | So I'm going to choose limited,
presents our dialog window. There's a field
| | 01:31 | in here called CreatorAccount and
this is what's commonly referred to as a
| | 01:34 | housekeeping field. If we look at
CreatorAccount, just want a quick
| | 01:40 | refresher, you'll see that it's set up
with an Auto-Enter Creation Account Name,
| | 01:46 | so whatever the user was logged in as
when the account was created that will be
| | 01:50 | the value to get center into that field.
| | 01:52 | And that will be helpful to us here,
because then we can compare that to the
| | 01:59 | account that the user is currently
logged in as, and if it's the same, then we
| | 02:02 | allow them to perform either the
Edit or Delete. It's very simple.
| | 02:06 | So this is how we would do that.
| | 02:07 | So under Customers>Limited, if the
CreatorAccount equals, then you'll see
| | 02:15 | that there is a function, actually it's
under the Get function dropdown called
| | 02:20 | Get (AccountName), really simple stuff here.
| | 02:22 | So the formula isn't that difficult,
it just says if the name of the account that
| | 02:27 | the user used when the record was
created equals the name of the account that
| | 02:31 | the user is currently logged in as in
this database session, then allow them to
| | 02:35 | perform the Edit or the Delete. I can
copy this over to delete and say OK.
| | 02:46 | So now let's try this out, we will hit
OK and so we see that that back Privilege
| | 02:51 | Set is only assigned to the Admin
Copy account, so let me log back in under
| | 02:56 | Admin Copy, first verify that I do
have Admin rights to this database.
| | 03:03 | I'm going to open the file again, but this
time I'm going to hold down the Option
| | 03:08 | key, because I am on Mac and
that will prompt the login.
| | 03:13 | Or if I was on windows I could hold
down the Shift key, so I'm holding down the
| | 03:17 | Option key, Open, and this time I'm
going to login with the Admin Copy account.
| | 03:23 | Now we see that the first record
here was created by Admin Copy, so the
| | 03:30 | CreatorAccount now equals the login
account, so that means I can click inside
| | 03:33 | this field and make a change, pretty simple.
| | 03:38 | But if I go into the next record, you
see here that was created by the admin, so
| | 03:44 | when I go in here, you'll notice that
I get the error that says Your access
| | 03:48 | privileges do not allow
you to perform this action.
| | 03:51 | The same would be true if I try to
Delete the record, and because we set up both
| | 03:55 | Delete and Edit in the same fashion.
| | 03:57 | As with all things in FileMaker Pro
there are different ways to approach
| | 04:00 | conditional record access and
each method has its pros and cons.
| | 04:03 | In this video we presented a common
technique that employs the use of the
| | 04:07 | calculation dialog to enforce
whether users can Edit or Delete a record.
| | 04:12 | You can use any calculation formula
that you wish in order to enforce your
| | 04:16 | specific business rules.
| | Collapse this transcript |
| Using calculations in conditional formatting| 00:00 | Earlier in this course we've talked
about how you can apply conditional
| | 00:04 | formatting to objects that are on your layout.
| | 00:07 | And we also showed how you can add a
formula there, but I'm going to revisit
| | 00:10 | that, because I wanted to show you
this as another area where the calculation
| | 00:13 | dialog can be used inside the
FileMaker programming environment.
| | 00:17 | Of course, as its name implies,
conditional formatting will allow you to
| | 00:21 | dynamically apply different
formatting attributes to a layout object.
| | 00:25 | And in order to really dynamically
apply those, you can use the FileMaker
| | 00:29 | calculation dialog window.
| | 00:30 | So for example, let's go back to our
Customer Details layout here. I'm in Layout
| | 00:35 | mode, so I can actually apply conditional
formatting and I'm going to go to the
| | 00:39 | Due Since field here inside the portal
and I'm going to right-click on it or
| | 00:44 | Ctrl+Click on Mac and
choose Conditional Formatting.
| | 00:48 | So here we have our Conditional
Formatting dialog. When I hit Add,
| | 00:52 | it automatically do the default, which is
the Value Is. This doesn't allow us to
| | 00:56 | invoke the calculation dialog, but if
I go Formula is, you'll see the Specify
| | 01:01 | button appear. Of course anytime
this Specify button appears that means that
| | 01:05 | we can use the calculation
dialog window to create a formula.
| | 01:10 | So I'm going to hit Specify and I'll
clear out the default items that were
| | 01:15 | presented to us there.
| | 01:17 | And of course, before I do, I should
say that you can use Value Is and there is
| | 01:21 | various different things that are
already in here, or you can just put in a
| | 01:24 | certain value and here's your logical
operator and a lot of these will work.
| | 01:29 | So you can even do ranges, greater
than, less than, that type of thing.
| | 01:33 | But if you want it to be more complex
or have more control over it, you should
| | 01:37 | use the calculation dialog window and
this way you can author whatever you want.
| | 01:41 | So let's go in here and let's say we
want the condition to say Formula is, and
| | 01:46 | what we're going to do is we're going
to say that if the -- and again this is
| | 01:50 | the Due Since field, so it's
a number of days, Due Since.
| | 01:54 | Let's apply a formula here that
indicates that this invoice is either due
| | 01:58 | or past due, so let's go in Conditional
Formatting Add change to formula, clear that out.
| | 02:05 | And so what we're going to do is, we're
going to say Get CurrentDate. So first
| | 02:09 | of all we're going to establish what
the date is right now and we're going to
| | 02:14 | say if that day is greater than the
date of the invoice, because this portal,
| | 02:21 | it's actually related records from the invoice table.
| | 02:24 | So we will say invoices Date plus (+)
there's a value in here that's called
| | 02:29 | Terms that gives us a number of days.
So if invoices Date + Terms, and of
| | 02:38 | course, if you are not familiar, what
I'm using here is a technique where I
| | 02:42 | can add a numerical value to a date
value and since FileMaker internally
| | 02:46 | stores dates as integers, as long as I
add the numeric value to the date, it's
| | 02:52 | really going to add it to the
integer represents and then it's going to
| | 02:56 | present a date value to me.
| | 02:57 | So here I'm going to say if the CurrentDate,
which also is represented internally
| | 03:02 | in FileMaker as integer, is greater
than the invoice Date + the Term integer,
| | 03:08 | then that of course means that this is past due.
| | 03:11 | So we're going to visually
represent this as red, let's say.
| | 03:14 | So that will tell us basically that
this is overdue. We want to bring some
| | 03:19 | attention to that. So really what we've
done is we've used the formula to create
| | 03:25 | the same rule or business rule using
the calculation dialog that we use to
| | 03:29 | determine whether or not an
invoice record is past due or not.
| | 03:33 | So I use the Formula, apply that here.
We see the badge appear, which indicates
| | 03:38 | there is conditional formatting applied
and now let's look at this in Browse mode.
| | 03:41 | We'll see here, well, all of
these are past due, and you'll notice
| | 03:47 | that anytime something is past
due, it's going to show up is red.
| | 03:50 | Now this one isn't due yet, and of
course, your results may differ a little bit
| | 03:54 | depending on what the current date is
when you're looking at this exercise file,
| | 03:58 | but as of the recording of this date,
this invoice here was not past due,
| | 04:03 | these three are, and you see that
represented by the conditional formatting.
| | 04:07 | So the idea is, in conditional formatting
you can use the calculation engine to
| | 04:12 | enforce either a true or false rule
within your database, of course, those are
| | 04:16 | also referred to as Boolean dialogs.
| | 04:19 | And in this case we use it to conditionally
format a field based on a formula
| | 04:22 | that we wrote that doesn't necessarily
reference the field that we're
| | 04:25 | applying the condition to.
| | 04:27 | So if you really want your formatting
rules become more sophisticated, then
| | 04:30 | you're going to want to become more
familiar with calculation functions.
| | Collapse this transcript |
| Using calculations in tooltips| 00:00 | Adding a tooltip to layout object is a
quick and easy way to provide help or
| | 00:04 | tips or some additional
information to your users.
| | 00:07 | It's most commonly applied to
layout objects like buttons.
| | 00:11 | For example, if we go into Layout mode
and I select this button, you'll see that
| | 00:18 | under the Position tab in the Inspector,
and of course, if you can't see the
| | 00:22 | Inspector, you can go under View>Inspector
or choose Opt+I or Ctrl+I.
| | 00:27 | I can simply type in some information like
Create Invoice and when I save that and go
| | 00:35 | into Browse mode, you'll see that
when I hover over the button, up pops a
| | 00:40 | little yellow tooltip called Create
Invoice, just some raw text information.
| | 00:43 | And what you might not know is that you
can also use the Calculation dialog to
| | 00:50 | show more dynamic information when
users hover over a layout object.
| | 00:55 | So for example, we've got a portal here that
shows all the related Invoices to this Customer.
| | 01:00 | So we are in the Context of the Customer
Table, as you see here, and then this
| | 01:05 | portal will show Invoices only related to this customer.
| | 01:09 | If we take a quick look here at the
Relationship graph, so here's where we are
| | 01:15 | on this layout. We are looking at
a portal with related Invoice records.
| | 01:21 | So here's one Customer as many
related Invoice Records, and each of those
| | 01:25 | Invoice records also have multiple
ProductInvoice items on them.
| | 01:29 | So it might be interesting for us to
see all the different ProductInvoice items
| | 01:34 | that are on an Invoice without
leaving the context of this layout.
| | 01:38 | So of course we can drill down through
those if we want, or we could maybe add
| | 01:43 | a calculated tooltip that allows users
hover over an Invoice portal row and see
| | 01:48 | all the different items on that Invoice.
| | 01:52 | Now the ProductsInvoices line Item
table only contains foreign key values and
| | 01:57 | does not actually contain
the name of the products.
| | 02:00 | So really what we would have to do is
show a list of related products items,
| | 02:05 | would give us a return delimited
index of all the individual products that
| | 02:10 | appear on an Invoice.
| | 02:11 | So a quick idea of what we
are going to be doing there.
| | 02:14 | So in this exercise file there is
actually little icon here, you'll notice that
| | 02:18 | when I click over this icon, it covers
the whole row, well there are some other
| | 02:22 | formatting that is applied to that icon.
| | 02:25 | So let's use that to be the layout object
that we are going to apply the tooltip to.
| | 02:29 | So we go in here little bit of
inconsistency in the FileMaker UI. I've
| | 02:34 | mentioned thus far in the course that
anywhere you see the specify button, then
| | 02:37 | you can invoke the FileMaker Calculation
dialog window, but here in the New
| | 02:42 | Inspector there is a pencil icon,
that means the same thing.
| | 02:46 | So anywhere you see the specified
button or a pencil, as you can see invokes
| | 02:51 | the Specify Calculation dialog window.
| | 02:54 | So what I am going to do is I am going
to use the List function that we covered
| | 02:58 | earlier in this course and the List
function of course will provide a return
| | 03:02 | delimited list of values.
| | 03:03 | As we discussed earlier in the
course, if I put a related field as the
| | 03:07 | parameter inside the List function,
it'll show me a return delimited list of
| | 03:11 | all the related values.
| | 03:12 | So remember a portal row is
actually the context of whatever table it is
| | 03:15 | that we are viewing.
| | 03:16 | So really what we are talking about
is, I am in the context of an Invoice
| | 03:20 | Record and I want to see
related records from there.
| | 03:23 | So that's really what I'm doing here.
| | 03:25 | So I don't want to pick a related
field from customer, because that's the
| | 03:28 | parent of the Invoice.
| | 03:29 | I don't want to pick a related field
from the Invoices table, because that's
| | 03:33 | actually what record we are looking at.
| | 03:35 | Instead I can pick ProductInvoice, I
would need to show the Item, but the Item
| | 03:40 | information doesn't exist on ProductInvoice.
| | 03:41 | So I am going to pick Products,
where we actually do have the Item
| | 03:45 | information. I'll double-click on Item,
pretty simple formula List, and then
| | 03:49 | show the Products and what I am
going to do is I am going to add Return
| | 03:54 | character and some text.
| | 03:58 | We can also show the person who Created this,
of course, that'll be back up in Invoices.
| | 04:04 | So here's CreatedBy, this shows the
list of the products in the Invoice record
| | 04:09 | in the portal, and then also show
who wrote up or created that record.
| | 04:12 | Let's take a look at this in Browse mode.
In this particular case what we
| | 04:16 | will do is hover over the icon.
| | 04:19 | So if I leave the hand over the icon,
I see that I've got a Performance Tune
| | 04:23 | Up, a Bike Helmet, Accessory Kit, Unisex
Sunglasses, and this one was written up
| | 04:26 | by a user Michael Gonzalez.
| | 04:28 | And then when we hover over the next one,
we see there is Men's Mountain Bike,
| | 04:31 | Portable Pump, Created By Admin,
and so on so, you get the idea.
| | 04:34 | So we can use the Calculation dialog in
the tooltip to show dynamic information.
| | 04:38 | Couple quick things on tooltips,
if you are going to use this, you
| | 04:42 | should know that the formula is evaluated at
the time that the user triggers the tooltip.
| | 04:46 | So if I'm hovering over this and
the value happens to change, it is kind
| | 04:50 | of temporarily stored, but that shouldn't
affect this technique that we talked about here.
| | 04:55 | The tooltip won't display if all the
Calculation returns as an empty string, it
| | 04:59 | just won't pop anything up.
| | 05:01 | Tooltip text wraps automatically if it
exceeds 40% of the Width of the screen.
| | 05:06 | If your screen is very small, the tooltip
will exceed 40% of the Width, it'll then wrap.
| | 05:11 | So it might kind effect way that
your calculated information is being
| | 05:14 | displayed. Calculation formulas
used in tooltips evaluate from the table
| | 05:18 | occurrence context of the current layout,
or in our case, the Table Occurrence
| | 05:23 | Context of the portal row.
| | 05:25 | So keep that in mind, if we've
applied a tooltip over here on the left,
| | 05:29 | this would be customer contacts,
but here it's the Invoice contacts, so
| | 05:33 | that's something to remember when
you're using related values in your
| | 05:36 | Calculations formulas.
| | 05:37 | And things like text formatting,
like color, font size, and style, bold,
| | 05:42 | and italic that type of thing will not be
displayed in a tooltip, it's just raw text.
| | 05:46 | So you might want to think of things
that might be useful to see that don't
| | 05:50 | require bulleted lists, or
formatting or different things like that.
| | 05:53 | But the takeaway here is definitely,
like in many other areas inside FileMaker,
| | 05:56 | if you use the Calculation dialog
and all the formulas of the Calculation
| | 06:00 | engine inside your tooltips, you
can do some really compelling dynamic
| | 06:04 | information as you roll over layout objects.
| | Collapse this transcript |
|
|
5. Calculations: Working with Aggregate FunctionsWorking with calculation functions and related fields| 00:00 | As the name implies, aggregate functions
in FileMaker Pro Calculations are used
| | 00:05 | for calculating various
summarizations of sets of data.
| | 00:09 | So for example we can look at
what our options are if we go
| | 00:12 | into Manage>Database.
| | 00:15 | Say for example that we want to change
the Total Invoices Paid from a Number
| | 00:19 | field that requires us to enter data
into it, into a Calculation field that
| | 00:23 | will dynamically update this information.
| | 00:25 | So let's do that, let's change our
Calculation and hit Change, say OK.
| | 00:30 | This allows us to look over here in
the upper right-hand corner at the
| | 00:33 | Aggregate Function options.
| | 00:35 | You'll notice that we can average
a set of Data, Count a set of data;
| | 00:39 | we've already seen List, a Return to
Limited List of data, in some of the other
| | 00:44 | exercises in this course.
| | 00:46 | Max or Minimums, and a very common one
is Sum, and some of the other ones that
| | 00:50 | are not quite as common, but also
available to you if you need it.
| | 00:54 | Now when you choose one of these
functions, you'll see that it has at least one
| | 00:59 | parameter that's required and that's a
field. What these brackets mean
| | 01:03 | here is that you have optional parameters.
| | 01:04 | So what you do is you could list values.
For example, we can say Sum, and then
| | 01:10 | put a bunch of values together.
| | 01:11 | But this really wouldn't make sense.
It's kind of the native use of an aggregate
| | 01:15 | function, but it's not very likely
that this would be useful for you, because
| | 01:19 | here you just be adding up all the numbers once.
| | 01:21 | So this would result in number four for
every record in our database, not very useful.
| | 01:25 | Or we could put a bunch of
different fields inside the Sum function.
| | 01:30 | For example, Tax Rates, Unpaid Invoices
that type of thing, but this also isn't
| | 01:37 | very useful as far as a Calculation
function is concerned, because we could just
| | 01:41 | create a function that says Add
Tax Rates to Total Invoices Unpaid.
| | 01:44 | So really where aggregate functions
are the most useful and they are very
| | 01:49 | common in this regard, is when you use
the aggregate function to reference a
| | 01:53 | related field as the parameter for the
function, just a single related field.
| | 01:57 | This is much like what we've been doing
in the List function where we just put
| | 02:00 | one single related field.
| | 02:02 | But just as a reminder, I am
defining this field inside the context of
| | 02:06 | customers, and if we do a quick look at
our Manage Relationships, we see that we
| | 02:10 | are in the Customers Table.
| | 02:12 | And in order to be able to use a
related field in the Calculation, that related
| | 02:16 | field in this case would have to be
coming from the related child table, because
| | 02:21 | otherwise we won't have many of any
value to aggregate, it would just be one
| | 02:26 | value if it's coming from the parent.
| | 02:28 | So here, since we are defining the
Calculation in the parent, let's pick one of
| | 02:33 | the numeric values from the child
Invoices Table and Aggregate them.
| | 02:37 | So let's say we want to summarize,
see what our options are here, and we
| | 02:42 | say, since this is Total Invoices Paid, let's
go to the relationship that is Paid Invoices.
| | 02:48 | And by the way, we will be covering this
later in the course in the Relationship
| | 02:51 | chapter and how we created those.
| | 02:53 | But for now, what you should know is
that this relationship will filter out only
| | 02:56 | Invoices with the status of Paid.
| | 02:59 | So we want to summarize let's say
Grand Total, pretty simple, keep that as a
| | 03:06 | Number and let's take a
look at what we get here.
| | 03:08 | So we'll say OK, we'll say OK again.
| | 03:11 | And if you notice in Layout mode, you'll
see that we already have a merged field
| | 03:15 | with some formatting that displays that value.
| | 03:17 | So if we go back into Browse mode, we
don't have to save it, you'll see that it
| | 03:22 | is summarizing only the records that have Paid.
| | 03:24 | So those are the ones that are
showing up in this portal down below.
| | 03:28 | So here we see there is None that are Paid.
| | 03:30 | But on the very first record, there was
one that's Paid and it shows that Total.
| | 03:34 | Now you'll notice though that if there
aren't any, it doesn't shows 0, it just
| | 03:38 | shows the dollar sign ($) and that
might be kind of confusing to users.
| | 03:41 | So instead what we will do is use
the If function to say, if there are no
| | 03:51 | values, just put some 0.00 in there,
but if there are values, then
| | 03:55 | actually summarize them.
| | 03:57 | So in order to do that we will introduce
the If into our Calculation formula.
| | 04:02 | Let's use another Aggregate Function as our test.
So here Aggregate, let's Count.
| | 04:08 | So let's say if we Count up all the
nonempty values in the Paid Invoices, so
| | 04:14 | we know that each will have a primary key,
so let's count up all those nonempty ones.
| | 04:18 | So if we say this is greater than > 0,
then perform this Calculation, otherwise,
| | 04:23 | just show some text of 0.00.
| | 04:28 | Now in this case, one of the outcomes
of this could be driven by the fact that
| | 04:34 | the values are empty, the values
that we are counting would be empty.
| | 04:37 | So that's why we have to turn off this
Do not evaluate if all referenced fields
| | 04:41 | are empty option, which is a default
on every calculation and it's very rare
| | 04:44 | that you have to turn it off.
| | 04:46 | But anytime your Calculation could
potentially evaluate empty values, which
| | 04:49 | we're doing here, in the case of Count
equaling zero, we want to turn that off.
| | 04:55 | So let's turn that off and now we
see in all the portals that don't have
| | 04:59 | any Paid Invoices it just shows up as 0,
and the ones that do, it gives us our total.
| | 05:05 | Now we can also go and take that same
formula, copy that and we can change the
| | 05:13 | Total Invoices Unpaid to a Calculation as well.
| | 05:17 | And I'll show you with a slight change
instead of Paid Invoices for the Count,
| | 05:23 | we will say Unpaid Invoices, pick the same field.
| | 05:26 | Instead of Paid Invoices in the Grand
Total we will pick Unpaid Invoices, Grand
| | 05:31 | Total and now you'll see those values appear too.
| | 05:35 | So now we can see the Total of the
Unpaid Values as we go from record-to-record.
| | 05:39 | You'll also notice that inside this
database there's a series of other
| | 05:44 | Calculations already created using
the aggregate functions like the List
| | 05:48 | function that we used earlier in the course.
| | 05:50 | And here's one that's counting up
all of the different Invoices, here's
| | 05:53 | one that's showing a count of all the Paid
Invoices, a Count of all the Unpaid Invoices.
| | 05:58 | So really what those are examples
of are some very useful uses of the
| | 06:01 | Aggregate Function.
I would go so far as to recommend
that any layout that has a portal in it,
| | 06:07 | should have at least one field that's
aggregating the data that's in the portal.
| | 06:10 | This can be very helpful to your users,
because you're displaying a bunch of
| | 06:14 | related values that
change from record to record.
| | 06:17 | And it's very useful from a User
Interface standpoint to have the users not
| | 06:21 | have to count all these up or total all
these values up. Maybe above the portal
| | 06:25 | or below the portal like we've done here, just
show the totals or the counts or whatever it is.
| | 06:30 | You can use Count, Sum, Average,
Minimum, Maximum, that type of thing.
| | 06:33 | So since aggregate functions
reference related fields, they can be really
| | 06:37 | useful companions to portals on
layouts based on parent tables.
| | 06:40 | Of course, parent tables are the ones
that have portals, because otherwise
| | 06:43 | portal won't show any related values.
| | 06:45 | And again, I'd go so far as to recommend
that any layout with a portal on it
| | 06:49 | should have at least one field
aggregating the related data.
| | Collapse this transcript |
| Comparing aggregate functions to summary fields| 00:00 | Just a quick note on aggregate functions
versus a type of a field called the summary field.
| | 00:05 | I get a lot of questions about what
the differences between those two things
| | 00:08 | are, because they do have some similar syntax.
| | 00:11 | As a reminder you look at a aggregate
function used in a calculation, you'll
| | 00:18 | see that our Options are things like
Averages, Counts, Lists, Max, Min, Sums
| | 00:24 | that type of thing.
| | 00:25 | And in a summary field, which you can
see we've got a summary field up here,
| | 00:29 | CustomerCountSummary, you'll notice
that's a different type of a field
| | 00:33 | completely and the Options are very
similar Totals, Average, Count, Minimum,
| | 00:37 | Max, Standard Deviation, Fractions and so on.
| | 00:40 | So what are the differences?
| | 00:42 | Well they are very specifically
different in their application.
| | 00:44 | I want to show you an example of
where the summary field is used.
| | 00:48 | If we click over to the Customer List
view, you'll notice that that same summary
| | 00:52 | field that we just looked at in Manage
Database is up here in the top of the
| | 00:55 | screen and it's instructed to
count all the customer records.
| | 00:58 | Right now we've got all 1535 records
showing, so no coincidence the value
| | 01:04 | inside that field is 1535.
| | 01:06 | However, if we go and search, you'll
notice that our Found set has changed to 76
| | 01:13 | and so has the value in the summary field.
| | 01:16 | So to sort of add some clarity there,
summary fields are very specific in their use.
| | 01:22 | They are only there to
aggregate against Found sets.
| | 01:26 | So of course this user experience
will change depending on whose logged
| | 01:30 | in to your database.
| | 01:32 | On the network, if I'm logged in and
I search for California, I'll see 76,
| | 01:36 | but if another user is logged in and they
search for Idaho, they might see another number.
| | 01:40 | So the summary fields are session specific
and they are specific to the Found
| | 01:43 | set that that user is working with.
| | 01:45 | Whereas aggregate functions are a
function inside of a calculation field, and
| | 01:52 | although they sound like they're doing
the same thing, they are aggregating
| | 01:57 | only related values.
| | 01:59 | So aggregate functions deal with sets
of related values and aggregate summary
| | 02:05 | fields deal with Found sets or values
across a Found set, so that's just a
| | 02:10 | simple rule to keep in mind.
| | 02:11 | So again, the rule to remember is that
aggregate functions are primarily used to
| | 02:14 | summarize related values in
the context of a parent table.
| | 02:18 | And summary fields are used primarily to
aggregate Found set values across Found sets.
| | 02:24 | Both can summarize Count, Average and
determine a Minimum and Maximum,
| | 02:28 | but they shouldn't be confused with each other.
| | Collapse this transcript |
|
|
6. Advanced Reporting OptionsReviewing subsummary reports| 00:00 | One of the key features in FileMaker Pro
is its powerful reporting capabilities.
| | 00:04 | As a developer you can use these
capabilities to create reports that allow users
| | 00:08 | to better understand and analyze the
data that's being stored in your database.
| | 00:12 | An effective report could be anything
from let's say a list of something with
| | 00:18 | information displayed on it or as we
looked at here we could have a spreadsheet
| | 00:27 | looking view of something and possibly
with some aggregate information, maybe
| | 00:30 | through some charts on it, whatever
kind of information might be useful to you.
| | 00:34 | But you'll notice as you open up the
exercise file here, it's going to go to a
| | 00:39 | layout that's called Invoices SubSummary.
| | 00:41 | FileMaker has a unique tool that's
called a SubSummary part of often referred to
| | 00:45 | as SubSummary reports that combines
together a list of information into groups.
| | 00:51 | So you can see here, it's a lot easier
for us to look at these invoices when
| | 00:55 | they're grouped by the different customers,
because this can give us information
| | 00:59 | not only about who the customers are,
makes it more visually easy to discern
| | 01:03 | when one customer ends and the other
begins, but also we can use totals.
| | 01:07 | So let's take a look at what makes this work.
| | 01:09 | If we go to the Invoices SubSummary
layout and check it out in Layout mode,
| | 01:14 | you'll see over here on the left-hand
side and let me open that up a little bit,
| | 01:19 | I clicked on the bottom left-hand corner
here to reveal the names of the parts,
| | 01:23 | you can also go under Part Setup to
see the different parts of the layout.
| | 01:28 | And up until you create reports you are
probably only dealing with Header parts,
| | 01:31 | Footer parts, Body parts.
| | 01:33 | But what I wanted to show
you is these SubSummary parts.
| | 01:36 | If you double-click on it you'll see
the part definition dialog pop-up.
| | 01:40 | You'll see that this part, it's called
SubSummary when sorted by and I picked a
| | 01:44 | certain field from either this
table or one of the related tables.
| | 01:48 | Now what that means is that I've just
given FileMaker the instruction to group
| | 01:53 | my list view by this field
that we call the break field.
| | 01:57 | So then in this case we're looking at
SubSummarys when sorted or grouped by a
| | 02:03 | company name and that's what we
see when we go into Browse mode.
| | 02:06 | So that's why we see all the company name here.
| | 02:08 | Now the key is I have to actually
sort these by the company name.
| | 02:12 | I can pick some sort of secondary sort value;
| | 02:14 | you see here the Date field, so you
know it goes for the ascending order of
| | 02:19 | dates after we've grouped it by the customer.
| | 02:22 | So a combination of setting up a SubSummary
part and then sorting by that field
| | 02:28 | that we configured in the part.
Then also another element that we're
| | 02:31 | employing here, we go into Layout mode
is that on the second SubSummary part or
| | 02:37 | even on the initial SubSummary part
we're putting a field on here and here this
| | 02:40 | one is called Grand Total Summary.
| | 02:43 | If I go into Manage Database you can see Grand
Total Summary is what's called a Summary field.
| | 02:48 | A Summary field is a field that's set to
aggregate values across a found set.
| | 02:53 | The interesting thing here when you are
using SubSummary part in your layout,
| | 02:57 | is that it's creating mini found sets.
| | 03:00 | So I'm not only visually grouping the
data, which is very useful, but I can use
| | 03:04 | SubSummary fields to aggregate
data across those mini found sets.
| | 03:10 | In fact a single summary field
can be placed on the same layout in
| | 03:13 | several different parts.
| | 03:14 | So for example I could place it in the
SubSummary part like I mentioned here or
| | 03:20 | I can copy it, put it up in the header
and we can see in Browse mode.
| | 03:26 | When I save that, that same field is
now aggregating or giving us a sum across
| | 03:31 | the entire found set of 25 orders.
| | 03:34 | And then that same field when
referenced in a different part, in this case the
| | 03:37 | SubSummary part is aggregating across
the mini found sets, very useful there.
| | 03:41 | And the final component of a SubSummary
part in review is that to guarantee that
| | 03:47 | this report always shows up
sorted or grouped in the right order.
| | 03:51 | You'll notice here that if you look
very closely there is a little badge there
| | 03:55 | that indicates that we've got a
Script Trigger assigned to this layout.
| | 03:59 | So when a layout is entered, we can see
that there is a script here called Sort
| | 04:04 | Invoice List for SubSummary and if we
hit Edit on that, we can see that that is
| | 04:09 | sorting by the break field
and then the secondary field.
| | 04:12 | So the combination of a SubSummary
part that groups your data and summary
| | 04:19 | fields that aggregates the data
across found set and those mini groups and
| | 04:24 | adding a little bit of user-interface
assistance there with the Script Trigger
| | 04:27 | to ensure that that layout always
looks grouped are what we call, when they're
| | 04:32 | put all together, a SubSummary report.
| | 04:34 | This is a very common way
to report inside FileMaker.
| | 04:38 | And if you're familiar with these
or if you're working with them and
| | 04:41 | integrating them into your database,
you can add charts to them that also
| | 04:44 | summarize against groups.
| | 04:45 | but, sometimes you might run into
trouble like, it looks like it's a list view,
| | 04:48 | so in that case you need to make sure
that you are sorting by the break field, or
| | 04:52 | make sure the data has been entered
consistently like for example, if you have
| | 04:56 | some invoices have Bye space Ink
instead of Bye, space Ink, they'll show up as
| | 05:02 | two different groups here,
that's a very common issue.
| | 05:04 | So you can resolve that issue by
properly relating all your tables together or
| | 05:08 | providing user data entry assistance
by doing things like dropdown menus and
| | 05:12 | stuff like that for fields that
will ultimately be the grouped fields.
| | 05:16 | You can also put any other
field other than a summary field
| | 05:19 | maybe in the wrong part if you put a
summary field in the body part instead,
| | 05:23 | then every single record
will have the same values.
| | 05:25 | So those are just some of the common gotchas.
| | 05:27 | But again, combining SubSummary parts
on your layout with summary fields and
| | 05:31 | even some script triggers to do the
sorting, we'll give you very familiar
| | 05:35 | grouped report inside FileMaker.
| | 05:38 | And it is one of the more powerful
and useful capabilities in FileMaker Pro
| | 05:42 | allowing you to display it in this way.
| | 05:44 | And the skills needed for creating
successful reports include things like
| | 05:47 | defining the proper fields,
developing the layouts and defining calculation
| | 05:51 | formulas and doing some scripting.
| | 05:52 | So in short, it requires a combination
of several skills that are reviewed in
| | 05:57 | this movie but if you want to refresher
you can go back and look at the chapter
| | 06:00 | on reporting in the
FileMaker Pro 12 Essential Training.
| | 06:04 | We're going to use some of these
concepts moving forward in the rest of the
| | 06:08 | movies in this chapter.
| | Collapse this transcript |
| Creating subsummary ranking reports with no body part| 00:00 | Once you become proficient with
creating basic SubSummary reports in
| | 00:03 | FileMaker, you can then progress on to
creating reports that are a little bit more advanced.
| | 00:08 | In this movie I am going to cover a
really useful variation on the basic
| | 00:12 | SubSummary report. Specifically, I
am going to show you how to create a
| | 00:16 | SubSummary report that doesn't contain
a body part and then therefore it allows
| | 00:19 | you to rank the data rather than
group it just by this break field and then
| | 00:23 | show details about it.
| | 00:24 | So in a basic SubSummary report like
you're seeing on screen. It can contain
| | 00:28 | Summary 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:37 | that are grouped and have
their individual order summary.
| | 00:40 | Now it might have been useful when we
first created this layout to show the
| | 00:44 | details of all of the individual Invoices.
| | 00:46 | But let's say for instance we just
want to see a list of customers with
| | 00:51 | their total and maybe possibly then
rank them by that total, so we can get
| | 00:55 | sort of ranking report.
| | 00:56 | So why don't we go ahead and do that.
| | 00:58 | First we'll go into Layout mode and as
is always best practice, why don't we
| | 01:02 | Duplicate the existing layout
instead of modifying the original one.
| | 01:06 | So you can see here if we click on the
little pencil icon, we can call this one
| | 01:12 | No body Part . The first thing that
we're going to do and it might seem a
| | 01:20 | little bit radical, but we are
going to delete the body part.
| | 01:21 | So I can select the body part, you see
it's darkened there as I hover over body
| | 01:26 | part, I'll just hit the Delete key on
my keyboard and I will confirm that in
| | 01:29 | fact I do want to delete that body part.
| | 01:31 | It seems kind of crazy, but it
will serve our purpose as well.
| | 01:35 | So here I'll get rid of some of the formatting
and move the Grand Total Summary
| | 01:41 | up into this one single body part.
| | 01:42 | So now I've still got the one SubSummary
Part sorted by company and that's a
| | 01:46 | company field that I put on that same
part and now the Summary field and I'll
| | 01:51 | also make some formatting changes.
| | 01:54 | So let say instead of a Fill we'll just
make all of these sort of uniform, make
| | 02:01 | these 12 pt non Bold, and we'll
keep this one Bold. How is that?
| | 02:08 | And sort of make them the same size
and invoke that Inspector again by doing
| | 02:14 | Ctrl+I or Opt+I and doing just
some quick formatting, not germain to
| | 02:19 | that what we're talking about here,
but we want things to look nice, so let's
| | 02:23 | select this, move those up to the
top a little bit and shorten out those
| | 02:28 | rows, pretty simple.
| | 02:30 | We still have the Script Triggers assigned
here on Layout enter and if we look
| | 02:37 | at what that does, you see it's just a
simple sort and it's sorting by the break field.
| | 02:42 | We can say OK, OK, OK and then back
and let's take look at in Browse mode and
| | 02:47 | see what we've got here.
| | 02:49 | So by simply just removing the body
parts, now we see that we've got a
| | 02:53 | somewhat compelling list.
| | 02:55 | Actually let's get rid of the second
summary part, I failed to mention that.
| | 03:00 | So now in Browse mode we see we have a nice
type list of all the customers and their totals.
| | 03:06 | Now the interesting thing about this
is that the context of this layout is
| | 03:09 | not the Customer table.
| | 03:12 | Say for example we don't have a field
inside the Customer table that aggregates
| | 03:16 | all the related Invoices.
| | 03:17 | The thing that's most interesting
about this is that this total that you're
| | 03:20 | seeing here is actually the total for
all of the orders in this found set.
| | 03:26 | So you see the number up here 25,
that's not 25 Customers, it's actually 25
| | 03:30 | Invoices in this found set.
| | 03:32 | As a matter of fact if I went into Invoices
and may be performed a search, let's
| | 03:40 | go to invoice date here we go and just do 2010.
| | 03:45 | So I got five of those 25, now I go to
that same layout and you see that now
| | 03:51 | I've got fewer records.
| | 03:52 | So what this means is that the value
that you see over here in the right-hand
| | 03:55 | column can be found set specific, which
is nice, because you can present this to
| | 03:59 | the user, you can allow them to navigate
over to this layout from other layouts
| | 04:03 | like the one I showed you before.
| | 04:04 | Or they can do their own searches and
come here, so it's not only a ranking
| | 04:08 | report, but it's a user driven ranking
report where they can come up with any
| | 04:12 | customized found set and it
will reflect those values here.
| | 04:15 | Now it's not truly a ranking report though.
| | 04:18 | In that, when we look at all the
records and sort by the break field, it just
| | 04:23 | sorts them alphabetically.
| | 04:24 | So the idea here would be probably be
useful, yeah we don't need date in this
| | 04:29 | case, if I could sort by the
Grand Total Summary value instead.
| | 04:33 | But of course the rule for a SubSummary
part in FileMaker is that that always
| | 04:38 | needs to be the first sort value.
| | 04:40 | So the break field that we used when we
set up the SubSummary part needs to also
| | 04:44 | be the first sort value in the Sort Order
window that we see here and what's
| | 04:49 | interesting though is this option right down here.
| | 04:52 | So instead we can keep that Sort as it
is to satisfy the rule that we need to
| | 04:56 | group these values, but I can check
the reorder based on Summary field option
| | 05:01 | that you see here, which will do just that.
| | 05:03 | It will sort and therefore group, but
then it will reorder these values by any
| | 05:09 | one of the summary fields that are
defined here and we only have one Summary
| | 05:13 | field defined that's why the rest of them are gray.
| | 05:15 | Now you'll see that that icon changed a
little bit indicating that there is some
| | 05:19 | grouping going on there and we see the
Grand Total field, grand Total Summary
| | 05:22 | field indicated, I say Sort and now
we notice that it's sorting in reverse
| | 05:27 | order, but I can just select Descending order.
| | 05:30 | And now sure enough, we have a ranking
report, it gives us a sort of an index
| | 05:36 | list of only the customers in the found
set that are reflected in the found set,
| | 05:40 | in this case it's all records in the
found set and then it gives us a total
| | 05:44 | based on whatever found set it was
created and then ranks them based on that
| | 05:48 | even though it is still a SubSummary part.
| | 05:50 | And so this technique is commonly
referred to as a ranking report when building
| | 05:55 | reports in FileMaker.
| | 05:56 | So once you become proficient with
creating basic SubSummary reports you can
| | 05:59 | progress into creating reports that are
a bit more advanced like this one here,
| | 06:02 | where we show a variation on the basic
SubSummary report in order to be able to
| | 06:07 | present a user driven or found set driven
ranking list of customers and invoices
| | 06:13 | and their summary values.
| | Collapse this transcript |
| Nesting multiple groups in reports| 00:00 | One of the things I want to emphasize
when you're planning your SubSummary
| | 00:03 | reports is that one single layout in
a FileMaker database can be used to
| | 00:08 | create multiple reports.
| | 00:10 | What I mean by that is that a layout
can display fields in a certain format.
| | 00:15 | So you go in and you design your layout
with these fields and put them in a certain
| | 00:18 | order, but especially when you've got
SubSummary break parts inside of that
| | 00:22 | layout that you have designed, you can
send different found sets over to the
| | 00:26 | report and therefore come
up with different reports.
| | 00:28 | Many times when I am creating reports
for clients, they will say things to me
| | 00:32 | like oh, in this format I'd like to
have a weekly report, a monthly report, a
| | 00:36 | yearly report and maybe a custom date range.
| | 00:38 | Now that could seem like it's many
different reports and then you might think
| | 00:42 | oh I need to go create many different
layouts in FileMaker, but the reality of
| | 00:45 | it is that's one single layout, but you can
feed it all sorts of different found sets.
| | 00:50 | So the most poignant example of that,
I could show you here is that if I go
| | 00:55 | into Invoices and again we'll search
for 2010, you can see that's only five
| | 01:04 | records out of 25, I go back to my
SubSummary report, we could call this for
| | 01:09 | example the 2010 sales breakdown report
or the user driven breakdown report or
| | 01:16 | I could even do a search by a certain
type of a customer, for example, let's
| | 01:21 | say, all paid invoices and I still
feed it to the same layout, sorted by the
| | 01:31 | break field and now all of a sudden
this same layout becomes the Paid invoice
| | 01:35 | breakdown or Unpaid breakdown.
| | 01:37 | So hopefully, that makes sense because
it can really be very efficient then in
| | 01:40 | that case, you create one layout and
instructor users to feed it different found
| | 01:44 | sets or create a workflow in your
layout that feeds it different found sets.
| | 01:48 | Now in the example that I am showing you,
we have all sorts of different found
| | 01:52 | sets, but they would all be grouped
and sorted by the same break field.
| | 01:56 | Nowin this movie I want to show you
a new technique where one single layout
| | 02:00 | could be grouped potentially by
multiple combinations of break fields, all
| | 02:02 | triggered then by a different sort order.
| | 02:04 | So let's jump right into it, let's go
into this exercise file and you see I have
| | 02:08 | got the Invoices SubSummary. Let's go
into Layout mode and let's create a new
| | 02:14 | layout and rename it and this one we
are going to call Nested and we hit OK.
| | 02:24 | It's got all the same components of
the original layout, we've got the
| | 02:26 | SubSummary part and the header in the
body and even a footer in this case.
| | 02:32 | So our goal here is that we're going
to create one layout that our users can
| | 02:36 | create found sets and then send
those found sets here and then give them
| | 02:39 | additional power to change what the
layout looks like when they generate it,
| | 02:43 | print it off or PDF or even look at
it on screen, by allowing them to then
| | 02:47 | include not only found sets, but the
sort to change or manipulate what this
| | 02:51 | one layout looks like.
| | 02:52 | So in order to do that, right now
we have only got one SubSummary part;
| | 02:56 | we are going to add some
additional SubSummary parts.
| | 02:58 | The way we can do that is go under Layout to
Part Setup and I can just simply hit Create.
| | 03:03 | So let's pick SubSummary part when
sorted by and in this case, I am going to go
| | 03:09 | to Payment Status, so Paid or Unpaid
and I am going to hit OK and I am going to
| | 03:14 | put that one below the existing SubSummary part.
| | 03:19 | So we have got one that is a SubSummary
by Company, I have got another one
| | 03:23 | below it, currently it doesn't have
any fields in it, but it's a SubSummary
| | 03:26 | by Payment Status and now I am going
to add a third one that is a SubSummary
| | 03:31 | by let's say Shipment Status, also print that
below and we'll have them sort of cascade here.
| | 03:39 | So now, I'm done.
| | 03:42 | What I have done here is I have
created three cascading SubSummary parts.
| | 03:45 | I can choose to sort by any one of them
or a combination of them, but first I am
| | 03:50 | going to do some quick layout changes
here. So why don't we make the fill colors
| | 03:55 | a little bit less dramatic and I'll share the
Grand Summary with each one of the
| | 04:02 | summary parts, make sure that looks
good, line it up. In this case, I am
| | 04:08 | going to copy the second one here and
just as a reminder, we've got the Payment
| | 04:15 | Status so let's say Payment Status,
maybe make that bold, change the fill just a
| | 04:23 | tad here, make that transparent.
Then now on this last one I am going to
| | 04:30 | indent it just a tad and I am
going to say Shipment Status.
| | 04:36 | So all I have really done in this case is,
let's make these a little bit more contrasted.
| | 04:44 | Okay, so all I've done here is I've
added two new SubSummary parts to the
| | 04:51 | layout, I've ordered them stacked on
top of each other and I know that there
| | 04:55 | happens to be values that are in these fields.
| | 04:58 | So now what I can do is I can go into
Browse mode again, save the changes that
| | 05:05 | I've made, show all my records and now
I am going to do a custom sort, so I am
| | 05:11 | going to say Sort, I am going to leave
the Company field and I am going to sort
| | 05:15 | them in the same cascading
order that I did when I set them up.
| | 05:19 | So I'll do Company, then Payment Status,
then Shipment Status.
| | 05:21 | So what you're seeing here is that if
you have multiple SubSummary parts on the
| | 05:24 | same layout, I can still trigger those
groups, so groups within groups as long
| | 05:30 | as I'm cascading the sort order.
| | 05:32 | So remember, sorting by what's called
the break field is what groups in the
| | 05:36 | first place and if I want to group
within groups, I have to just cascade the
| | 05:40 | sort, so let's see what that looks like first.
| | 05:42 | So we do sort, and we get sort of an
interesting effect here, we've got the name
| | 05:47 | of the customer and then and within
the Customer, here are some that are
| | 05:50 | processing, we got none that are paid,
we have got Shipped, so on and so on, so
| | 05:55 | here is one that's a little bit more dramatic.
| | 05:57 | So we have got Lightningfast Racing Company
and how many Paid invoices do they have?
| | 06:02 | Well, they've got two of them and those
are two invoices that both have the same
| | 06:06 | shipping status as Shipped.
| | 06:07 | So we've got name of customer, the
Payment Status and within the Payment Status
| | 06:12 | we are breaking them down by shipping status.
| | 06:14 | Here is another one that's a
little bit more exploded out.
| | 06:16 | We see Unpaid, it gives us a total of $944.87
and within Unpaid we've got two of
| | 06:21 | them that are pending, and we see that
value $729.94 and we also have one that's
| | 06:26 | processing, $214.93, those together
give us $944 and those combined together
| | 06:31 | with all the Paid ones give
us a Grand Total of $1,672.06.
| | 06:34 | And so same thing as before, we can go
in and allow our users or instruct our
| | 06:40 | users to search for just certain found
sets and then feed it to our new report.
| | 06:49 | The more data you have, the more
you are going to see that breakdown, but
| | 06:52 | here we would go in and sort by Payment
Status, then Shipment Status, just like
| | 06:57 | we did before and we see
how it would break down.
| | 07:00 | Now instead of sorting these manually, why
don't we allow our users to pick the sort order?
| | 07:04 | This would require that we put some
sort of layout object on the layout that
| | 07:08 | would allow them to interact with it.
And then maybe use a Value List for
| | 07:12 | example to choose from the different
sort values, so let's use a field with the
| | 07:15 | Value List assigned.
| | 07:16 | First I am going to add a field,
which is kind of common technique in
| | 07:20 | FileMaker to add a field. It's called a
global field and we create that
| | 07:24 | field, let's say we'll make a text.
| | 07:25 | What makes it global, is if you click on
Options and go into Storage, it's going to
| | 07:30 | use global storage. All that means
for the purpose of this activity is that
| | 07:33 | every record in the entire database
is going to contain the same value.
| | 07:36 | This is good, this is going to help us
sort by those values or create values.
| | 07:41 | It really doesn't matter to us
because we are going to put this in the
| | 07:42 | header and this is not going to be something
that the records in the found set even have.
| | 07:46 | This is just a field that we can use
that the user can interact with and
| | 07:49 | depending on what record we are on,
it will still show the same value.
| | 07:53 | So there is something called Global, I
am going to place that on the Layout,
| | 07:58 | Global field and let's assign a Value
List to it by invoking the Inspector,
| | 08:09 | Ctrl+I, and then we'll say Pop-up menu
and we'll see if we'll have--we don't
| | 08:16 | have a Value List created just yet--so
instead let's create one. Hit the little
| | 08:20 | pencil and we can say Sort Options
and let's manually put in Company
| | 08:30 | and Payments and Shipment and hit OK and
now we've applied that to the dropdown.
| | 08:40 | So what we need here is when the user
changes that value, it's going to trigger,
| | 08:45 | let's say a script that will then sort
by those values. We don't even have to
| | 08:49 | instruct the user on how to sort and
make sure that they're cascaded properly,
| | 08:52 | kind of an interesting technique.
| | 08:53 | Here we'll say, we'll right-click on it
or Ctrl+click and do Set Script Trigger.
| | 08:58 | We are going to pick a Script Trigger,
called OnObjectModify and you
| | 09:01 | want more information on Script Triggers,
you can refer to the FileMaker Pro 12
| | 09:07 | Essential Training title. Here I am
going to choose OnObjectModify, which
| | 09:10 | means we are going to run the script
anytime the value is changed, so if the
| | 09:13 | user picks one value and then they
change it to another one or if they go from
| | 09:16 | an empty value to a new value
it's going to trigger the script.
| | 09:19 | So what we are going to do is add a new
script, by hitting this Plus sign here.
| | 09:23 | We are going to just call it Sort by Choice.
We are going to enter an If,
| | 09:31 | so if the value in that Global field equals
Company, meaning they've selected
| | 09:41 | that option, then simply sort by Company
only. And then we are going to use
| | 09:55 | something called an Else If, to say if
it contains the other values, Company.
| | 10:05 | And then we'll say Payment, we can
duplicate this and change and sort value.
| | 10:19 | We can copy both of these
to make this easy, duplicate.
| | 10:24 | And the last one is Shipment,
and we'll pick Shipment Status.
| | 10:33 | So it's not a very complicated program,
I mean that there is a lot going on here.
| | 10:37 | We can also add another one if we
want to that combines the different
| | 10:41 | ones together, but let's just
take a look at how this works.
| | 10:44 | So you see the script is attached, we
go into Browse mode, let's do a Show All.
| | 10:50 | I don't have any value in here, so
here's my List view. I just instruct
| | 10:53 | my users to create a found set, go to
this layout and then pick how they want to
| | 10:57 | sort it. So if I say Company, this magically
turns into a grouped company report.
| | 11:01 | if I say Payment, you see that
it will group it by Paid, Unpaid, those
| | 11:06 | are the two different values.
And of course shows the totals.
| | 11:08 | And here is the one that doesn't
have a status, so it shows up as blank.
| | 11:12 | And I can group it by Shipment as
well, so here is all the Pending ones,
| | 11:15 | processing ones and Shipped. So really
kind of magically, what we've ended up
| | 11:18 | doing is allowing the user to create
their own report on the fly. And all it is
| | 11:22 | this is one simple layout inside of
FileMaker where we add multiple different
| | 11:26 | SubSummaries and allow the user to
trigger those different groups by sorting.
| | 11:30 | What I've also done in your exercise
folder, I have added what's called a bonus
| | 11:35 | report, which does something similar,
but does it in sort of a combined fashion.
| | 11:40 | I urge you to check it out, this is a
layout that has a bunch of contacts.
| | 11:44 | The user can choose to sort them by
State, sort them by City or even the
| | 11:49 | combination of City and State.
| | 11:51 | It's the same concept with the script.
You can see the script is built-in here.
| | 11:57 | You can take a look at it. I urge you
to pull this one apart, break it
| | 12:00 | up, use it at your own disposal.
It's the same concept that we've talked
| | 12:04 | about here with the same type of
formatting, so I urge you take a look at the
| | 12:07 | dynamic report bonus file.
| | 12:09 | Advanced summary techniques like this
one can help you create sophisticated
| | 12:12 | user-driven reports that automatically
organize your data in logical grouping so that
| | 12:17 | you and your users can just have one
layout inside of FileMaker and you reuse
| | 12:22 | that same layout and appear to create
what look like multiple different types of
| | 12:26 | reports inside your FileMaker database.
| | Collapse this transcript |
| Creating a crosstab report| 00:00 | SubSummary reports like those covered
in the previous movies will solve many of
| | 00:05 | your reporting needs in FileMaker but
there are some report formats that don't
| | 00:08 | necessarily work that well in these
SubSummary report or grouped format.
| | 00:12 | Say for instance we are looking at
the Invoice Summary No Body part layout
| | 00:16 | in the exercise file.
| | 00:17 | Our output is going to look like a
column that has the customers and the
| | 00:21 | other column shows the total invoice
sales for whatever the time period is
| | 00:25 | reflected in the found set.
| | 00:28 | The report represents the correct data
but a SubSummary report only displays
| | 00:32 | subgroups as rows in a list.
| | 00:34 | So a more convenient output format
for most users would be what a lot of
| | 00:38 | people refer to as a Crosstab report
or a lot of people imagine when they
| | 00:42 | think of a pivot table.
| | 00:43 | A Crosstab report presents a summary
of information both rows and columns, so
| | 00:48 | you can see sort of the intersection
of a row and the column will mean a
| | 00:51 | specific piece of information.
| | 00:52 | In this format it's much easier
to perform comparative analyses and
| | 00:55 | notice trends in the data.
| | 00:57 | So SubSummary reports are built in as
a FileMaker Pro tool, which makes them
| | 01:01 | relatively quick and easy to build,
but there is no native facility for
| | 01:05 | FileMaker Pro to create Crosstab reports.
| | 01:08 | But there is a technique to do so and
that's what we are going to cover here.
| | 01:11 | The Crosstab reports do take a little
bit longer to develop. They are not that
| | 01:15 | complex, but they require the creation
of some new fields and they are a little
| | 01:18 | bit less flexible than standard
SubSummary reports, meaning you can't
| | 01:22 | necessarily make them as dynamic. But
they are very powerful and they can be done.
| | 01:25 | It just requires a few steps that
I am going to cover here in this movie.
| | 01:30 | So nonetheless they're certainly worth the effort.
| | 01:32 | Now the first step in creating a
Crosstab report is decide which variable you
| | 01:36 | are going to represent across the rows
and which are going to be represented in
| | 01:40 | columns. The rows are really going
to be let's say in this case in this
| | 01:45 | report here you see that we've got
customers represented in each row.
| | 01:49 | Let's stick with that concept and let's
say that our objective will be to list
| | 01:53 | each unique customer, that's represented in
the found set just like we are
| | 01:57 | doing here, but then we are going to show
their invoice totals for each quarter of the year.
| | 02:01 | So we already have the total at the end.
| | 02:04 | You will notice if we go to the
Invoices Crosstab layout, you will see that
| | 02:08 | we've got all the 25 invoices that are
in our database with the customers.
| | 02:14 | You'll also see that there's another
field in here that I've added to the
| | 02:17 | exercise file that's called z_Quarter.
If we quickly look at that you'll see that
| | 02:25 | z_Quarter, as sort of a little
developer tip here, uses a calculation
| | 02:29 | function that can determine based on
what a date is, what quarter of a standard
| | 02:33 | calendar year, this date occurred in.
| | 02:36 | So here it's the ceiling function that
you see right there and the numerical
| | 02:41 | value is the Month function; looking
at the Month of the Date and then just
| | 02:46 | simply divide that by three.
| | 02:47 | So you divide the month by three and
then round it up essentially to the next
| | 02:52 | highest integer, that's how we get the quarter.
| | 02:54 | So each record as they're created will get
this value that says what quarter it's in.
| | 03:01 | But what we'd like to do instead, is see
unique customer and then their total for
| | 03:05 | quarter one, total for quarter two, three,
four so on and then the final for all
| | 03:10 | those and then of course that
would still reflect the found set.
| | 03:12 | So that's what we are going to do.
| | 03:14 | So the trick here is to summarize
invoice totals by quarter and then display
| | 03:18 | those in each of the columns.
| | 03:20 | So each customer in the found set will
appear on the Crosstab once. The orders
| | 03:24 | for reach customer can be summarized by
quarter and then presented horizontally.
| | 03:29 | Now make sense to use the quarter as
our columnar variable here, because the
| | 03:33 | number and the times of the quarter are
known in advance. So the idea there is
| | 03:37 | that we know we'll only need to be
able to build four quarters. You'll see
| | 03:40 | when we get into this technique a
little bit where it's helpful to sort of have
| | 03:44 | a finite measurable list of columns.
| | 03:46 | We could certainly do Months because
there is only 12 of those, but we wouldn't
| | 03:50 | want to necessarily have customers be
the columns for example because we don't
| | 03:54 | know, we could have 30 customers today,
300 tomorrow, it could change in the
| | 03:58 | found set, so you want to go with some
rigid measurable item or element that we
| | 04:02 | could use as our column.
| | 04:04 | So here it's going to be quarter
which is actually quite common in Crosstab
| | 04:07 | reports anyway, so we just have to
do four groups of field in order to
| | 04:11 | create our columns.
| | 04:12 | So let's start in the exercise file
here by going to this layout Invoices
| | 04:15 | Crosstab. The layout is based on the
Invoices table, just to bring you up to
| | 04:20 | speed, based on the invoices table and
it contains a body part that shows the
| | 04:28 | following fields for each
one of the individual invoices.
| | 04:31 | Now the trick is going to be on each one
of these invoice records is to identify
| | 04:37 | the quarter which we've done already
by creating the z_Quarter field.
| | 04:42 | Now what we are going to need to do is
say if it's quarter one, then say yes; if
| | 04:48 | it's quarter two, say yes;
if it's quarter three so on.
| | 04:51 | So really what we are going to do is say,
what was the amount if it was quarter
| | 04:56 | one? What is the amount if it was
quarter two? What is the amount of it's
| | 04:59 | quarter three? So anyone invoice
record will only have a value in either the
| | 05:03 | quarter one amount field, the
quarter two amount field, the quarter three
| | 05:07 | amount field or the quarter four. Not any
combination of those, but it's an either/or thing.
| | 05:11 | So that's the first thing we want to
do is create a series of fields under
| | 05:16 | File>Manage>Database.
| | 05:18 | That will give us the amount for quarter one,
the amount for quarter two and so on, so let's do that.
| | 05:24 | So I am going to go in and I am going
to create, I am going to use a naming
| | 05:26 | convention that's just z_, because I want
all these to show up at the bottom of
| | 05:30 | my list when I am sorting my field list alphabetically.
| | 05:33 | So I'll call a z_Q1_Amount. I am going to
create one of these for each one of the quarters.
| | 05:39 | So I am going to go in and create a calculation.
What I am going to do here is
| | 05:43 | I am going to say Case, could be an If.
I'll do the same thing here, I am
| | 05:50 | just going to have in this case the one test.
| | 05:53 | You could easily use the If. If and Case are
interchangeable when you only have one test,
| | 05:57 | but given that maybe sometime I might
want to add additional tests I'll use Case.
| | 06:01 | So what I am going to do is I am
going to say If z_Quarter=1, then show the
| | 06:08 | Grand Total field, that's the field that
gives us a dollar value, that's the one
| | 06:12 | that we are summarizing, otherwise
give me nothing. So hopefully this makes
| | 06:16 | sense. We are just simply coming up
with a with an amount field that shows
| | 06:20 | us an amount if the quarter is one
and shows us nothing if it's not.
| | 06:23 | And now I can duplicate this.
This is where sort of the redundancy of
| | 06:28 | creating a Crosstab field comes into play,
because you'll have to create one of
| | 06:34 | these for starters, for every column
you're going to have. But you can see it's
| | 06:40 | kind of easy in FileMaker where you
can do the duplicating and copying and
| | 06:43 | pasting and whatnot.
| | 06:45 | So now create the Quarter 3 and
we'll do one more for Quarter 4.
| | 06:51 | So this is the first series of fields that we
need to create.
| | 06:55 | Change that, go in and change to Quarter 4.
| | 06:59 | So real simply put, it's just as you can see in all
of these, if it's first quarter, give me the total;
| | 07:03 | if it's the third-quarter give me the total and so on.
| | 07:05 | So for any one given record
you'll only see one of these values.
| | 07:09 | So for example if I widen this out
just for the sake of showing you on screen
| | 07:14 | what we have got, here is Grand Total.
| | 07:18 | This isn't necessary for our reports,
but just to kind of show you
| | 07:23 | how this works. So I am going to
put this on here temporarily.
| | 07:27 | If you are following along, you don't have to
do this, it's just for demonstration purposes.
| | 07:37 | So let's just take a quick look
at this and you will get the gist.
| | 07:41 | So you'll notice this invoice was in
Quarter 1, so it only shows up in the
| | 07:45 | Quarter 1 column; this one was Quarter 2,
it only shows up the Quarter 2;
| | 07:48 | and the rest are blank.
That should make sense.
| | 07:50 | So now what we want to do is in order
to show the data to our users is that we
| | 07:55 | want to summarize each quarter.
| | 07:58 | So very simply put, what we are
going to do is create summary fields;
| | 08:03 | File>Manage>Database. We are going
to create a summary field for each one of
| | 08:07 | the quarters and that summary field is
just going to give us the total of Q1
| | 08:11 | amount, the other one is going
to give us a Q2 amount and so on.
| | 08:14 | So I am going to say Summary, z_Q1_
Amount summary, give me total of, you
| | 08:22 | probably guessed it, z_Q1_Amount.
| | 08:24 | Now I am going to duplicate this and I
am going to say z_Q2_Amount and change
| | 08:31 | that to the z_Q2_Amount. And again this
is where the redundancy of a crosstab
| | 08:37 | comes into play, but it's not very
complicated programming, even though it does
| | 08:41 | take a little while to produce, but
it definitely has some upside here.
| | 08:46 | So you could go in, and we are almost
done here, change that to Q4_Amount.
| | 08:54 | So now you see all the different fields.
| | 08:55 | We created one that identifies which
quarter it is and then the Amount and a
| | 09:00 | summary for each column.
| | 09:01 | If you were to do months instead of
quarters, you would have January amount
| | 09:04 | and January summary and then February amount and
February summary, all the way through December.
| | 09:08 | If you did male and female, you'd have
male amount, female amount and so on, so
| | 09:12 | that's kind of how this logic works.
| | 09:14 | So now let's go into Layout and remove
these fields that I put on here just to
| | 09:19 | show you and I am going to
replace them instead by the summaries.
| | 09:30 | Q2_Amount_Summary, Q3_Amount_Summary
and finally the Q4_Amount_Summary and the
| | 09:43 | column label as well.
| | 09:47 | So it might make sense also for us to
select these and hold down the Shift key
| | 09:51 | so that we can apply the currency to
all of them, so we got FileMaker decimals 2,
| | 09:55 | Fixed number of decimals 2,
thousand separator; good to go.
| | 10:01 | So let's go into Browse mode and hit Save.
| | 10:04 | And now we are not done, what we see is
the same value in each one of these and
| | 10:07 | that's because we have put a Summary
field in the body part, we are not grouping
| | 10:12 | of these things yet.
| | 10:13 | So what happens when you put a Summary
field in the body part is that it just
| | 10:15 | shows you the total for the entire found
set rather than just the total for this group.
| | 10:20 | So what we have to do is instead of
having a body part, we have to create mini
| | 10:23 | found sets so that we can trigger these
appropriately. The way that we create
| | 10:27 | mini found sets in layout
view is to use SubSummary parts.
| | 10:31 | So let's change the body part to a
SubSummary when sorted by company.
| | 10:40 | Let's change the Footer to a Trailing Grand
Summary and what we'll do is we'll copy
| | 10:49 | all of these values, even the Grand
Total for that matter down to the Trailing
| | 10:53 | Grand Summary. So this will give us
like our total for the whole found set,
| | 10:57 | rather than just for each individual quarter.
| | 10:59 | Now when we go into Browse mode and
save our changes, we see that we still have
| | 11:04 | to sort by our Company break field,
so let's do that.
| | 11:08 | And now what we've got is sort of a not
yet stylized but a sort of crude version
| | 11:13 | of each individual customer.
| | 11:15 | The Grand Total amount, this is the
amount that's actually just for each
| | 11:18 | individual invoice. So what we need to
do is change that to our Summary, Grand
| | 11:23 | Total Summary and do the same here,
Grand Total Summary and now we'll see
| | 11:28 | we'll get sort of a crude version
of our report, but looks all fancy.
| | 11:32 | So we've got the total for all of
Abbott Securities for this found set and it's
| | 11:36 | broken down in between $611 in Q1 and
$352 in Q3 and so on, see 322 here that's
| | 11:43 | all on the fourth-quarter, a great way
to kind of visually look at this. With
| | 11:47 | some simple sort of formatting we could
come in and give it a little line there
| | 11:52 | for our totals on the bottom, and if
we want we could stylize these columns a
| | 11:58 | little bit, maybe do some column lines demarcations.
| | 12:02 | We can probably get the dates of out of
here as well and the quarters, grab all
| | 12:09 | of this and move it over. Now what
you end up with is a Crosstab report
| | 12:17 | showing all the customers represented
in a found set and how it's broken down
| | 12:21 | by quarter. As I've been telling you
in the rest of these exercises, I want
| | 12:24 | to also drive home the fact that I can
create a different found set, nothing
| | 12:30 | for 2010, let's try -- we've only got
one there, let's try this so we'll do
| | 12:36 | 2012 instead, 2012.
| | 12:40 | Three of those and we'll go to our
Crosstab. So it tells us in 2012 that
| | 12:44 | there are only two customers, here's
their totals and we can see that all of
| | 12:49 | those orders came in the fourth quarter.
| | 12:51 | Again, another report using a SubSummary
part that's driven by the found set and
| | 12:56 | the sort order that your users send to
this layout. So you might want to go into
| | 13:00 | Layout mode as sort of the last item
and update your Script Trigger, so you can
| | 13:07 | pick a different sort order, so it's
only sorting by the SubSummary part that's
| | 13:12 | relevant here. Since I just sorted
by it you'll see that when I go in here,
| | 13:17 | it tells me Company, that's what I want.
| | 13:23 | And when we go into Browse mode, now
anytime somebody navigates to this record,
| | 13:27 | even if it's all of the records here,
we can see our Crosstab report generated.
| | 13:32 | So a couple of quick things to keep in
mind when creating Crosstab reports like
| | 13:34 | this one; you'll need a Calculation
field and Summary field for every column of
| | 13:38 | data that you want to display.
| | 13:40 | Therefore if you want a report that
shows the months of the year, you'll need
| | 13:42 | 24 new fields, 12 calculations and 12 summary fields.
| | 13:46 | And also another field that will determine
which month of the year the order was.
| | 13:50 | You will need to know in advance what
the Column Header values are, so that you
| | 13:54 | can explicitly define the rules
for assigning records to a column.
| | 13:56 | It's very difficult using these
methods described in this lesson to create a
| | 14:00 | Crosstab report with variable
numbers or names of columns.
| | 14:03 | So for example if we didn't know there
were just four quarters, there could be
| | 14:06 | any number of quarters that may be Crosstab
report and this technique might not be as useful.
| | 14:10 | A Crosstab report represents summary
information in both rows and columns
| | 14:14 | and each value in the table represents the
intersection of two categorical variables.
| | 14:19 | In this format it's much easier to
perform comparative analyses and notice
| | 14:22 | trends in the data, so you might want
to consider creating a Crosstab report
| | 14:25 | anytime that you need to summarize
data by two categorical variables as it
| | 14:30 | was in this case.
| | Collapse this transcript |
|
|
7. Extending FileMaker RelationshipsReviewing relationships with multiple criteria| 00:00 | Relationships in FileMaker Pro can and
should be used to implement the basic
| | 00:05 | primary key to foreign key relationships
indicated in any entity relationship diagram.
| | 00:10 | FileMaker Pro does in fact support
related tables and relationships
| | 00:15 | and it makes sense to use them.
| | 00:16 | If any of that didn't make sense, or
if you want to have a refresher or some
| | 00:20 | additional background information on
relationships in FileMaker Pro, please
| | 00:24 | first watch the Relational Database Design
with FileMaker Pro Video.
| | 00:28 | It will serve as a great primer in this
next section and is highly recommended
| | 00:31 | and again that's Relational Database
Design with FileMaker Pro.
| | 00:35 | With that said, relationships in FileMaker
Pro have many powerful uses beyond
| | 00:39 | just establishing the underlying
structure of your database.
| | 00:42 | Of course if you look inside of our
exercise file, you see that we have some
| | 00:46 | relationships already set up. I am
going to review these here and explain to
| | 00:50 | you difference between what I call a
base table relationship and what I like to
| | 00:53 | refer to as a query relationship.
| | 00:55 | I am going to use those terms
throughout the rest of this title, so I am going
| | 00:58 | to take this opportunity to define them.
| | 01:01 | When I talk about a base table relationship,
I am referring not only to base tables,
| | 01:05 | as you see here I have got tables for
Customer, Product, Invoice and
| | 01:09 | ProductInvoices; forget the Company
Info one now that's what we call Global
| | 01:12 | table, that's irrelevant to this
discussion but it was part of the starter
| | 01:15 | solution so we are going to
leave that in there for right now.
| | 01:18 | But we'll concentrate really on these four.
| | 01:20 | One record in Customer equals to
Customer, one record in Product equals to
| | 01:23 | Product and so on. ProductInvoice is one
record equals a product appearing on an invoice.
| | 01:29 | And when we map out our relationships,
we determine that they all have to
| | 01:34 | resolve in a one-to-many relationship
and then we come into our relationship
| | 01:37 | graph and we graph those appropriately.
| | 01:40 | So what I have done here is I used a
color-coded legend on the top to tell me
| | 01:44 | which of these tables and actually
more specifically these are referred to as
| | 01:47 | table occurrences and it tells me which
one is based on which underlining base
| | 01:51 | table, so that red his Customer,
green is Invoice and so on.
| | 01:54 | So we see we have one to many, from
Customers to Invoices, one to many from
| | 01:58 | Products to ProductInvoices, and one to
many from Invoices to ProductInvoices.
| | 02:02 | You will see in each case, it's primary key
to foreign key and all of those relationships.
| | 02:08 | Pretty simple stuff, that's review,
it's covered in other title, stuff that you
| | 02:11 | probably already know already.
| | 02:13 | But that is what I refer to
as base table relationships.
| | 02:16 | Every system should have those defined
and that's how you can do things like
| | 02:21 | drop a portal in the context of
customers that shows all of the customers
| | 02:26 | related invoices, pretty simple stuff.
| | 02:28 | But now I am going to explain what this portal is.
| | 02:30 | This portal here is only showing me not
just invoices related to the customer,
| | 02:34 | but specifically ones with a status of Paid.
So let's take a look at how that's happening.
| | 02:40 | You'll notice that I have more than
one relationship between customers and
| | 02:43 | invoices and those are down here
where I have isolated them under this
| | 02:47 | Query Relationships.
| | 02:49 | You'll see that if you double-click on
one of these table occurrences, it still
| | 02:53 | says that it's based off of invoices.
| | 02:55 | But I've named them something different.
| | 02:58 | Normally I'll apply some sort of
naming convention that tells me the starting
| | 03:02 | point of the context and the ending point.
But for the purposes of training I've
| | 03:06 | left them as just sort of plain readable English.
| | 03:09 | I could alternatively call this
Customers_Invoices_Unpaid for example.
| | 03:14 | But no matter what, each table
occurrence must bear a unique name.
| | 03:17 | You will be prompted to name each of
these occurrences as you set it up in the
| | 03:20 | graph. You can add new ones by
clicking this button here in the bottom left
| | 03:25 | hand corner; you've of course picked
the table that you want, give it the name
| | 03:28 | and then you can create your relationships accordingly.
| | 03:31 | A single base table can appear many
times in a relationship graph and could
| | 03:35 | participate in several different
relationships. As you see here, it could
| | 03:38 | potentially appear in several different
relationships back to the same parent table.
| | 03:42 | And you see examples of this
throughout the rest of this chapter.
| | 03:45 | The only unbreakable rule governing
table of currents creation is that the
| | 03:48 | relationship graph cannot have any loops in it.
So that means there must be one
| | 03:53 | and only one path between any
two related table occurrences.
| | 03:56 | To understand what a loop is, and when
you encounter one, you need to know one
| | 04:00 | very important point. And that is, all
base tables are related to each other
| | 04:04 | through this chain of relationships. So
for example customers table is actually a
| | 04:09 | related to products because it's
related Invoicesm which is related to
| | 04:12 | ProductInvoicesm which is related to Products.
| | 04:15 | So that's why you can drop a portal
based on the products relationship onto
| | 04:19 | a layout in the Customer's table and it will
actually show you some related information.
| | 04:23 | So what that means is that I can't
create a loop by trying to create a
| | 04:27 | relationship directly between customers
and products, because FileMaker will say
| | 04:31 | you cannot have more than one relational
path between any two tables in a graph,
| | 04:34 | another occurrence must be created.
| | 04:36 | So I could in fact create another
relationship directly to products, but that is
| | 04:41 | something that we don't need in this
particular exercise, but something you will
| | 04:44 | see later on though, we certainly could
do that, but it's important to remember
| | 04:48 | that these tables are
already related to each other.
| | 04:50 | Now even thought we are relating
primary key to foreign key in the initial
| | 04:54 | relationship between Customers and Invoices,
| | 04:56 | if we look at the Unpaid relationship we
still start off with the primary key to
| | 05:02 | foreign key relationship.
| | 05:03 | So that way what we are seeing in this
portal for example are still going to be
| | 05:07 | invoices related to the customer, but
we are adding an additional criteria.
| | 05:11 | That's where I call these query relationships.
| | 05:13 | I define a query relationship as any
relationship between two tables that
| | 05:17 | has multiple criteria that is not the base
table primary key to foreign key relationship.
| | 05:23 | And I call them that because in other platforms,
this is really how you create a query.
| | 05:28 | You basically just say, show me all
the invoices where my IDs match and where
| | 05:34 | the payment status equals unpaid; that would
be a query statement in some other databases.
| | 05:39 | Now the main idea behind all this of
course is that the MATCH FIELDS work. So
| | 05:43 | if we look at how the MATCH FIELDS work
in this relationship we see here's all
| | 05:47 | the related invoices; this is customer 18
and of course when I click on this
| | 05:52 | invoice it's got Customer ID value in it
and so do all the related ones,
| | 05:55 | they are all customer 18.
| | 05:57 | And the reason that this record does
not show up under Lightningfast is because
| | 06:01 | it's got customer ID 522.
| | 06:04 | So that's what makes all of these show up.
Additional criteria of what make
| | 06:08 | the ones in the bottom show up.
| | 06:10 | So if you look in Layout mode,
you'll see that we've got a portal for invoices,
| | 06:15 | which is based on the base table but
now we have one that's based on Paid Invoices.
| | 06:19 | So we can create additional portals for
these query relationships or use them in
| | 06:22 | other ways, which we'll cover later in the chapter.
| | 06:24 | But if we look at Paid or Unpaid it just means
UNPAID MATCH FIELD equals Payment Status.
| | 06:30 | Now the Match fields, the trick there
is you'll just see that this is
| | 06:37 | putting every record in the database
when you open up the file for the first time,
| | 06:40 | it's putting the word Unpaid.
| | 06:41 | So basically what we are doing there
is we are saying show me all my invoices
| | 06:46 | where Payment Status equals Unpaid. Or
here, same thing, show me all my invoices
| | 06:53 | where Payment Status value in the
invoices equals the word Paid. And that's it.
| | 06:57 | That's how we are constructing a query
inside of FileMaker and in FileMaker in
| | 07:02 | the product we call those relationships.
| | 07:04 | So once we have those in place, we
can build calculations based on them and
| | 07:09 | use them in scripting and do all sorts of
other things, as you'll notice that we've got here.
| | 07:14 | So the takeaway from this discussion,
here is that you'll always need to set
| | 07:18 | up your base table one to many
relationships with one pair of primary to
| | 07:22 | foreign key match fields.
| | 07:23 | But then FileMaker also allows you to
extend your relationships by creating
| | 07:27 | multiple criteria driven by
these query relationships.
| | 07:30 | That's really where the power
of FileMaker comes into play.
| | 07:33 | So create your base table ones, but
don't forget there is a ton of other ones
| | 07:36 | that you can create. These query
relationships will become an important tool
| | 07:40 | in your FileMaker toolbox so to speak.
| | 07:42 | And we are going to cover them all
throughout the rest of this chapter here
| | 07:46 | on relationships.
| | Collapse this transcript |
| Understanding user-driven relationships| 00:00 | In the previous movie we discussed a
little bit of a review about how you can
| | 00:03 | define match fields in a relationship
to dictate which records will be
| | 00:06 | related between a parent table and a
child table, referred to those as base
| | 00:10 | table relationships.
| | 00:12 | However, what if you want
the user to drive the criteria?
| | 00:15 | For example, if you want to have a user
tell you which records you want to have
| | 00:19 | show-up in a portal based on certain
statuses or date ranges or whatever it is.
| | 00:23 | In FileMaker we refer to those as
user driven relationships and they can be
| | 00:27 | extremely useful within
your FileMaker interfaces.
| | 00:30 | So I am going to show you a demonstration
of this here. For example, let's say
| | 00:34 | that the story here is that we want to
have a dashboard layout and that's just
| | 00:37 | something that we call a layout that
allows users to gather all the topline
| | 00:41 | information that they need.
| | 00:42 | So in this example of a dashboard
layout we would like to put a portal on here
| | 00:46 | that could potentially show all the
different invoices in the system. But we
| | 00:50 | want to just have it be a one-stop shop
where user can go in and click on and
| | 00:54 | say I want to see all the paid ones,
I want to see all the unpaid ones and
| | 00:57 | that's it. Maybe also possibly
narrow it down by date range.
| | 01:01 | It's the same kind of thing that they
are doing if they are doing a search or a
| | 01:03 | query in your database, so I like
to call these query relationships.
| | 01:07 | So first thing that we need to do is
to come up with the layout that we are
| | 01:10 | going to use as our "dashboard".
| | 01:13 | I have already got one set up inside
the exercise file. Real quickly this
| | 01:17 | layout is not based on any table, it's
just based on this Customer Info table
| | 01:23 | that was created as part
of the starter solution.
| | 01:25 | But don't try to wrap your head around
how the Company Info table fits into the
| | 01:29 | entity relationship structure, it doesn't.
| | 01:31 | It's not a base table, it's not an entity.
| | 01:33 | It's a Global table, which is an unofficial
sort of FileMaker development term
| | 01:37 | used to describe a table with just one
record in it, which means that it has no
| | 01:41 | context in the scope of
all the other base tables.
| | 01:44 | But it's kind of a utility thing.
| | 01:46 | It allows us to do something like
create this relationship or create this
| | 01:49 | dashboard layout that we'd like to.
| | 01:51 | It's a common practice for creating a
layout that acts as a utility and you can
| | 01:55 | use it for techniques like
the one I am showing you here.
| | 01:58 | In this example the starter solution
already had one of these tables created,
| | 02:01 | but they did so for the purpose of
creating the Company Info layout, which
| | 02:05 | provided an area for you to put
in the logo, the company name,
| | 02:08 | header and footer information
into one record in the database.
| | 02:13 | Then since that one all these fields
are globally stored fields or connected to
| | 02:20 | the product's invoices, it could then
pull in header, logo, whatever information
| | 02:25 | into the printouts and the products and invoices.
| | 02:27 | That's what it's there for now, but we are
going to use it for something different.
| | 02:30 | So first what we need to do is create
a relationship between the Company Info
| | 02:35 | table and the Invoices table.
| | 02:37 | Because in this exercise what I am going
to do is create a portal that shows all
| | 02:40 | the invoices, but allows the user to interact with them.
| | 02:43 | Before I create the relationship,
I need to have a match field in place.
| | 02:47 | Now this is one of the key elements of
creating a user driven relationship is
| | 02:51 | that you need to have a field that the
user can interact with. Commonly this
| | 02:56 | field is one that is not an attribute
field or a field that describes some
| | 03:00 | element of whatever it is that
you've stored inside a table.
| | 03:03 | So since we have got a Global table we
don't have any true attributes in there.
| | 03:07 | So I am just going to create a utility field
and I am going to call it Dashboard filter.
| | 03:14 | I am going to create a text field,
and now what this field is going to do,
| | 03:18 | its role is just simply to have the user
pick either the term Paid or Unpaid.
| | 03:23 | Then that's going to connect over to
the Payment Status and the Invoices,
| | 03:26 | which we'll get to in a second.
| | 03:27 | But first I am going to make this a
globally stored field by clicking Storage
| | 03:32 | and checking the Global Storage.
| | 03:34 | The reason for that is because even
though there is only one record in this
| | 03:37 | table and there only ever will be, we
don't need it to pass the value across all
| | 03:40 | the records in the table.
| | 03:42 | But in fact what we want it
to do is be session-specific.
| | 03:45 | So one user logs into the system,
they can pick a filter value in their
| | 03:49 | dashboard and another user can pick
another filter value in their dashboard.
| | 03:52 | So Global fields have the added bonus
of being session-specific when they are
| | 03:57 | being hosted in a multi-user environment.
| | 04:00 | So now we create the relationship.
| | 04:01 | It's going to be a query relationship
so let me open up this little area here.
| | 04:05 | Now I am going to create a new table and
this table is going to be based off of invoices.
| | 04:10 | I am going to call it companyinfo_ and
what I like to do is I like to do the
| | 04:17 | starting point or the context that I
am using this in as the first word in a
| | 04:21 | relationship, so that's
companyinfo, make it all lowercase.
| | 04:25 | Then I'll put in all caps the table
that this table occurrence is based off of
| | 04:29 | and that's INVOICES.
| | 04:30 | Then if I need to, I can put an
underscore and some other information
| | 04:35 | let's say filter, indicating that, oh, this is the one that
I am using that's go the filter value in it.
| | 04:40 | This is unofficial. This is just a suggestion
as far as a naming convention is concerned.
| | 04:44 | So I am going to move that down here.
I am going to open it up a little bit, so
| | 04:49 | we can see the name, and what the heck,
let's give it a green color, there we go.
| | 04:55 | So now what I need to do is create the
relationship between Company Info and
| | 04:59 | Invoices. I am going to grab that
Dashboard filter, because remember, that's
| | 05:02 | going to be a match fields here and
it exists so that that user can enter a
| | 05:06 | piece of data into that field.
| | 05:08 | Actually, let's scroll down a little bit.
What we are going to do is go to Payment Status.
| | 05:14 | So if we collapse these a bit, we'll
see that the relationship is just the
| | 05:19 | DashboardFilter value that the
user enters equal Payment Status.
| | 05:22 | So the user is either going enter paid
or unpaid and that's going match records
| | 05:26 | with either paid or unpaid in it, pretty simple.
| | 05:28 | Now let's go back to the Dashboard
layout and on this we are going to draw a
| | 05:33 | couple of different elements.
| | 05:34 | First we are going to put the field,
which is the Dashboard filter so the users
| | 05:39 | can type something into it and
then I am going to add a Portal.
| | 05:44 | So let's add a portal and of course
we have to pick which relationship this
| | 05:48 | portal is going to display and
that of course is going to be our
| | 05:51 | companyinfo_INVOICES_filter relationship
that we created earlier.
| | 05:54 | We'll do a vertical scrollbar.
| | 05:56 | And now we need to pick the fields.
| | 05:58 | So let's say on this field we want
to show the InvoiceID, the Date of the
| | 06:04 | invoice, and the Grand Total of course,
and even the Payment Status, since of
| | 06:09 | course that's what we are going to be filtering on.
| | 06:12 | And now one important thing we might
want to show here is the name of the
| | 06:16 | company that the invoice is based off.
| | 06:18 | But the Company field doesn't exist in the Invoices table.
| | 06:20 | As a matter of fact in all the other
portals, what we are doing is we are
| | 06:25 | pulling the name of customer from the
relationship into the Customer table.
| | 06:31 | So what we need to do here is
have a relationship that goes from
| | 06:36 | companyinfo_INVOICES_filter over to
customers that will allow us to display this.
| | 06:40 | It seems a little odd, this is usually a
kind of tough concept to wrap your head
| | 06:44 | around, but the idea is we are basing our
portal on this context, so all the rows
| | 06:49 | in the portal are based off of this context.
| | 06:51 | So we need to be able to pull in a
related field and just like you want to
| | 06:56 | display a related field in the context
of a layout, the table that that layout
| | 06:59 | is based off of, or the table occurrence
that layout is based off of,
| | 07:01 | needs to have a relationship to whatever
table you are pulling the fields in from.
| | 07:04 | So suffice to say, you need to create
another relationship. We'll call it
| | 07:10 | companyinfo_invoices; don't have to put
it all caps now because that's not the
| | 07:16 | table that this is based off of.
We'll say CUSTOMERS and maybe I'll put
| | 07:20 | filter in there as well.
| | 07:24 | Okay, and we'll put that over here and we'll
say CustomerIDfk, so let's shrink these down.
| | 07:39 | Sometimes what I do is I just drag any
field and then I open this up, but it
| | 07:43 | gives me a little bit easier canvas to create these on.
| | 07:46 | So it's going to be fk to pk, oops!
| | 07:48 | Let's get rid of that, Customer fk to pk
and we'll hit OK and make that red.
| | 07:57 | Okay, so now I can choose from
customers and I can get the company.
| | 08:05 | These all came from the first table
occurrence we created and then we created
| | 08:08 | another table occurrence related to
this one, which is represented by each row
| | 08:11 | in the portal, and now we can
place all that information on there.
| | 08:15 | So let's go look at this a little briefly
in Browse mode. We don't see
| | 08:19 | anything at all because there
is no value in the match field.
| | 08:21 | So let me just type in Paid and now
we see all the paid ones and we can say
| | 08:26 | UnPaid, commit it and see all the unpaid ones.
| | 08:30 | Now the user isn't going to want to
type all those in, so why don't we just
| | 08:33 | quickly create a value list and put in Paid or UnPaid.
| | 08:44 | We'll go into Layout mode and we'll
give it, let's say a checkbox; show you
| | 08:50 | something kind of interesting here.
Paid status, so go into Browse mode and
| | 09:00 | check Paid, shows all the paid; check
UnPaid shows all the unpaid; or check both
| | 09:05 | of them and it shows both.
| | 09:08 | So it's an interesting thing about a
checkbox is that what it's really doing is
| | 09:11 | creating a return delimited combined key.
| | 09:14 | If you use that on the parent side, you
have multiple return delimited values in
| | 09:18 | your primary key, all the matching
records will show up of both of those.
| | 09:22 | So you could have several of these and
they'll all show up inside the portal.
| | 09:26 | So this is an example of providing a
single field with a value list assigned
| | 09:29 | that will allow users to drive the related
values that they're seeing, in this case in a Portal.
| | 09:35 | This can also be used to do something
like create items for a report.
| | 09:38 | In the next movie I am going to actually
show you how to add date ranges to
| | 09:41 | this as well.
| | Collapse this transcript |
| Using ranges in user-driven relationships| 00:00 | In the previous movie we discussed how
to set up what I would like to call a
| | 00:04 | user-driven relationship.
| | 00:05 | So we've gone into our Relationship
graph and created a couple of different
| | 00:10 | relationships, one that went from what
is called a Global Table Company Info,
| | 00:16 | to the Invoices Table, and then
from Invoice Table using Customers.
| | 00:20 | But the real one here was this
Relationship we created in the middle that
| | 00:23 | allow the user to populate field that
we call the DashboardFilter with either
| | 00:27 | a Paid or Unpaid status.
| | 00:29 | And then in turn what we did is put
that field right here, the DashboardFilter
| | 00:34 | and a Relationship based on the
DashboardFilter, onto this Layout.
| | 00:39 | So what we want to do now is
add additional criteria to it.
| | 00:42 | So not only are we are going to allow the
user to pick Paid or Unpaid, but we are
| | 00:44 | also going to allow them to pick the
Start and End date of the range of Invoices
| | 00:49 | that they would like to see.
| | 00:50 | So we are going to further embellish
the Relationship that we already created
| | 00:53 | or the Query Relationship as I like to call it.
| | 00:56 | But what I need are two more match
fields on the Dashboard side or on
| | 01:01 | the Company Info side.
| | 01:02 | So let's go in and hit Manage>Database>
Tables and we are going to add two more.
| | 01:08 | We are going to allow the user to
pick the StartDate and the EndDate and
| | 01:11 | anything within that will be the range.
| | 01:12 | So let's call it StartDateFilter, and
we'll make this a Date field and we'll hit
| | 01:20 | Create, and I'll say that, that is
globally stored so that it is session
| | 01:25 | specific and I am going to do now EndDateFilter.
| | 01:34 | And now we've got a global field for
the StartDate and global field for the
| | 01:38 | EndDate, which accompany our
DashboardFilter that the user is populating.
| | 01:43 | So let's go incorporate
these into our Relationship.
| | 01:47 | So here's our existing Relationship already
that we are using for the Dashboard portal.
| | 01:50 | So I'm going to add now is a Relationship
between whatever the user picks and
| | 01:54 | puts into the StartDate and the InvoiceDate field.
| | 01:59 | But instead of using the equal sign, what I am
going to use is another one of these operators.
| | 02:03 | So here I am going to say when the
value in the InvoiceDate field is greater or
| | 02:08 | equal to the value that the user
puts in the StartDate, then show it.
| | 02:13 | So I am going to add that, so
now we have multiple criteria.
| | 02:16 | And I am going to do the
opposite here for the EndDateFilter.
| | 02:20 | So I am going to say, whenever the
value that's in the Date field is less than
| | 02:24 | or equal than the value that the
user entered into the Date, show that.
| | 02:28 | So now they are going to pick Paid or
Unpaid or both, they are going to give
| | 02:32 | us a StartDate, give us an EndDate,
and all that criteria is really again is
| | 02:36 | creating a query here, because we're
searching or we're asking a question of
| | 02:40 | the database and it's going to respond
back with the results of that query, but
| | 02:44 | we are just doing that through a Relationship,
and then in the user is driving the Relationship.
| | 02:49 | So let's put this into practice, we'll
hit OK and instead of just having this
| | 02:55 | field, let's add a couple of others here.
| | 02:57 | We will add the StartDateFilter there,
open it up a little bit, let's make it a
| | 03:03 | calendar dropdown, we will show the icon,
and then I'll hold my Option key down
| | 03:08 | because I am on Mac, or I can do that
Ctrl key on Windows, and I am going to
| | 03:13 | pick the EndDateFilter. So here we go.
| | 03:15 | Let check this out in Browse mode, Save our changes.
| | 03:19 | So let's say first we want to see Paid
and now we have to give it a Date Range.
| | 03:24 | Once we had all this criteria, we
have to add some value in there.
| | 03:27 | I'll address that in a second.
| | 03:29 | But let's type in 1/1/2013 and I'll type
in 3/1/2013 and hit OK. Sure enough,
| | 03:38 | we end up with four Paid records,
all within that Date Range.
| | 03:43 | I can even add Unpaid and we see
those are all within the Date range.
| | 03:47 | You'll notice that we've got totals for
all of them, Paid and Unpaid, and they
| | 03:50 | all fit within that filter.
| | 03:51 | So we can allow the user to manipulate
these things, and also, we can make this
| | 03:55 | Relationship drive sort of a calculator;
make it not only a Dashboard, but a
| | 03:59 | Calculator. Let's say that they want to
know what the total of all Invoices is
| | 04:03 | based on whatever criteria they are
entering. Well, that's pretty easy.
| | 04:07 | We discussed this in the chapter discussing
Aggregate Functions using related
| | 04:10 | values. So what I am going to
do is add something that we call
| | 04:14 | SummaryGrandTotal and I'll make it a Calculation.
| | 04:21 | I am going to use the Aggregate
function for Sum, and all I am going to do
| | 04:26 | is point to the relationship that we've
been using here, and I am going to pick
| | 04:30 | the Grand Total amount. Oops!
| | 04:32 | Let's get rid of the parameter
information first, and then the Grand Total
| | 04:38 | amount, and that's a Number. We'll hit
OK, and OK again. Let's put that on
| | 04:43 | the Layout, SummaryGrandTotal, open it
up a little bit, let's make it Currency.
| | 04:55 | So now we can see these values change
based on what criteria we are entering,
| | 05:03 | and the different Date ranges and whatnot.
| | 05:05 | Now 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:11 | Well, I have got the answer to that as well.
| | 05:14 | Since these values are going to be
session specific, it doesn't hurt for us to
| | 05:17 | put some default values in there.
| | 05:19 | So what I would like to show you to do
here is we will go into Layout mode and
| | 05:24 | we will invoke the Layout Setup
where we can create a Script Trigger.
| | 05:27 | So I am going to say whenever we
enter the Layout, so whenever somebody
| | 05:31 | navigates to it or brings it up through
a script or whatever it is, we are going
| | 05:35 | to create a New Script that's called
SetFilterDefault and it is going to be a
| | 05:42 | series of SetFieldScripts.
| | 05:43 | SetFieldScript steps of course, are used
to pick a field and put a value into it.
| | 05:48 | So the first one we are going to do is
the DashboardFilter.
| | 05:52 | I am going to do a little trick here.
| | 05:53 | And I am going to say Paid, and then I
am going to put a Return character in
| | 06:00 | there and I am going to say Unpaid.
| | 06:03 | The reason I'm doing that is because
it's a checkbox and in order for both
| | 06:07 | values to show up selected in the checkbox,
I need to separate them with Return
| | 06:10 | character. That will also make our
Relationship work, because I have got
| | 06:14 | return delimited primary key values.
| | 06:17 | And I'll do another one, and we will
pick StartDate Filter, let's call it --
| | 06:24 | that will start with whatever the
CurrentDate is, just as some sort logical and
| | 06:29 | still dynamic starting point.
| | 06:31 | So now I am going to say EndDate,
let's say CurrentDate+365, how is that?
| | 06:38 | And then what I like to add for good
measure is a Commit Record/Request to make
| | 06:47 | sure that we add those values and then
commit the records so that there aren't
| | 06:50 | any that are left uncommitted.
| | 06:53 | So now go into Browse mode,
let's navigate over to this layout.
| | 06:58 | Of course, we've just logged into the database
for the first time we would do this as well.
| | 07:02 | Now you see that it's given Paid
and Unpaid already, so that there's value
| | 07:06 | in there, it gives us a SummaryGrandTotal number;
it gives us at least a starting point for filtering.
| | 07:11 | This is kind of an out-of-the-box
example of creating a Dashboard with the
| | 07:14 | dynamic calculator that resets
dynamically for each new session.
| | 07:18 | But what it does show is that one of the
most powerful tools in FileMaker is the
| | 07:21 | ability to create customized query
relationships with multiple criteria and then
| | 07:26 | those can drive either
custom portals or as you see here;
| | 07:29 | drive a value in an Aggregate Calculation.
| | 07:31 | Getting used to relationships with
multiple criteria, much like the ones
| | 07:34 | that we've don't here is really a core
concept behind this skill set and is
| | 07:38 | something that can absolutely help you
take your FileMaker databases
| | 07:41 | to the next level.
| | Collapse this transcript |
| Creating a "self" relationship| 00:00 | Standard Relationships in FileMaker are
going to be between one table occurrence
| | 00:04 | and another table occurrence.
| | 00:06 | Now in the examples that we reviewed so
far in this course, we have been making
| | 00:09 | relationships between Table Occurrences
that are based on two different tables.
| | 00:13 | For example, you can see the Customer
Table related to the Invoice Table, and a
| | 00:19 | couple other examples here of those
or the Products Table related to the
| | 00:25 | Products Invoice and so on.
| | 00:27 | But when it comes to this complex,
or like I like to call them, query
| | 00:30 | relationships, we can have one table
occurrence be from one table, and as we see
| | 00:35 | here another table occurrence from
the other, so two different contexts.
| | 00:39 | And we saw that in the previous
examples, where we were using the
| | 00:43 | Dashboard relationships.
| | 00:44 | So we have the Dashboard Table is one
context and the Invoices Table is another.
| | 00:48 | But in this movie I'm going to show you
how you actually create a relationship
| | 00:51 | between two table occurrences that are
both based on the same table context.
| | 00:56 | That's what we refer to as a self relationship.
| | 00:58 | Sound like an odd idea, but let's say in
our example we've got this relationship
| | 01:03 | based on Invoices and over here in this
corner, I want to put a portal on here
| | 01:08 | that helps our customer service or our
order entry people see all the different
| | 01:12 | Invoices from the same customer.
| | 01:14 | So that way the customer service people
can see when the last order was,
| | 01:17 | what their frequency is and different
tendencies and stuff like that.
| | 01:20 | So in order to do that if you think
about it, the context is going to be
| | 01:23 | the Invoice Table, but the context of the
portal is also going to be the Invoice Table.
| | 01:28 | So I need to create a relationship
between Invoice and Invoice.
| | 01:31 | So let's go into our Relationship graph.
We already have a relationship that's
| | 01:34 | based off of Invoices.
| | 01:36 | So what I need now, is one that's
also based off of Invoices. I am going to
| | 01:40 | create a new one, I am going to pick
Invoices, and I am going to call this one
| | 01:44 | INVOICES because that's the contact
where we are starting from, and this is the
| | 01:48 | current contacts where we are
going to, and we'll say samecustomer.
| | 01:53 | invoices_INVOICES_samecustomer.
| | 01:55 | So here's my Relationship, make it a
little bit larger and we'll make it green,
| | 02:02 | and now this is really
where the trick comes into play.
| | 02:04 | In this technique, if you remember,
our goal will be, we will have a layout
| | 02:08 | that's based on the Invoice Table
Occurrence, and in a portal, show all of the
| | 02:11 | other Invoices that have the same customer.
| | 02:14 | So what we are really saying is that
the records that will show up in the
| | 02:16 | portal must have the same customer ID as
the selected Invoice record that we are on.
| | 02:22 | So we have got this field here
called CustomerID and if I just simply
| | 02:25 | match it to CustomerID, that means that
if I'm on a record with CustomerID18,
| | 02:30 | it's going to show me all the Invoices
that also have CustomerID,
| | 02:37 | the CustomerID, here we go.
| | 02:38 | CustomerID18, show me all the Invoices
that have the CustomerID foreign key
| | 02:43 | value of 18 as well, pretty simple stuff.
| | 02:45 | So CustomerIDfk will be our match
field on both sides of the relationship.
| | 02:50 | So now let's place a portal based on
this relationship on to the layout.
| | 02:58 | Here we go. I'll draw a portal and let's
pick the relationship that we just created,
| | 03:04 | which is Invoices_INVOICES_samecustomer,
and I'll do a vertical scrollbar,
| | 03:08 | I'll pick a couple of fields.
| | 03:10 | So let's say the Date, the Grand Total,
Payment Status, and the Ship Date.
| | 03:20 | Just for this exercise I am going to
put the InvoiceID on there as well.
| | 03:28 | So now we see all those different fields,
and of course we can go in and we
| | 03:31 | can add some field columns if we want to,
but let me show you something when we
| | 03:35 | get into Browse mode.
| | 03:37 | First of all we see that we need to
resize this, so just a quick discussion on
| | 03:41 | resizing; I can pick the portal and
you'll notice the appearance over here,
| | 03:44 | it's locked in the upper left-hand corner. I
need it be locked in to the bottom left-hand corner.
| | 03:47 | So let me pick that, do the same thing,
I'll hold down the Shift key for all
| | 03:54 | these fields, and I'll change them from
the upper left-hand corner to the bottom left.
| | 03:59 | Let's just quickly look from a formatting
standpoint how that changes. So there we go.
| | 04:04 | Also, we've got a question mark in the
one field, so what that means is that we
| | 04:07 | just need a little bit more space to
show that value. InvoiceID can be a little
| | 04:14 | bit smaller, get rid of that Z that
was unintentional and let's make Grand
| | 04:21 | Total bigger, and format it as Currency.
| | 04:29 | All right, now let's take a look
at what we have got. Great!
| | 04:32 | So as we go from record-to-record, we
can see all the different Invoices that
| | 04:37 | were created by the samecustomers, so
here is all the other Lightningfast one
| | 04:40 | and we can drive what
other information that we need.
| | 04:43 | Now here's a one thing that's kind of
interesting though is that you'll notice
| | 04:46 | the first record in each of these is
the same record that we were on.
| | 04:50 | It's a little bit redundant information.
These are Invoices from the samecustomer.
| | 04:53 | We want to kind of remove that from the context.
| | 04:55 | So we can just do one quick update
to the relationship, which is common in
| | 05:00 | these self relationships. And that
is where we are going to say, if the
| | 05:04 | InvoiceIDs match, we don't want to show it.
| | 05:06 | So what we will do to add the
additional criteria is say show me everything
| | 05:10 | where the CustomerIDs are the same,
but where the InvoiceIDs are not.
| | 05:15 | So what that will do is show me all of
the Invoices, except for the one that
| | 05:18 | we are actually on.
| | 05:19 | So let's see how that changes.
| | 05:22 | Now we see we just have the one and
here the top one is no longer the one that
| | 05:26 | we are on, that's enforced all the way
throughout where there are other related Invoices.
| | 05:31 | So FileMaker's Relationship graph
allows you to create all sorts of query type
| | 05:35 | relationships between table occurrences.
You can even create relationships
| | 05:38 | between two table occurrences
that are based on the same table.
| | Collapse this transcript |
| Working with cascading portals| 00:00 | Portals in FileMaker are primarily use to display
related data in the context of a parent record.
| | 00:05 | So for example we've got the
Customer Details here on screen.
| | 00:09 | This is a Layout that's based on the
customer context, and here we're showing
| | 00:14 | related data from a child table.
| | 00:16 | So the idea here is that, we put the
portal in the context of customer to show
| | 00:20 | related child records from a
child table, which is called Invoices.
| | 00:24 | In standard one-to-many relationships
placing a portal based on the child table
| | 00:28 | on a layout, based on the
parent is a basic use of the portal.
| | 00:31 | It's intended to see related records
while looking at the parent record.
| | 00:35 | In previous movies we looked at ways
that portals can be used for other purposes
| | 00:39 | besides just looking at child
records from the context of a parent.
| | 00:42 | And in this movie we're going to create
a portal on the Customer Details layout
| | 00:46 | that displays all of the product invoices records.
| | 00:49 | whenever a user selects the
Invoice from the portal above.
| | 00:53 | So one of the strikes here is that, each
invoice has many different items on it.
| | 00:57 | In an earlier movie we added this rollover
here where, if you hover over the
| | 01:01 | icon you can see all the different individual items.
| | 01:04 | What if we wanted to see more information
about those items? How about we put a
| | 01:08 | portal on the layout, so that when you
click on this, it populates the portal
| | 01:11 | with just the related records from the
chosen Invoice? Seems simple enough and
| | 01:15 | certainly could enrich our
layout here for the Customer Details.
| | 01:19 | First we have to take a look at the
relationships that we already have.
| | 01:23 | You'll notice that we're on
Customer, we're seeing Invoices.
| | 01:26 | Now we're going to want to portal
that shows product Invoices Records.
| | 01:30 | But that means we're going to have to
have a relationship between Customers and
| | 01:33 | Product Invoices directly, which is a
little bit weird, it's certainly not a one-
| | 01:36 | to-many, but this will allow us to "drill down"
into what our called grand child
| | 01:41 | records, so parent child, grandchild.
| | 01:43 | So we do need a relationship directly
from Customers to Product Invoices.
| | 01:47 | So the question of course is
what's the match field then?
| | 01:50 | We need to have a field that tells us
inside the Customer table which Invoice it
| | 01:55 | is that we want to see the
Product Invoices records for.
| | 01:58 | So that seemed easy enough.
| | 01:59 | But you might be wondering why
can't I just put portal based on this
| | 02:02 | relationship already on the layout.
| | 02:04 | Well let's take a look what happens when we do that.
| | 02:07 | So let's say we draw portal and
we'll call it ProductInvoices and do a
| | 02:18 | scrollbar, we'll just say Amount and Part
Number, Quantity, Unit Price for example, okay.
| | 02:28 | So now we go into Browse mode and
certainly we do see related data.
| | 02:34 | What we're actually looking at are all
of the ProductInvoices from any Invoice
| | 02:40 | related to the Customer.
| | 02:41 | But what we want is we want to pick a
certain Invoice and have it only show
| | 02:46 | those product invoices, so again that
means that we need to have a MATCH FIELD
| | 02:49 | in the Customer in table that only
contains the ID of a selected Invoice.
| | 02:53 | So what we're going to do is we're going
to create a Field in the Customer table,
| | 02:57 | and we're going to call it InvoiceIDset.
No particular reason why, but
| | 03:04 | I'm going to create that make it a text.
And as with a lot of these other kind
| | 03:09 | of interesting utility relationships. I'm
going to make this one global, that way
| | 03:13 | its session specific.
| | 03:14 | So one user can pick an ID on their
record and it's not going to mess up
| | 03:19 | another user's experience.
| | 03:21 | So another user isn't going to see
some other ProductInvoices portal get
| | 03:24 | populated. So making it global, just
simply means that its session Independent.
| | 03:30 | So now we'll look at our relationships.
I want to create another table
| | 03:33 | occurrence from ProductInvoices.
We'll call this one customers, because
| | 03:38 | that's our starting context underscore
PRODUCTINVOICES that's in all caps,
| | 03:46 | because that's what the table
occurrence is based off of where it's a data that
| | 03:50 | we're seeing and we'll just say, Select.
| | 03:53 | So now, we want to create a relationship.
This is something that I like to do
| | 03:59 | instead of scrolling through all of
these I'll just pick two of them, and then
| | 04:02 | just double-click on the equal sign,
so that way I can more easily find the
| | 04:06 | ones that I'm looking for. So we'll
say InvoiceIDset to InvoiceIDfk. The
| | 04:11 | reason for that is because we're going
to populate this with the InvoiceID that
| | 04:15 | was chosen by the user in the top
portal, and so we want that to show product
| | 04:19 | invoice records that already have that
same ID value in the foreign key field,
| | 04:24 | thus meaning they are related
to the invoice that was chosen.
| | 04:29 | So InvoiceIDset, which is this new
global user interactive field, and then the
| | 04:33 | existing foreign key field, so let's
hit OK, let's go ahead and make that one
| | 04:38 | purple, just to stay consistent.
| | 04:42 | Now, let's replace the one that we
have on the Layout with this new one we
| | 04:48 | created, so that's going to be
Product customer_PRODUCTINVOICES_select.
| | 04:53 | Actually we'll just create another one from scratch,
so don't have to update all of those fields.
| | 04:59 | Okay customer_PRODUCTINVOICES_select,
scrollbar and let's do
| | 05:08 | the Amount, Part Number, Quantity, and Unit Price.
| | 05:17 | And we'll put Part Number first, Okay.
| | 05:24 | So now we'll go into Browse mode and we're
going to see that this portal isn't populated.
| | 05:30 | Even when I click on one of those what
it does is it's navigating me over to the
| | 05:35 | original layout, so we're going to change that.
| | 05:38 | So what I need to do is make it so that when I click
on this it populates that field that we created.
| | 05:44 | We actually put that on Layout here so you can see it.
| | 05:49 | So here is InvoiceIDset, now I could do
this manually, so if this is Invoice 6,
| | 05:58 | I could just type in 6 and commit.
| | 06:00 | And there are the items you can see we
can cross-reference this a little bit
| | 06:04 | glasses, I have don't have the ID name on here yet.
| | 06:07 | But if I did want to add the name of course,
since I need to add it to the context of this portal row;
| | 06:14 | that means that, that table occurrence
at the portal rows is based off, of it
| | 06:18 | needs to have a relationship with the Products table.
| | 06:21 | Double-click this one copy, create a new one,
base it off, of Products, use that
| | 06:29 | same one in this set instead of select.
| | 06:33 | So Product and we're going to say select.
But this one is going to be showing the products.
| | 06:43 | Here we'll make it, just pick two of them again and we'll
change those here, so it's ProductID, the ProductID.
| | 06:52 | All right, and the reason behind that
is simply that I can now show those items
| | 07:04 | on the layout, so we'll do Amount, Unit
Price, make those smaller. Now in the
| | 07:11 | context established in this portal row
| | 07:13 | I can add a field based on the relationship
to show me the item, all right.
| | 07:21 | Just wanted to show that to you again
because that's pretty common practice.
| | 07:25 | So here is the children's bicycle helmet,
as you see Portable pump Unisex
| | 07:30 | glasses and all the other corresponding information.
| | 07:33 | So the idea here is that instead of the
user having to populate this, why don't
| | 07:37 | we make a script populate that.
| | 07:40 | So here is that button that already has
a script attached to it, a go-to related
| | 07:47 | record. Instead, what we're going to do is
we're going to create a new script and
| | 07:53 | we're going to say, SetInvoice and
that'll be Set Field, pick the ID, set and
| | 08:06 | what we're going to do is pick the related InvoiceID.
| | 08:11 | So a Set Field will work in the context
of whatever portal row the user selecting it,
| | 08:15 | it'll pick the InvoiceID of that portal
row selected, and then,
| | 08:19 | place it into the field, and then as
with any Set Field we want to follow it
| | 08:26 | with a Commit Records/Requests,
especially when it's driving a relationship.
| | 08:31 | So now let's go in a Browse mode
and try out our new relationship. So here ID 1, ID 8.
| | 08:39 | So now that what we're able to do is
have a relationship from Customer, and
| | 08:43 | then to Invoices, and then from
Customer to ProductInvoices, which allows us to
| | 08:48 | provide the appearance to the user that
they're drilling down into that relationship.
| | 08:53 | But one thing that might not be such a
bad idea is to add a OnRecordLoad, meaning
| | 09:02 | every time we go from record to record,
we're going to clear that filter out.
| | 09:07 | Because otherwise you could navigate
from one record to the next
| | 09:12 | and the next record will be showing the
product IDs from the previous ones.
| | 09:15 | So we're just going to do a little
nice clean sort of make sure we're empting
| | 09:20 | that out every time we navigate to a
new layout, and let the user pick the one
| | 09:24 | that they want, so IDset and we'll say, quote, quote.
| | 09:28 | And of course, as always, follow with the
Commit Records/Requests hit OK, hit OK.
| | 09:38 | And now let's look at our Browse mode.
| | 09:41 | So we see anytime a record is created,
so we'll populate it with that one, go to
| | 09:45 | the next record, clears it out, populate
it with that one, next record and so on.
| | 09:49 | So query relationships have many uses
in FileMaker, and in this example we see
| | 09:53 | how you can use them to allow your users to,
what appears to them at least,
| | 09:57 | drill down into related data
through a set of different portals.
| | Collapse this transcript |
|
|
8. Scripting for DevelopersConditional branching using the If script step| 00:00 | Earlier in this course, I discussed
the If function that's used inside
| | 00:04 | calculation formulas and also calculation
dialogs. I explained how it could
| | 00:09 | help you add conditions to
your calculation functions.
| | 00:12 | At the time I also mentioned that there
is one other area inside the FileMaker
| | 00:16 | Pro development environment where you
can also add conditions. That's in the
| | 00:20 | Scripts by using a Script Step
that's called the If Script Step.
| | 00:25 | When you introduce conditions into
your Scripts, this is commonly referred
| | 00:28 | to as conditional branching.
| | 00:31 | Conditional branching refers to the
ability of a Script to be able to perform
| | 00:34 | different sets of actions under different circumstances.
| | 00:37 | If you look inside the Script Maker,
you'll see that we've got the If Script
| | 00:45 | Step which comes with its companion End If.
| | 00:48 | We've also got Else If and the combination
of these allow you to introduce
| | 00:54 | either one or multiple tests and then,
based on whether or not that test is true
| | 00:59 | or false, you can then run some other activity.
| | 01:01 | So the If and Else If Script Steps
require you to provide a calculation,
| | 01:06 | as you can see. You'll see the familiar
Calculation dialog, and then whatever the
| | 01:10 | formula is. It's going to be Boolean, so it's
either going to have a true or false answer.
| | 01:15 | So if true, then whatever the task is that's
inside between the If and the End If,
| | 01:21 | well that will be performed.
| | 01:23 | If it's false, it will move on to the
next test, just like you do inside of a
| | 01:28 | branching calculation formula.
| | 01:30 | So when you are planning on adding
conditions into your scripts, you need to
| | 01:33 | decide what the test is going to be.
And it needs to be a Boolean calculation
| | 01:37 | formula that will either have a true or a false answer.
| | 01:40 | Then you'll decide what script actions
are going to be performed when true,
| | 01:44 | and potentially which ones might
even be performed when false.
| | 01:46 | Just like in a calculation, you're going
to decide what values are displayed if
| | 01:50 | the calculation test is true, and
then what is displayed when it's false.
| | 01:55 | So let's look at our example file
and let's come up with a scenario here.
| | 01:59 | One thing you might notice is that
we've got a Print button on each of the
| | 02:02 | Invoice records and when I hit the
Print button, it pops up a new window
| | 02:07 | with this stylized invoice that's created.
| | 02:10 | The problem is, if a customer has
already paid, we'd rather have it produce a
| | 02:16 | statement or a receipt, let's say rather than the invoice.
| | 02:19 | So for example you'll notice that we've got
an Invoice Layout and we have a Receipt Layout.
| | 02:24 | So if they've already paid for it, we'd
like it to show, here is what you paid,
| | 02:28 | Thank You For Your Order!,
all that type of thing.
| | 02:31 | But if it's not paid, then yes, we'd
like to show it as an invoice, so that
| | 02:35 | we can give other information like
when it's due and what the subtotals are
| | 02:38 | and that type of thing.
| | 02:39 | So basically, we've got either an
Invoice Layout or a Receipt Layout.
| | 02:44 | We would like, when the user hits that
button, for it to automatically go to the
| | 02:49 | appropriate layout based on a condition
that we're going to introduce in the script.
| | 02:53 | So it makes sense that we would want
to update the existing scripts. So why
| | 02:56 | don't we go into the Layout mode and
let's right-click on that button, so we can
| | 03:03 | see what script is assigned to it.
| | 03:04 | We've got one that's called Print Invoice,
so let's go in and select Edit and
| | 03:10 | say Print Invoice or Receipt.
| | 03:14 | First, we're going to change this and
right now all it's doing is performing a
| | 03:18 | Go to Related Record Script Step,
which of course does a couple of different
| | 03:21 | things; it opens up a new window
and navigates us to the proper layout.
| | 03:25 | So we're going to want to have two
different Go to Related Records, because
| | 03:27 | we're going to change the layout,
but first we want to introduce our If.
| | 03:32 | So let's double-click on the If
and we see it gives us an End If.
| | 03:36 | So in between those is where we say
what the test is and what happens if it's
| | 03:40 | true, what happens if it's false.
| | 03:42 | So let's first add our condition.
| | 03:45 | So we're going to say, when
Payment Status="Paid", if that's true,
| | 03:55 | then we want it to go to the one that
says Invoice; this is correct.
| | 04:00 | So now what we want to do is
introduce what happens if it's false.
| | 04:04 | In that case, what we want it to do is
go to same thing, Go to Related Records,
| | 04:07 | but a different layout.
So let's add something called an Else.
| | 04:11 | So an Else allows us to say, if this is
true then do this, otherwise do whatever
| | 04:16 | comes between the Else and the End If.
| | 04:18 | So what we're going to do is duplicate
the Go to Related Record and open this up.
| | 04:24 | We'll say instead of Invoice, we'll
say Receipt and also, more importantly,
| | 04:32 | we're going to change to the Receipt
Layout, so it's still doing all the same
| | 04:37 | activities, but going to the Receipt Layout instead.
| | 04:40 | If we read it, it says, if the
invoice that you are on, when you hit this
| | 04:44 | button, has a Payment Status of Paid,
then perform the script that opens up a
| | 04:48 | new window and navigates to the related
product invoice records, but shows them
| | 04:52 | in a Receipt form, it actually should
be opposite, so we'll go Go to Related
| | 04:57 | Records down here and Paid.
| | 04:59 | So here, when it's Paid, show
the receipt in a new window.
| | 05:03 | Otherwise, if it's not paid, show
the invoice, which of course means it's
| | 05:07 | unpaid, because we only have two values.
| | 05:10 | Now one thing that we haven't captured
yet is what happens if that value is empty.
| | 05:13 | So in that case we don't want to print anything.
| | 05:16 | So what we do here when we have an If
and an Else is we just say, if this is
| | 05:20 | true then do this, otherwise do that.
But what if we have other tests?
| | 05:24 | Now in a calculation we would have used a
Case statement, but we don't have a Case script.
| | 05:29 | What we can do instead is
introduce what's called an Else If.
| | 05:34 | So Else If, instead of an Else,
allows us to create another test.
| | 05:39 | So here I can say, if the Payment Status
equals Paid, go ahead and copy that, do this,
| | 05:47 | Else If the Payment Status equals UnPaid, do this.
| | 05:54 | And we'll do another Else If.
| | 05:56 | Else If Payment Status equals nothing,
then we'll do something that's called
| | 06:03 | Halt Script, that will just
stop it from performing anything.
| | 06:07 | So that way we don't know what to
print in that case, so we could pop up a
| | 06:11 | message to the user as well using the
Show Custom Dialog, it says
| | 06:20 | No Status Given or something along those lines.
| | 06:23 | And then when the user hits OK,
then it will go to cancel it.
| | 06:27 | So the idea here is that, you can use
an If if you have a true and a false; and
| | 06:30 | then some actions that you want to
have happen when it's true, and one if you
| | 06:34 | want to have it if it's false. Or you
can have multiple tests and multiple
| | 06:37 | actions; and you can have unlimited
amount of those, which is the same kind
| | 06:40 | concept as a Case statement, but it's
really just If statements, a bunch of Ifs
| | 06:44 | that are called Else Ifs.
| | 06:46 | Now we need to close this out with an End If,
so our script knows when to stop
| | 06:49 | performing all the conditional values
and then it could carry on to other
| | 06:52 | non-conditional script stepped actions as well.
| | 06:56 | So let's try this out, go into Browse mode.
Here we're on a record that is Paid.
| | 07:04 | So when I hit Print, it says Thank You
For Your Order!, which is exactly what we want,
| | 07:07 | it's showing the Receipt, as you see there.
| | 07:10 | But if I navigate to the next record and
I hit Print, it's now navigating to the Invoice,
| | 07:15 | which is exactly what we wanted.
| | 07:19 | Now if we go to one of these values
that's empty, or if we clear out one of
| | 07:25 | the values, here is one that's empty,
now it will pop up and say,
| | 07:29 | No Status Given, and it just quits.
| | 07:30 | So those are the three different
conditions that we included here.
| | 07:33 | There is something that's kind of important here.
| | 07:35 | Any time you have a Go to Related
Record Script Step, it's going to navigate to
| | 07:40 | the context of whatever your
child table is and then do something.
| | 07:44 | But let's look at what happens here
if we don't have any Related Records.
| | 07:48 | I hit this button, nothing is happening.
| | 07:53 | And the reason for that is because
there are no records to go to,
| | 07:56 | there is no Go to Related Records.
| | 07:59 | So what we'd like to do in the cases
of Go to Related Records is add a little
| | 08:02 | bit of a trap, because what could
happen for example is, you might end up
| | 08:08 | doing something that you think is
supposed to be happening in a new window on
| | 08:12 | your Related Records, but it's actually
going to end up happening in this window instead.
| | 08:15 | So for example if this script had
something like well, let's say Print;
| | 08:21 | what if we said open up the related
window and then delete all the records?
| | 08:26 | Unfortunately, in that case what
would happen is that if we didn't have any
| | 08:29 | related records, we wouldn't open a new
window, but we would still carry on with
| | 08:32 | the delete and that could be very dangerous.
| | 08:34 | So here is a trap that we're going to
add that will not even pop this up in the
| | 08:38 | event that there are no related records.
| | 08:40 | So here is what we're going to do,
we're going to add a trap or another If
| | 08:44 | condition to this that's going to make
sure to only run this if in fact we do
| | 08:50 | have related records.
| | 08:51 | So here is an If, let's put it at
the very top and the very bottom.
| | 08:55 | So what we're doing is we're wrapping all
of these other statements in one big If.
| | 08:59 | And the test that I like to use to precede
any Go to Related Records is IsValid,
| | 09:06 | one that we talked about earlier in this course.
| | 09:09 | I am going to say IsValid, does this
invoice have any ProductInvoice values,
| | 09:18 | pick a nonempty value.
| | 09:21 | So we are simply saying IsValid and
then we pick a value from the child table.
| | 09:25 | And this just says, hey!
Do we have any related records?
| | 09:29 | So if this is true, then all of this is
going to perform, else if it's not,
| | 09:37 | I am going to hit Halt Script and so nothing
will happen, or I could put another one
| | 09:42 | of these custom dialogs.
| | 09:46 | So let's say No Line Items Present,
or something more creative.
| | 09:57 | So we'll close out this window and hit Save.
| | 09:59 | So now let's see what happens is it will still print.
| | 10:03 | This one doesn't have a status, so it's
doing the correct thing there, this one
| | 10:05 | will print, doing the correct thing there.
| | 10:08 | But if we end up with no line items,
it pops up and says No Line Items
| | 10:12 | Present and then cancels.
| | 10:14 | So a conditional branching offers the
ability of a script to perform different
| | 10:17 | sets of actions under different
circumstances, all on the same script.
| | 10:22 | So understanding, how to use the If,
Else If and End If in your scripts,
| | 10:26 | allows you to create scripts with several
layers of conditions and makes your scripts
| | 10:30 | more compact and efficient.
| | Collapse this transcript |
| Allowing customer input with custom dialogs| 00:00 | One common scripting pattern in FileMaker
involves interacting with a user and
| | 00:04 | then performing actions based
on that user's responses.
| | 00:07 | In this movie, I am going to discuss how
to use the Show Custom Dialog Script
| | 00:11 | Step to allow you to have your users
tell the script which action to perform
| | 00:15 | based on their response.
| | 00:17 | Allowing user input is a great way to
present the user with choices that will
| | 00:20 | determine how the rest of the script will function.
| | 00:23 | Now in the previous movies, we've
already used the Show Custom Dialog
| | 00:26 | Script Step and it's generally used
to display a customizable dialog box
| | 00:31 | that can provide the user with information or
prompt him or her for input on their decision.
| | 00:35 | Once this step has been added to your
script, you can then customize the dialog
| | 00:39 | that will be presented to the user.
| | 00:41 | So let's add one of these to our
Print Invoice or Receipt script.
| | 00:47 | So we've got Print Invoice or Receipt.
| | 00:49 | What this is doing is just checking to
see what the Payment Status is and then
| | 00:52 | also doing a IsValid to make sure that
there are related records. If so, it's
| | 00:57 | running a Go to Related Record Script.
| | 00:59 | So it's similar to one that we've done
in previous movies with one difference.
| | 01:02 | And that is that we're showing the
Print Script Step here. But what about if we
| | 01:07 | want the user to pick whether or not
they want to print or save as a PDF?
| | 01:11 | So what I am going to do first is create
a new script that's called Print or PDF.
| | 01:20 | So in this case, what I am going to do
is choose one of those Show Custom
| | 01:24 | Dialogs that I talked about before.
| | 01:26 | You'll see the Show Custom Dialog
Script Step as a Specify button,
| | 01:31 | which allows us to choose all
sorts of different values here.
| | 01:33 | So we have a Title field that allows
us to populate the title of the window.
| | 01:39 | So we can say Pick Print or PDF and
then here is the message. Of course
| | 01:46 | these can also be dynamic driven by the
Specify Calculation Dialog window in both cases.
| | 01:52 | Here we'll say, and one thing I like to do
when I am using the Calculation Dialog,
| | 01:57 | is say something like, Get AccountName
is the person who is logged in.
| | 02:02 | So I can say something like, whomever their
name is, would you like to PRINT or SAVE AS PDF?
| | 02:14 | Okay and that's the message
that's going to show up in the dialog.
| | 02:16 | And this is what I'll do, I'll say
you've three different button options;
| | 02:20 | the Default button is what you are looking
at here. You've got the Default button as
| | 02:24 | one that's going to be highlighted already.
So if the user hits the Enter or Return,
| | 02:27 | it's going to execute that option.
| | 02:28 | So Default is button one, we'll call that
the PRINT. Button 2 is going to be PDF.
| | 02:34 | We'll remember that PRINT is number one,
PDF is number two, and we'll hit OK.
| | 02:40 | So now what we're going to do following
the branch, we've asked the user to
| | 02:44 | pick one of the two options and perhaps
let's say we want them to be able to
| | 02:48 | hit Cancel as well.
| | 02:50 | So we've got PRINT as one, PDF as
the second, and Cancel as the third.
| | 02:56 | So now let's close that window.
| | 02:58 | Now we've got conditional branching elements.
What we need is an If Script Step
| | 03:02 | to determine what happens
when each button is pressed.
| | 03:04 | So what we can do now is add an If
that will immediately follow the custom dialog.
| | 03:11 | Here what we're going to be saying is
if the user pressed one, do this,
| | 03:15 | if they pressed two, do that and so on.
| | 03:17 | The trick there is a Get function
that's called Get LastMessageChoice,
| | 03:26 | which is specifically for this purpose.
| | 03:28 | We're going to say if the Get (LastMessageChoice)=1,
which was the first button,
| | 03:32 | which was PRINT, then we're going
to present them with the
| | 03:37 | Print dialog, there is Print.
| | 03:42 | Let's create another Else If, which
means otherwise what if, let's copy this,
| | 03:52 | Get (LastMessageChoice)=2, then
what we're going to do is save as PDF,
| | 04:03 | Save Records as PDF and let's do a third one
where we say if Get (LastMessageChoice)=3
| | 04:12 | we are just going to do a Halt Script or Exit Script.
| | 04:16 | So I created this as a separate script,
so that way I didn't have to go into the
| | 04:20 | original script and type all those
different values in each instance. This way I
| | 04:26 | can just call all of them as a group.
So I've got this subset of script steps
| | 04:30 | that I've saved as its own script and
instead what I can do is delete where it
| | 04:34 | says Print and instead say print.
| | 04:38 | So after each Go to Related Records,
I can just say perform the subscript
| | 04:43 | which was, what did we call it, let's
see, we haven't saved it yet, so let's
| | 04:49 | save this, there we go.
| | 04:51 | So Perform Print or PDF and I'll duplicate
that and put that down here as well
| | 05:01 | after the Go to Related Record.
| | 05:03 | In this way if there are other scripts
that might need the option to choose
| | 05:06 | between printing or saving records as
PDF, we can just call this subscript in
| | 05:11 | those as well, sort of some
modular scripting FileMaker wise.
| | 05:17 | Let's take a look at how this works.
| | 05:20 | If we go into the Print button, which
is what this is attached to, we can say
| | 05:24 | Print and now it says, Admin by the
way is my login name, so it's saying hey
| | 05:29 | Admin, would you like to PRINT or SAVE AS PDF?
| | 05:31 | I am going to say Cancel, which means
it stops that option, which is fine.
| | 05:35 | I could close that window.
| | 05:36 | But how about if I say PRINT, what
it's going to do now is it's popped up our
| | 05:40 | printer driver window and I can proceed
with the script; or the other option is I
| | 05:46 | can say SAVE AS PDF, so now it's going
to ask me where I want to save the PDF
| | 05:51 | and it will go through and pull up
the Adobe driver and print that.
| | 05:56 | So the Show Custom Dialog Script Step
is used to display a customizable dialog
| | 06:00 | box that can provide the user with information
or prompt his or her for input or a decision.
| | 06:06 | This will allow the users to provide
input, which is a great way to present
| | 06:10 | the user with the choices that will
allow them to control how the script
| | 06:13 | actually functions.
| | Collapse this transcript |
| Using loops in your scripts| 00:00 | So far we've been looking at using scripts to
perform an action against one record at a time.
| | 00:05 | So we'll have a button on screen,
the user picks that button and then it
| | 00:09 | performs a series of scripted
steps against that one record.
| | 00:13 | However sometimes, actually quite frankly
many times, you might want to perform
| | 00:16 | actions against a found set of records all at once.
| | 00:20 | This would be FileMaker's version
of running batch operations.
| | 00:24 | In FileMaker, we call these performing
loops or looped activities.
| | 00:27 | This movie focuses on using loops to
perform a set of scripted tasks in multiple
| | 00:32 | different times once for each record in a found set.
| | 00:35 | Looping is a very common and useful script
concept particularly for reporting routines.
| | 00:40 | The loop script step allows you to
execute a series of script steps over and
| | 00:44 | over until some exit condition is reached.
| | 00:46 | Looping scripts are commonly used for
iterating over a found set of records and
| | 00:52 | you'll notice that there are some supported script steps.
| | 00:54 | So we have Loop and End Loop, very
important End Loop and even Exit Loop If.
| | 01:01 | Those are the different ones available to us.
| | 01:03 | There are a few rules to follow when
using loops in your scripts and sort of a
| | 01:07 | general structure that you want to be aware of.
| | 01:10 | The first part of the loop structure
is called initializing the loop and this
| | 01:13 | usually involves going to the first
element or record in the found set and
| | 01:17 | setting one or more variables to an initial state.
| | 01:20 | In most cases, this is just go to
the first record in a found set.
| | 01:24 | Then there is beginning the loop.
| | 01:25 | This is where you actually do something.
| | 01:27 | You want to print something or set
some record to some value or something,
| | 01:31 | whatever it is that you're trying to accomplish
over and over again, you do that here,
| | 01:34 | just the one time.
| | 01:36 | This is usually a series of script steps
that operate on the current record;
| | 01:40 | then of course you want to move to
the next record in the found set.
| | 01:43 | Then finally you want to end the loop,
this is really important.
| | 01:46 | This is where you test to see if
the exit condition has been met,
| | 01:49 | so that you can stop the loop.
| | 01:51 | Otherwise you could have something
that's called an infinite loop.
| | 01:54 | So you want to learn this generalized
structure, build your looping scripts as
| | 01:57 | closely as possible according to this model.
| | 01:59 | It makes it easier to write looping scripts
and to modify and extend them down the road.
| | 02:05 | So say for example in our file we want
to print an invoice or print a receipt
| | 02:08 | for all of the invoices in our found set.
| | 02:11 | Up until this point, we've just had the
user click a button to do it one at a time.
| | 02:16 | So let's say we want to do
that across the entire found set.
| | 02:19 | So in this case a looping script will
deal with a set of objects and here it's
| | 02:24 | going to be a set of invoice records
and we'll create the found set.
| | 02:28 | So it's really important that
we do a couple of things here.
| | 02:30 | We have to have a way to move from
object to object and set an exit condition.
| | 02:34 | Let me show you what I mean there.
| | 02:36 | So let's create a new script and
we'll call this one Loop Print or PDF.
| | 02:46 | Now first we want to start our loop or
initialize our loop and even before that
| | 02:49 | we're going to want to go to the first
record in the found set, this is the most
| | 02:53 | common initializing of a loop in FileMaker.
| | 02:56 | So you see we Go to Record/Request.
If we had 25 records, we want to make
| | 03:00 | sure we start with the first one,
because otherwise the loop will just perform
| | 03:02 | at whatever the active record is and go
all the way to the end of that found set
| | 03:06 | and in that case you might omit
several different records in the found set.
| | 03:10 | So we initialize the loop by going to
the first record, open up the loop that's
| | 03:14 | part of the initialization as well
and now we have to do something in here.
| | 03:18 | So what I am going to is I am going to
just simply say Perform Script,
| | 03:22 | perform the Script that we already created.
| | 03:25 | This seems easy enough.
| | 03:26 | So now what we have to do is move to the
next element or move to the next record.
| | 03:30 | We're also going to use the
Go to Record/Request Script Step.
| | 03:34 | I am going to put that after the performing of the script.
| | 03:37 | Now here is the key, this is critically important.
| | 03:38 | We have to have a way to move from
object to object in the found set,
| | 03:41 | but also to have an exit condition.
| | 03:43 | The Go to Record/Request option
provides us with the ability to do that.
| | 03:47 | We can say instead of Go to Record/
Request first as we have here, I can say
| | 03:53 | Go to Record/Request Next and what's nice
about that is it's got a little Exit after last option.
| | 03:59 | So we can accomplish going to the
next record and exiting the loop
| | 04:02 | if we encounter the last record in the
found set all in one script step.
| | 04:07 | So failure to have both the ability to
advance to the next record and to get out
| | 04:11 | of a loop will give you an endless loop.
If the script does not have some
| | 04:16 | way to exit, the only way that you can
stop that is by quitting FileMaker.
| | 04:20 | You got to be careful even in your
testing environment to avoid that.
| | 04:23 | So pretty simple, we're just running
the same script that we've created before this,
| | 04:28 | but we're wrapping it in some of
the structured loop elements inside of a
| | 04:32 | script to make sure that it
can go from record to record.
| | 04:34 | So let's add that to our layout.
| | 04:38 | If we go into Layout mode, let's just
drag this button over here and I can call
| | 04:45 | this one Print All, and in this case,
I'll attach the new script we created.
| | 04:57 | So now when we go into Browse mode,
we could create a found set, let's say
| | 05:07 | Abbott has two records, so instead of
printing one at a time, let's try printing all.
| | 05:11 | So we hit Print All and we see it's gone
to the first record and I'm going to print it,
| | 05:18 | continue the script and now it's gone to the
second record to see Invoice 6, we say Continue.
| | 05:25 | We see now it leaves us at the end of that record.
So we could've printed or saved as PDF.
| | 05:30 | So just a real quick example of being
able to isolate some activities where we
| | 05:33 | first create the found set, initialize
the loop by going to the first record in
| | 05:37 | the found set, we do something, advance
to the next record and also apply some
| | 05:41 | sort of exit condition, so we
don't get into some permanent loop.
| | 05:44 | The Loop Script Steps allow you to
execute a series of Script Steps over and
| | 05:47 | over until some exit condition is reached.
| | 05:50 | Looping Scripts are commonly used for
iterating over a found set of records and
| | 05:54 | performing actions pertaining to those records.
| | 05:57 | So by following the loop rules and structure,
you can perform one Script Step
| | 06:01 | or 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:00 | When you're working inside your database
and you have a field somewhere,
| | 00:04 | if you want to change the data in the field,
you just pick the field that you want,
| | 00:07 | click inside of it, type something
and then commit the record.
| | 00:11 | In this case I clicked outside of
the field to commit the record.
| | 00:14 | Sometimes when you write scripts,
| | 00:16 | you might want to have to write something
to a field just like I did here.
| | 00:20 | In these cases, your best tool to do this is
something that's called a Set Field Script Step.
| | 00:24 | So you can see down here Set Field.
| | 00:27 | What Set Field allows you to do is pick
the field, much like clicking inside of
| | 00:32 | a field, and then inside a Calculation
dialog, you can put the formula or the
| | 00:38 | value that you want to have written to that field.
| | 00:40 | So it's really the same type of thing, but
allows you to do it inside of the script.
| | 00:44 | So for example, let's say when we're
running our Print Invoice or Receipt script,
| | 00:50 | that's attached to this button, we also
want to have it write some value
| | 00:54 | inside the field that says that this
was either sent to a customer as a receipt
| | 00:58 | or an invoice for example,
maybe with a little timestamp.
| | 01:00 | So to do that first we're
going to need to have a field.
| | 01:04 | So let's go in here and
call our new field PrintStatus.
| | 01:11 | That way we can always look and see,
oh, was this ever sent or generated or whatever,
| | 01:15 | provides kind of like a little log
for us; and let's go into Layout mode.
| | 01:20 | And add that to our layout, copy
this, drag it down and that's called
| | 01:28 | PrintStatus, let's just add that here
and one last little thing that appears.
| | 01:40 | So now we have a field and what we
want to do is write that field every time
| | 01:45 | something is printed, so we have to modify
our script in order to be able to do that.
| | 01:50 | We go into the Print Invoice or Receipt script.
| | 01:52 | You see that, if it's Paid,
we're going to generate a Receipt;
| | 01:55 | if it's Unpaid, we're going to generate an invoice.
| | 01:58 | And after we print, we're closing the window,
but what I'd like to do is write a
| | 02:04 | value to the field, so if I go in here
and pick my Set Field Script Step in
| | 02:09 | between printing and closing, so after
the printing is done, I'm going to pick a
| | 02:13 | field and that's going to be this PrintStatus field.
| | 02:18 | So it's just like clicking inside the field
and now I'm going to use all the tools
| | 02:21 | at my disposal on this Calculation dialog
to come up with the value that's
| | 02:25 | going to get written inside that field.
| | 02:27 | So I could just put some text like "Sent To Customer"
but I'm going to add some more to that.
| | 02:32 | I'm going to say Sent To Customer
and I'm also going to add to that a little condition here.
| | 02:37 | So let's say If the Payment Status,
this is going to be the same rule that we
| | 02:43 | are adding in the Script Step,
if Payment Status="Paid", then I'm going to
| | 02:49 | have the text and invoice otherwise Unpaid
an Invoice, otherwise I'm going to say --
| | 03:05 | So it's just going to say Sent To Customer
either an Invoice or a Receipt,
| | 03:08 | depending on whether or not the
Payment Status is unpaid or paid.
| | 03:11 | This is the same condition that we
already have in the script. At the end
| | 03:15 | of that, I'm going to add little space
and I'm going to use a Get function to
| | 03:20 | say Get (CurrentTimeStamp). Here we go.
So an Invoice or Receipt, so let's try this out.
| | 03:32 | Actually, what I'm going to do here is
duplicate that, in case it's unpaid as well.
| | 03:40 | So let's save this and let's give it a shot.
| | 03:43 | So here on this record, I've got Unpaid.
I'm going to hit Print. I am going to
| | 03:48 | say, let's do the Print option and go
ahead and proceed through there,
| | 03:55 | continue the script, which then sets our record,
so it says Sent To Customer an Invoice,
| | 03:59 | because it's unpaid. What about this
one? Being paid, hit Print, go ahead and
| | 04:05 | just continue that, cancel on
here, we sent him a receipt.
| | 04:08 | Now you can put whatever you want
inside of a script, which is why the Set Field
| | 04:12 | Script Step is so popular, but one thing
I'm going to mention is that you should
| | 04:17 | categorically avoid any script steps
that say Cut, Copy, and Paste.
| | 04:23 | The Set Field Script Step should always
be used as your first tool of choice for
| | 04:27 | manipulating any record data, whether
there's data already in the field, or you
| | 04:31 | are adding it for the first time.
You should avoid the Cut, Copy, and Paste
| | 04:34 | as well as Clear, because these steps
can overwrite the user's clipboard,
| | 04:39 | which can both be annoying and the
cause of some security issues.
| | 04:43 | More importantly however, all these
steps require that the reference field
| | 04:46 | actually physically be present
on the currently active layout.
| | 04:49 | So for example, in our Set Field, it
just so happened we were in the context of
| | 04:53 | this layout in our script, but if we
weren't, I could still set that value even
| | 04:57 | though the field wasn't present. But in
the case of Cut, Copy, Paste, or Clear
| | 05:01 | they all need to be on the layout.
| | 05:03 | So if you later remove the field from
the layout, the scripts might fail.
| | 05:07 | Set Field does not have that restriction,
so it's just a good rule of thumb to
| | 05:11 | always avoid Cut, Copy, Paste,
or Clear and always use Set Field.
| | 05:15 | So you'll find that Set Field will allow
you to add the results of a calculation
| | 05:19 | to any field, whether it's at the
focus on your layout or not, and
| | 05:23 | it will become one of the most used script
steps in your FileMaker toolbox as a result.
| | Collapse this transcript |
| Working with script variables| 00:00 | Script variables in FileMaker, which are
created using the set variable script step,
| | 00:04 | provide a temporary location for storing
data and then that data can then
| | 00:09 | be accessed from any context within the file.
| | 00:12 | Now this concept probably isn't too
foreign to you, because you're probably
| | 00:16 | already familiar with it from within
any application, where you can click
| | 00:19 | inside a field let's say and go to Copy
and then what that does is save it to a
| | 00:26 | temporary location and then anywhere else in
that file you can go in and paste it as well.
| | 00:35 | So that is very similar to the concept
of a variable, except what's nice about a
| | 00:40 | variable in FileMaker is that it provides
you the extra advantage that instead
| | 00:46 | of having only one location where you
can copy and paste something and then pull
| | 00:50 | it back later on when you're in the file.
| | 00:52 | It allows you to save it to a specific
location that you can name and then you
| | 00:56 | can call out that specific location to
retrieve that stored information later.
| | 01:01 | What's nice about being able to name the
location is that you can then be saving
| | 01:06 | several different things to several
different locations without clearing it out.
| | 01:10 | So unfortunately, with a clipboard in
your operating system that you're already used to,
| | 01:14 | when you copy something if you
then copy again, you then wiped out the
| | 01:19 | preceding stored value.
| | 01:20 | But with variables you can name a
location anything you'd like and then go set
| | 01:25 | it there for either the length of a
script or for the life of your user session.
| | 01:30 | So let's look a little bit
more into what a variable is.
| | 01:34 | You can tell a variable by its type.
There is a certain syntax that you need to
| | 01:38 | use before we even get into the script step;
it's how do we name these things.
| | 01:42 | Well the syntax is very important, you
can tell a variable's type by its syntax.
| | 01:47 | Local variables begin with a single dollar sign ($),
so for example $var means it's a local variable.
| | 01:53 | And a global variable is preceded
with a double dollar sign ($$)
| | 01:57 | and then whatever name you come up with.
| | 01:58 | Here I am using var, but you
can name it anything you want.
| | 02:02 | Now you can use these anytime you
need temporary storage within a script.
| | 02:06 | Now what's a local variable? That means
that it's only going to save that value
| | 02:10 | in memory until the script is done running.
| | 02:13 | So this is where you could set something
into storage and then retrieve it later
| | 02:17 | in the script from that same storage location.
| | 02:20 | In the case of a global variable,
they are a little bit more dynamic;
| | 02:24 | you can save something into FileMaker's
application memory and at any point in
| | 02:28 | your session you can then retrieve
that same value by calling out $$
| | 02:33 | whatever you name that variable.
| | 02:34 | So that's something that can be very useful.
| | 02:37 | In our case we're going to use a
script variable in our exercise file to save
| | 02:41 | the location where we want to save a PDF.
| | 02:43 | So for example here we've got this send by
email button that's already on the layout.
| | 02:49 | Now there is no script attached to it.
We have to author this script; but
| | 02:53 | essentially what we need to do is
create a PDF of an invoice or a receipt and
| | 02:59 | then attach that PDF to an email.
| | 03:02 | So FileMaker allows you to send an email
but it needs to already have a document
| | 03:07 | created in order to be able to attach
it to the email to send, so it's really
| | 03:11 | two different things that we're doing there.
| | 03:13 | So first of all, let's go into our script.
I believe there is a script in
| | 03:18 | here called Send Invoice by Email.
| | 03:20 | Let's author this first. What we want
to do is create a Go to Related
| | 03:25 | Record Script Step. I want to show
the Related Records from the Invoices
| | 03:32 | table and I'm going to use the
Layout that's called Invoice Details.
| | 03:37 | I want to show it in a new window;
let's say we'll make this window
| | 03:43 | 500 high and 400 wide, and the
distance from the top will be 100, 100;
| | 03:51 | inconsequential to the task at hand here,
but I do want to show only the
| | 03:54 | related invoice record items. So in that case
we are okay with our go to Related Records.
| | 04:01 | But we don't want to perform this
task unless there are related records.
| | 04:05 | In that case we want to put a trap in here.
| | 04:11 | We'll say If, and what's our trap
for Go to Related Records?
| | 04:15 | We talked about this earlier in the course.
| | 04:16 | But we'll say If IsValid and then from Invoice details
we actually want to show the Product Invoices.
| | 04:26 | So If any of them exist, then we
will go ahead and perform this.
| | 04:32 | Otherwise, we will exit the script.
| | 04:34 | Now that we've got that in place, we can address
what happens after we've gone to the related records.
| | 04:39 | So what we would like to do
there is Save Records as PDF.
| | 04:44 | You'll down here, under Save as PDF that
we've got to provide it with some information.
| | 04:54 | We could have this perform
without dialog, which is optimal.
| | 04:58 | But in that case we have to tell it
exactly where to save this PDF,
| | 05:02 | and incidentally, this is the same location
where the email needs to go find the PDF.
| | 05:07 | So what we could do is we could follow
the instructions below and hand type out
| | 05:11 | the location from the user's location
where FileMaker is, all the way to where
| | 05:15 | we could save a PDF and then
hand type that same thing later.
| | 05:18 | But instead what we could do
is set a variable with this location.
| | 05:24 | Let's go up to setting a variable
and at the very top of my script I am
| | 05:29 | going to go ahead and set a variable, very
simple, there is really only one option here.
| | 05:34 | You name it and then provide a value.
| | 05:36 | So I am going to name this one $path,
and as I mentioned before, if I proceeded
| | 05:40 | with a single dollar sign ($) that's a local variable.
| | 05:43 | I only need this to live in storage
until the script Send Invoice by Email
| | 05:47 | expires, so I am going to keep it as a local.
| | 05:51 | The value that I am going to
give it is a pretty handy string here.
| | 05:55 | So this formula Get (TemporaryPath)
followed by an ampersand (&)
| | 06:06 | and I want to name it something unique,
so we'll call it the number of the invoice.
| | 06:10 | And then at the end of it
I will put some text.pdf.
| | 06:15 | What this is going to do is dynamically
create a PDF that names it whatever
| | 06:20 | the invoice is, so Invoice this
would be number 4.pdf for example.
| | 06:24 | And it will save it to a temporary path.
| | 06:27 | Now Get (TemporaryPath) saves it to
some hidden location inside the FileMaker
| | 06:31 | application that then gets flushed
out whenever you close out FileMaker.
| | 06:35 | So this is a great way to not clutter up
the user's Desktop. There is also a
| | 06:39 | Get (DesktopPath) or a Get (DocumentsPath),
but this is a great way to do it in
| | 06:42 | a hidden location as long as we can go retrieve it later.
| | 06:45 | So what I am going to do is set that variable.
| | 06:49 | Now you're wondering why couldn't I just
have put this formula right in
| | 06:55 | the Save Records output file location?
| | 06:57 | Well, you can't put a formula, first
of all, in here, but what we can do is
| | 07:01 | reference a variable, pretty simple, nice and clean.
| | 07:05 | So now what's happening is we're
setting a variable and then we're running
| | 07:08 | this script, so we're going to Related Records
and then saving a PDF to that location.
| | 07:12 | Now it's saved in memory to a
specific location that we're calling $path.
| | 07:16 | So now the second half of this is that
I want to add very useful script step
| | 07:20 | here that's called Send Mail and this
will of course only happen when we've
| | 07:27 | validated that there actually is something
to print and save as PDF and then
| | 07:31 | that's what we'll attach to the email.
| | 07:33 | But you'll do this performing without
a dialog, so user doesn't have to enter
| | 07:36 | any of this information in here.
| | 07:38 | And so what we'll do, you see when
this pops up is we'll send one email and
| | 07:42 | we'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:00 | We could put a message in the body,
but for this sake what we see here is,
| | 08:04 | we have this attached file and lo and
behold it's the same specified file,
| | 08:08 | so we could type in the manual thing if we want to,
or we could just type in our variable.
| | 08:13 | So now we've set a variable
at the beginning of our script.
| | 08:16 | The variable is then used to save the
PDF to a certain location, and then it's
| | 08:20 | also used to go retrieve that PDF to
attach it to an email. Then of course,
| | 08:25 | when we're done with all of that
we can close the window, because the
| | 08:29 | user doesn't need to see it. All of
this made possible by being able to save
| | 08:34 | this path to a variable that can then be retrieved
at a couple of different points in the script.
| | 08:40 | So let's try this out.
| | 08:42 | So now when I hit Send by Email, you
see it temporarily opens up the window.
| | 08:47 | What's happening is it's saving the
PDF file to that location, closing the
| | 08:51 | window and now it's going to pop up the
email in our mail application.
| | 08:59 | As we hear, it just sent the email, so we can
go and confirm that in our mail program.
| | 09:04 | We see when we go in to sent, sure enough.
| | 09:06 | There is or email sent to the customer;
we can see the customer in the
| | 09:10 | background there, so that happened properly.
| | 09:13 | It automatically put in the Subject line
and then more importantly it also attached our PDF.
| | 09:21 | And here you can see as one little
point of quality checking, it printed out
| | 09:26 | every single PDF, so one quick update
there in our script would be to simply go
| | 09:31 | in and save records as PDF. We can
specify the options for current record.
| | 09:39 | If we want we can try that one more
time and Send by Email, our queue.
| | 09:47 | We can verify later in the
thread, here is the one record.
| | 09:51 | So now since there is just one page you see
that it's actually visible inside the layout.
| | 09:55 | So in this example a variable helped to
store the path, the location to save the PDF,
| | 09:59 | then use that same path later in
our script to attach the PDF to our email
| | 10:04 | in script variables, which are created
using these set variable scripts that
| | 10:07 | provide a temporary location for storing
data and that data can then be accessed
| | 10:11 | from any context in the file that's
allowing you to temporarily store values for
| | 10:16 | later use in your script or even later in your session.
| | 10:19 | So here we used it with the Save as PDF
and Send Mail, but you'll find out that
| | 10:22 | saving variables and being able to use
that temporary memory location is going
| | 10:26 | to be one of the more helpful tools in
your FileMaker programming tool belt.
| | Collapse this transcript |
| Setting script parameters| 00:00 | Take a look at this file that I have on screen.
This is the invoices_08_06 exercise file.
| | 00:05 | See all the letters across the screen here.
| | 00:07 | Every one of these is a button and
when I click on that button, it does a
| | 00:10 | search in the customer's fields for
anything with an N in it or anything here
| | 00:16 | with a P in it, and so on.
| | 00:19 | Now let me propose the hypothetical
question to you as you think about this.
| | 00:23 | How many scripts do you think this requires?
| | 00:25 | There are 26 buttons, but if you
answered one script, then you are correct.
| | 00:29 | If you take a look at here, all these
require is one single script, let me show you that.
| | 00:36 | So in Layout mode, if we click on one
of these buttons and do button Setup,
| | 00:40 | we see we are running a script that's
called QuickFind, and here we're running
| | 00:45 | a script that's called QuickFind, and here we
are running a script that's called QuickFind.
| | 00:51 | Now you might think okay, I see the
trick up your sleeve, there are several
| | 00:55 | scripts all called QuickFind, in
fact there is only one, and that's this
| | 01:01 | QuickFind script right there.
| | 01:03 | What's the trick here?
| | 01:04 | Well, the trick here is that, when we
assign the script to the button, you'll
| | 01:08 | notice that there is this other
optional thing here called parameter.
| | 01:12 | So down here below, anytime you are
adding a script to an object, whether it'd be
| | 01:17 | a button or even a script trigger,
you can also put an optional parameter.
| | 01:22 | So for everyone of these, we just run
the QuickFind script and you have to
| | 01:27 | assign the script to the button anyways.
| | 01:29 | So in here, you'll see that this is the
optional parameter for B, here's M, so
| | 01:36 | on and so on, so you get the gist.
| | 01:38 | So one script, but optional parameter.
Then what are we doing on the script side?
| | 01:43 | If we open up the script, you'll see
that we are simply entering Find mode.
| | 01:46 | and we're using the Set Field while
we are in Find mode to insert a value
| | 01:52 | inside the Company field and then perform
a Find, but the key is the value that
| | 01:56 | we are entering in there.
| | 01:57 | There is a Get function, which can be
found under the Get functions, that's
| | 02:02 | called Get (ScriptParameter).
| | 02:04 | So we can package it up when we are
assigning a script to a button and then
| | 02:09 | unpackage it using the Get Script
Parameter Script Step and perform a Find
| | 02:14 | based on that. And that way one
script can be recycled or used based on
| | 02:20 | different parameters.
| | 02:21 | This is just one example of using script
parameters by the way, there's a ton of
| | 02:25 | different things you can do, but the
main point behind it is that within a
| | 02:29 | script when the Get Script parameter
function is used, you can retrieve the
| | 02:33 | value of a parameter and then the
value's parameter cannot be changed or
| | 02:36 | modified in any way during script execution.
| | 02:39 | So we've got one script, 26 different ways
to perform it and that's just in this one.
| | 02:43 | So the idea is this helps you use
script parameters as a calculation formula.
| | 02:47 | It gets evaluated and passed into a
script when the script is invoked. Using
| | 02:52 | these parameters can drastically reduce
the number of scripts that you need in
| | 02:55 | a given solution, and thus make that solution
easier to maintain or create in the first place.
| | 03:01 | So keep this in mind instead of having
to create one script for search for A,
| | 03:06 | one 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:00 | If you watched the previous movie, you'll see
that we had a script Perform to Find,
| | 00:04 | based on whatever letter was
selected at the top of the screen.
| | 00:07 | You can see that here as well.
| | 00:09 | I select B, that gives me everything with
the B in the Customer field, D, F and so on.
| | 00:14 | However, sometimes for example, if I
click on X, no records are found,
| | 00:19 | and I get this sort of cryptic message
presented to the users that says No records
| | 00:23 | matched this find criteria.
| | 00:24 | Now most users don't know what record is
or what Find criteria is and so this
| | 00:29 | can be very confusing to them.
| | 00:30 | So depending on the script that you're
running, you may or may not want these
| | 00:34 | options and could sometimes be undesirable
as far as your users are concerned.
| | 00:38 | So if you want to suppress this and
possibly show your own message instead
| | 00:42 | what you can do is use something
that's called the Set Error Capture.
| | 00:46 | So if we go to our Script and go to
our QuickFind, we can add a couple of
| | 00:54 | different Script Steps, but the
first one that we have to add is one
| | 00:57 | that's simply called Set Error Capture,
you see that here in the first category of Scripts.
| | 01:01 | If you add that to the top of your script,
this will allow you to turn on
| | 01:07 | the ability to capture or suppress
errors for the life of this script.
| | 01:10 | So when the Set Error Capture is
turned on, for the remainder of the script,
| | 01:14 | FileMaker Pro will suppress all error
messages from being shown to the user and
| | 01:18 | it will rely on you, the developer, to
provide the appropriate error handling.
| | 01:22 | So to determine whether or not there
has been a script error, you're going to
| | 01:26 | have to capture after the
possible error causing script steps.
| | 01:29 | So in our case Perform Find is what
could kick out an error, so if doesn't find
| | 01:34 | records that match the criteria,
it's going to give an error.
| | 01:37 | But if it does find them, it's going
to produce an error of zero, which means
| | 01:40 | everything was fine.
| | 01:42 | So any function that produces an error
can return an error code from the most
| | 01:46 | recently executed script step;
| | 01:48 | for this reason, it's important to
check for an error immediately after
| | 01:51 | executing that step.
| | 01:52 | So in our case, it's the Perform Find.
| | 01:54 | So what we want to do is we want to add
an If statement, If and End If and what
| | 02:01 | I'm going to do is go to a Get function
here and there is a Get function that
| | 02:06 | you're going to want to use called Get (LastError).
| | 02:09 | So normally, you don't need to test
for a specific error, it's usually
| | 02:12 | sufficient to test to see if error
code was something other than zero.
| | 02:16 | Here, I can say if Get (LastError)=0 that
means everything's fine, just continue on.
| | 02:21 | But if it wasn't, that means I can
assume that the error was produced.
| | 02:25 | But of course if you do know the
specific FileMaker error code, you can build
| | 02:29 | that into your script.
| | 02:30 | But here I'm going to say if Get (LastError) was zero,
we will do nothing, but
| | 02:35 | if wasn't, that's where we might want to
show the user something, so now it's up
| | 02:40 | to us to tell the user something in a
dialog so here I can give it a little
| | 02:45 | less cryptic dialog, so I can say No
Companies Found instead of No Records and
| | 02:52 | I can say No Companies Found that contain,
and I can use that Get function again
| | 03:04 | Get ( ScriptParameter ).
| | 03:07 | So this will be whatever they were
searching for, so I can use it both in the
| | 03:11 | search and in the error capture if I
need to, No Companies Found that contain,
| | 03:15 | and then whatever the letter is.
| | 03:16 | So here we'll just say OK.
| | 03:21 | Let's test this out, so we'll close this
window and hit Save and so B finds B, D
| | 03:28 | finds D, but X pops up and instead of
showing a confusing error message that
| | 03:34 | says No Companies Found that contain X.
| | 03:36 | So capturing errors allows you, the
developer, to control what the user sees
| | 03:40 | rather than having them see some confusing
dialogs that FileMaker might display
| | 03:43 | when an error occurs.
| | Collapse this transcript |
|
|
9. Extending Web ViewerViewing custom URLs in the Web Viewer| 00:00 | One of my favorite features in FileMaker
Pro is something that's called a web viewer.
| | 00:04 | Now a web viewer is a layout object
that's used to display web pages directly
| | 00:08 | inside of a FileMaker Pro layout.
| | 00:10 | As a matter of fact you see here on
this layout, we've got one of these web
| | 00:14 | viewers and we'll be working with it in this exercise.
| | 00:16 | Web viewers have many practical uses
and quite frankly there an area in
| | 00:20 | FileMaker where you can really use your
imagination, so really the sky is the limit.
| | 00:24 | But for example, web viewer
could display a map of a website.
| | 00:27 | If you see over on our Customer Details
layout for example, we've got our
| | 00:33 | customers with their addresses and over
here on this other tab, we've got this
| | 00:38 | web viewer that shows the map.
| | 00:41 | As we go from record to record, it
dynamically plots that address on a map if,
| | 00:46 | of course, there is information available for that person.
| | 00:49 | Now you'll add a web viewer just like
you would any other layout object, you do
| | 00:53 | it in Layout mode. They can then be
added to Form View layouts and List View
| | 00:58 | layouts but not Table View and not
Portal Rows, just in case you're starting to
| | 01:02 | think about ways that you can use this.
| | 01:04 | By the way, in order for you to
be able to see the contents of a web
| | 01:08 | viewer, you are going to need to be
connected to the Internet for the purposes
| | 01:11 | of this exercise file.
| | 01:12 | There are some cases where you don't
need to be connected to the Internet and
| | 01:16 | we'll cover those later in this chapter.
| | 01:18 | Let me show you an example of
how you can use a web viewer.
| | 01:21 | Let's say, a web viewer can be used to
calculate the URL for tracking a package
| | 01:25 | based on data stored in a tracking number field.
| | 01:28 | For example if we go over to the
Invoice Details layout you'll notice that on
| | 01:32 | the bottom of the page we've got a field
with a tracking number in it and we
| | 01:36 | store this information every time we ship something.
| | 01:39 | But we think maybe this might be useful
for us to actually be able to see the
| | 01:42 | tracking information, so when our
customers call us up, we can give them the
| | 01:46 | most up-to-date information.
| | 01:47 | So what we would do, is go into Layout
mode and make a little room here on the
| | 01:53 | bottom of the layout, move our Tracking
Number field up and here we can select
| | 02:00 | the web viewer object, which is the last
object in the middle section and when we
| | 02:06 | grab the web Viewer tool, our cursor
turns into a crosshair and we can draw the
| | 02:11 | area on the layout where we
want our web viewer to appear.
| | 02:14 | What you see is the web
Viewer Setup dialog window.
| | 02:17 | The first thing you'll notice is that
on the left-hand side we've got this
| | 02:20 | window where there's all sorts of pre-loaded
websites that FileMaker supplies
| | 02:24 | to you for you to be able to easily be
able to add web viewers that dynamically
| | 02:28 | show the websites based on
data inside your FileMaker record.
| | 02:32 | The easiest one to see is really the
FedEx one, for example, so let's say we
| | 02:36 | want to add FedEx tracking to our database layout.
| | 02:39 | You'll notice when you select one of
these pre-loaded websites, you'll see on
| | 02:44 | the right-hand side we've got open fields,
where either you can type in the
| | 02:47 | actual address or the information of
the data that's going to be loaded, but of
| | 02:52 | course, then every one of your records
would show the same tracking number.
| | 02:55 | Or you can map it to a field in your database.
| | 02:59 | So of course we've got this Tracking Number
field and you'll see down below that
| | 03:04 | a custom web address is being created.
Really all a web viewer is,
| | 03:10 | is a calculation that results in a web page.
| | 03:13 | So you can put things like fields in
your database that will then modify the web
| | 03:18 | address. So that way when you go from
record to record it's acting sort of like
| | 03:23 | an unsorted calculation and the result
is a web page that you see in your layout.
| | 03:28 | So let's take a look at what this might look
like and we'll stretch this one out a little bit.
| | 03:33 | Let's go to our Position. All right!
| | 03:38 | So now in Browse mode, if you look
down on the bottom of the page, you'll see
| | 03:45 | that we've added the ability to actually
load the FedEx Tracking page, so you'll
| | 03:50 | notice that of course, this
is an invalid tracking number.
| | 03:52 | But if it weren't, we would be able to see
the tracking information scrolling on screen.
| | 03:57 | Of course we could make this
much larger if we want to.
| | 04:00 | But the nice thing about it is, this
web page is then fully interactive.
| | 04:03 | So here our users could even type in
another tracking number as long as they're
| | 04:08 | there and hit the track page.
| | 04:11 | Now again, the idea here is it's not just
loading a web page. It's not like a web
| | 04:15 | browser, but it's actually taking information
from the record that you are on
| | 04:18 | and helping load a page that way.
| | 04:20 | So let's look at another example that
will use custom information from our
| | 04:23 | record and display a web page for us.
| | 04:28 | If we go over to Product Details, you
see I've got this large web viewer over
| | 04:33 | here in the right-hand side of the screen.
| | 04:35 | It's already been drawn,
but it doesn't have an address.
| | 04:38 | In this case, we're not going to
use one of the pre-loaded websites,
| | 04:42 | although I urge you to check them out.
They're are very easy to use, there's one
| | 04:46 | for all sort of stuff Wiki, Google,
MapQuest all that type of thing.
| | 04:49 | But what we are going to do is we're
going to author our own custom address.
| | 04:53 | So how do we get a custom address?
| | 04:54 | Well, you're going to have to know
which site it is that you want to load.
| | 04:58 | A quick sort of study on websites;
let's go over to our browser.
| | 05:02 | We're going to put in a custom address
into the Calculation window and reference
| | 05:05 | fields from our layouts, but first we need an address.
| | 05:08 | Now how do we come up with a custom address?
| | 05:10 | Well that starts with going to the web
and finding a website that you actually
| | 05:14 | want to emulate in your web viewer.
| | 05:16 | So let's go over to our browser.
| | 05:17 | Here I've got a browser and I'm
going to go to a certain site that would
| | 05:22 | give us pricing information on different products,
which is what we're trying to do here.
| | 05:27 | I'm going to go to Google Shopping.
| | 05:28 | I want you to take a look at
the address bar up on the top.
| | 05:31 | So if I go in here, and I type in --
we'll get rid of all this stuff here --
| | 05:37 | you don't need to concentrate too much
on that; quite frankly that's all
| | 05:40 | session-based information.
| | 05:42 | But if you look at the URL that's on
the top of the page, really all Google
| | 05:46 | does is take whatever you type into
this box and it adds some other characters
| | 05:51 | here; search and then the language and
so on, but ultimately it's just putting
| | 05:55 | in shop and then your search term at the end.
| | 05:59 | A lot of sites do this and I'm going to show
you some examples of some other ones.
| | 06:04 | Those are just open accessible URLs.
If you get a little bit familiar with
| | 06:08 | your address bar as you're searching
over the Internet, you are going to find a
| | 06:12 | lot of these websites and then you can
incorporate these into your database.
| | 06:14 | So now, the trick is to copy that,
and let's go back to our database.
| | 06:20 | Again, remember a web viewer, in my
opinion, is really just a calculation that
| | 06:25 | results in a web page.
| | 06:26 | So we're going to open up our
Calculation dialog window and
| | 06:30 | I'm going to paste in that address.
| | 06:31 | Now of course, any time I put text
in there, I have to wrap it in quotes.
| | 06:35 | Now we're of course not done here, but
let's just preview this and see what we got.
| | 06:41 | So if I go back into Browse mode,
you'll see after I save my changes, indeed it
| | 06:46 | looks as though we're done, but we're really not.
| | 06:48 | I happen to be on the Bike Helmet
record but you'll notice that every record
| | 06:52 | goes to the Bike Helmet. What we want is
each record to search whatever the item name is.
| | 06:57 | So let's adjust that. The way we can
make this dynamic is we go back in to our
| | 07:01 | Calculation dialog window and instead let's do this.
| | 07:04 | Let's cut off the web address right
at the point where the product name was
| | 07:09 | referenced and instead let's reference our field value.
| | 07:13 | So like with any other calculation,
I'm going to put this placeholder in here.
| | 07:17 | The Products Item field just really means
whatever the data is inside the
| | 07:21 | Products Item field on our record.
| | 07:24 | So I'm going to hit OK, and now let's
go into Browse mode and you'll see okay,
| | 07:31 | we've got Performance Tune Up. It
gives us all performance tune ups and I've
| | 07:35 | got Bike Helmet, SpeedGel Saddle, 7-speed
free wheel, bikes and so on.
| | 07:41 | The nice thing about this is because
we're reaching out to the web, we don't
| | 07:44 | have to take on the burden of entering
all this data into our database and
| | 07:47 | keeping our database up-to-date.
| | 07:49 | We know that the second we load this
record, that this is the most up-to-date
| | 07:52 | information that's on this particular website.
| | 07:54 | So for our purposes of our example,
we know that our database will always
| | 07:58 | have access to the most up-to-date
pricing information on the same products
| | 08:02 | that we're storing.
| | 08:03 | So this is a great way to extend the
capabilities of your FileMaker database
| | 08:07 | without actually having to
program this information into it.
| | 08:10 | Pretty cool stuff, it gets me kind of jazzed up.
| | 08:12 | Now you don't have to use any Google website.
| | 08:15 | You can use any website that exposes
its URL and allows you to replace its
| | 08:18 | code with a field value.
| | 08:20 | Of course, sites that you're going to
need to log into, there are some ways
| | 08:23 | around that where you can actually
pass log in credentials, but it gets a
| | 08:26 | lot more complicated.
| | 08:27 | So you're going to look for open public
websites that do allow you to see the
| | 08:31 | search parameters and sort of
the code that they're using.
| | 08:34 | I've got a real-life database example here
that I'm going to show you that has a
| | 08:38 | whole bunch of these different examples in it,
just to give you an idea how versatile this can be.
| | 08:42 | This is a real-life database that we've created.
| | 08:46 | I've got a sample movie in here. The
purpose of this is to track movies that are
| | 08:50 | going to be coming out, of course this
one has already come out, but if you can
| | 08:54 | use your imagination here a little bit.
| | 08:56 | The role of this is to research the movies
and put information in on it so they
| | 08:59 | can make bids and possibly acquire the film.
So that's the backstory on this particular database.
| | 09:04 | But one of the things that the researchers
had to do was go to various different
| | 09:07 | websites and find out information about a film.
| | 09:11 | So what we did is we made it all dynamic.
| | 09:13 | So all they have to do is type in the
name of the film and some of the actors
| | 09:17 | and they can automatically find out information about it.
| | 09:19 | So for example, we've got this little
link next to the movie name where when
| | 09:23 | you click on it, it automatically
searches a website that's called IMDb and
| | 09:27 | shows any kind of hits and allows you
to interact with it, so you can see all
| | 09:31 | sorts of information on cast and everybody
affiliated with the movie, that one is pretty easy.
| | 09:35 | Also we've got this Research tab where
you can click on any one of these tabs
| | 09:39 | and it will automatically take you to
this website and automatically search for
| | 09:44 | whatever the film name is. In this
case we've also got a Twitter address for
| | 09:48 | the director and you can see that it automatically
loads the Twitter Feed for that directory.
| | 09:53 | You go to Rotten Tomatoes, it automatically
loads any information you got on
| | 09:57 | Google, Google Trailers, Reviews of
the movie, YouTube Trailers, Deadline
| | 10:04 | Hollywood, Hollywood Reporter, IndiWire,
Variety all of these and they're just
| | 10:10 | automatically searching based on the film's name.
| | 10:13 | So just to give you an idea, we could
go in here, and I'm going to type in a
| | 10:17 | film and we'll see if it's already in
the list, its not in list so we're going
| | 10:21 | to add it and now that it's already added.
| | 10:23 | we can click on buttons and it
will automatically go and search.
| | 10:26 | We see we've got a couple of
different options here for us.
| | 10:29 | We also go into our Research tab, don't
have any Twitter information there yet,
| | 10:34 | but automatically searches Rotten Tomatoes,
Google, Trailers, Reviews, YouTube
| | 10:39 | Trailers, Deadline, Hollywood Reporter
and notice on the bottom, you can see
| | 10:45 | these custom address being loaded.
| | 10:46 | And just to give you a quick peek
into how this works; so we go into Layout
| | 10:52 | mode and you'll notice that what we have is
just a tab control with a series of different tabs.
| | 10:59 | If you look real close, these calculations are pretty easy.
| | 11:01 | Twitter is a really easy one, all you
have to do is just do twitter.com/ and put
| | 11:06 | in whatever the handle is.
| | 11:08 | Rotten Tomatoes has an exposed URL
that's basically just rottentomatoes.com/m/
| | 11:16 | and then I just do a little substitute
where I replace any spaces with
| | 11:19 | underscores because their particular
website doesn't like spaces.
| | 11:23 | So real simple stuff you can
do within your calculations.
| | 11:26 | Here I do one where I just check to see
if the name of the film is not empty,
| | 11:30 | I show that; if the director field is empty,
I show the cast; all that type of stuff.
| | 11:35 | So you can really leverage what you
already know about calculations,
| | 11:39 | to dynamically show this information
inside of web viewer.
| | 11:42 | The other thing I would say is that when you're
researching the websites that you want to use.
| | 11:48 | I find that it's helpful to
use mobile versions of websites.
| | 11:52 | They still do have those out and instead
of having to load all of the different
| | 11:57 | ads and all that kind of stuff in your
website, you'll notice that in Browse mode,
| | 12:03 | when I go to IMDb what I'm really
doing is, I'm loading what's called the
| | 12:06 | mobile version of IMDb, that way I
don't get all the wacky stuff and it just
| | 12:10 | gives me just the basic information.
| | 12:11 | So you can do simple Google searches
for WAP versions or mobile versions of the
| | 12:16 | websites that you want to load.
| | 12:17 | Now because web viewers use the operating
system's web browser technology and by
| | 12:21 | the way, we can't get around this, but
web viewers will use Internet Explorer
| | 12:25 | if you're opening the database on Windows
or Safari if you're opening the database
| | 12:29 | on Mac, you can perform most of the
same tasks in the web viewer that you can
| | 12:34 | within a web browser.
| | 12:35 | But your web browser settings are going
to control how the web viewer operates.
| | 12:39 | So for example, if JavaScript or other
plug-ins are disabled in the web browser,
| | 12:43 | then those same technologies
will be disabled in the web viewers.
| | 12:46 | Make sure of course when you're
defining custom web addresses, that your URL
| | 12:49 | begins with a correct scheme
such as http or https or ftp.
| | 12:54 | If you omit the scheme, the operating
system's web browser might not use the one
| | 12:58 | that you intend; just a couple of tips there.
| | 13:01 | Web viewers, my favorite layout objects,
are an extremely powerful way to extend
| | 13:05 | the content within your FileMaker layouts.
| | 13:07 | You can display data from nearly unlimited
amounts of resources, by just adding
| | 13:10 | URL formats that can grab from your web browser.
| | 13:14 | Adding web viewers to your database
can really add some wow factor to
| | 13:17 | the FileMaker layouts.
| | Collapse this transcript |
| "Scraping" source code from web pages| 00:00 | We've been talking about how we can use
the web viewer layout object to display
| | 00:04 | data from web pages inside of the
context of our FileMaker layouts.
| | 00:08 | We can also talk about how we go into
the web Viewer Setup and we can actually
| | 00:12 | pull data from records in our FileMaker
database or fields even within a record
| | 00:18 | to dynamically display those
web pages in our FileMaker layouts.
| | 00:22 | But web viewers can also be used to
not only display web data, but also to
| | 00:26 | consume web data into the database.
| | 00:29 | Let me show you an example of what
I'm talking about and then I'll kind of
| | 00:32 | reverse engineer how this works.
| | 00:34 | If you open up the exercise file
Invoice 09_02, you'll see that I've got a
| | 00:38 | layout called Conversion.
| | 00:40 | All I've got going on here is just a
simple web viewer and I've got a text field.
| | 00:46 | So we've got a web viewer that's
unfortunately because I'm on Mac, it doesn't
| | 00:50 | actually show the source code, which is
really what we're gong to be working with
| | 00:53 | here, but I'll show you that in a second.
| | 00:55 | But it displays the contents of a web page,
| | 00:58 | we'll talk about that web page here momentarily.
| | 00:59 | Then I have a text field that we're
simply going to populate with the data from
| | 01:06 | this web page and then I've got two
calculation fields and I'll show you how they
| | 01:10 | automatically get populated once I
consume the data from this source.
| | 01:14 | The idea is I've got a web page, it's
got some background source information,
| | 01:18 | I want to pull that into my FileMaker
database and then I can do whatever
| | 01:22 | I want with that data.
| | 01:23 | So I've set up a script here on this button
that's called Scrape and when I hit
| | 01:27 | the button, you see a couple of things happened.
| | 01:29 | First of all this text field gets populated
with what is actually the source of
| | 01:36 | the web page that I am showing in the web viewer.
| | 01:38 | But even more interestingly what you see here
are two fields and each of these are exchange rates.
| | 01:45 | So I've got the US Dollar exchange rate and
the South African Rand currency exchange rate.
| | 01:51 | Both of these are now instantly
updated and now I have a database that
| | 01:55 | I can import in on any frequency that I'd like to,
whatever the most current currency exchange rates are.
| | 02:02 | So let's look at how this whole thing works.
| | 02:04 | So what I've done is I found a web page.
| | 02:06 | In this case this is the European Central Bank's
public website and they happen
| | 02:10 | to have an open XML feed, that if you
go to this address you can view yourself
| | 02:16 | and it just shows me raw XML.
| | 02:18 | So it could be an HTML page and in
this particular technique if I went to a
| | 02:24 | regular HTML page, I would be
consuming in the backend source code.
| | 02:28 | So in this case I thought it'd be a
little bit easier for you to just look at code,
| | 02:32 | in this case it's in the format of XML
and show that we can consume this.
| | 02:35 | Now what's nice about this particular feed
and it's really the same with a lot
| | 02:40 | of HTML sites, is that the code
maintains a very specific format.
| | 02:45 | So every time you load this page, the
US Dollars are first, the Japanese Yen
| | 02:50 | second and all these other ones are
in this particular order with the South
| | 02:53 | African Rand at the very bottom.
| | 02:55 | So I can rely on the position of each
one of these rows of data and all this
| | 03:00 | header information stays the same.
I can also rely on the position of the
| | 03:04 | rate, where the rate actually shows up in each row.
| | 03:07 | NowI'll talk about why that's important in a second.
| | 03:09 | So what I've done in my database is I've
created a web viewer that simply loads that page.
| | 03:16 | So in this case we're just going to a static page
and I've done one more step to this web viewer.
| | 03:21 | You'll notice when we go into the
inspector that I've named this object.
| | 03:27 | You can name any object, like I've
named this object over here the Field.
| | 03:31 | I could name this button if I want to,
you can name anything on the screen and
| | 03:34 | we'll talk about why that's important in a second.
| | 03:36 | So I've loaded the web page and it's
really not meant for display, it's more
| | 03:39 | meant for consuming all this information
so this web viewer could be very small
| | 03:42 | or nearly non-existent on the layout.
| | 03:45 | Then this field, the source field,
actually plays a very important role.
| | 03:50 | You see here its just a text field, but
if you look at the Calculation for USD
| | 03:56 | and the Rand, I've used a somewhat
simple parsing mechanism, similar to what
| | 04:03 | we've talked about earlier in this course,
where I use a middle function here to
| | 04:08 | go into the text that I'm pulling from
that XML page into that field and I'm
| | 04:15 | looking for the specific position of
this text, USD apostrophe (') space rate
| | 04:21 | equals, and then I say I want
to grab all of the contents;
| | 04:27 | if we look at it you'll see it's
a little bit easier to understand.
| | 04:30 | So I say find out where this position is
and then give me the six characters to
| | 04:36 | the right of it and every one of these
has six characters it just so happens
| | 04:41 | that's what the format is of this particular site.
| | 04:43 | So all I've done is then made a very
minor adjustment to the Rand, so in this
| | 04:50 | case I'm looking for the location of
the ZAR space rate equals and then pulling
| | 04:57 | the six characters to the right of that.
| | 05:00 | It's a pretty simple stuff.
| | 05:02 | Once I consume that data into the FileMaker
field I can then consume it and
| | 05:07 | parse it out in anyway that I'd like.
| | 05:10 | And what this button does, you'll see
we've got a script attached to the button
| | 05:13 | that's called Scrape Rate.
| | 05:15 | This technique is commonly referred to
as HTML scraping or web page scraping and
| | 05:20 | down here under Scrape Rates,
it's a pretty simple script.
| | 05:23 | What I do is I set a variable that's called Source
and then here's the key to making all this work.
| | 05:29 | There is a function in FileMaker called
GetLayoutObjectAttribute and I can point
| | 05:34 | to a layout object that I've named and,
if you remember I named my web viewer WAP,
| | 05:40 | and I can put this keyword in here.
| | 05:43 | If you look in the FileMaker Help you
can see what all the different keywords
| | 05:46 | are, but if you're pointing to a web viewer
and you use the keyword content in
| | 05:51 | quotations like you see here, it's
going to give me the source code and it's
| | 05:55 | going to take that source code and as
I've instructed it to do, set it to a variable
| | 06:00 | and then I take the contents to that variable
and I set it to the field called source.
| | 06:04 | So all I'm doing is I'm just using the
little technique of naming the web viewer
| | 06:09 | and then pulling in the source code
and then parsing the source code using
| | 06:13 | normal data parsing techniques that
we've covered earlier this course.
| | 06:18 | So if you look closer at the
GetLayoutObjectAttribute, you'll see that it
| | 06:21 | has two parameters, the name of the
object and then this attribute name and
| | 06:25 | this will return the specified attributes
of whatever layout object that you're naming.
| | 06:29 | So name your layout object, in this
case it was the web viewer, and then
| | 06:31 | the attribute name.
There is all sorts of supported attribute names.
| | 06:35 | So we've got two parameters,
we've got the objectName and then, the
| | 06:38 | attributeName and that's
the key to making this work.
| | 06:41 | So the name of the supported attribute,
and if you see below we've got content
| | 06:44 | is the one that I'm using, that's the
attribute name that I'm using, and there are
| | 06:48 | several supported ones depending on
which type of object you are pointing to,
| | 06:52 | but I'm just focusing on content here
because when you use the content attribute
| | 06:55 | name against a web viewer, it will
return the current content such as HTML code
| | 06:59 | or view source or whatever information
is on the back end of that site.
| | 07:03 | Now I've created this is as a manual
script, but we don't necessarily have to
| | 07:06 | have this run manually.
| | 07:07 | For example in a FileMaker database
you'll see under File Options there is a
| | 07:12 | script trigger for OnFirstWindowOpen
and that's a script that I've created.
| | 07:16 | What we can do is we could append this
OnFirstWindowOpen script to run this
| | 07:23 | script every time the database is open.
| | 07:24 | The user will never even see any of
this activity going on and all the while
| | 07:28 | you'll be assured that you'll
have the most recent currency rates.
| | 07:32 | So we'll just add a couple of quick steps.
| | 07:33 | We can say Go to Layout, Go to Layout
and I'm going to pick the Conversion
| | 07:43 | layout to see right there, so we're
going to have some focus and then we're
| | 07:48 | going to pause for a second, just for
literally one second to give the web page a
| | 07:56 | second to load, so we actually
have something that we can pull in.
| | 07:59 | Then we'll simply say perform the script,
the Scrape Rates script and then
| | 08:05 | after that we will commit the records.
| | 08:09 | Pretty simple stuff.
| | 08:11 | These four steps I've added to the
beginning of the open script and so every
| | 08:14 | time the file opens it will go for one
second go to this page, scrape the rates,
| | 08:18 | populate it, all your fields
get updated in the background.
| | 08:23 | We can even make this layout a calculator
where we can allow users to pick any
| | 08:26 | currency and then it would display
that value inside the appropriate fields.
| | 08:30 | We're going to use the same concepts
that we've been working on and to do this,
| | 08:34 | we'll use several of the techniques
that we've talked about earlier in this course.
| | 08:39 | Most of it involves a field that users
will pick a currency rate in and then the
| | 08:44 | rest of it is just making
our calculations more dynamic.
| | 08:46 | So if we go into Manage>Database, I'm
going to add a field called CurrencyUser
| | 08:53 | and, much like in our techniques with
user driven relationships, I'm going to make
| | 08:57 | this a global field so that
it's session specific to the user.
| | 09:01 | And then I'm going to duplicate one of
my currency fields and I'm going to call
| | 09:06 | it Currency Selected and change the name.
Instead of always looking for USD,
| | 09:14 | instead what I'm going to do is I'm
going to have it look for the value that the
| | 09:21 | user selects in the currency user field.
| | 09:25 | So here we'll just add a little ampersand (&)
and what we'll get back is a number in that case.
| | 09:32 | So now what we'll do is we'll go on to
this layout, just add the new fields,
| | 09:38 | copy this field over here and we'll pick
CurrencyUser and then this will be the
| | 09:48 | value in CurrencySelected.
| | 09:50 | So what I'm going to do to Currency User
though real quickly is I'm going to add
| | 09:54 | a pop-up menu and a value list and I've
already created this value list in the
| | 09:59 | example file which shows all the different currency
abbreviations, just to save a little bit of time.
| | 10:05 | Now if we go into Browse mode, see I
can scrape, clear this out and scrape the
| | 10:11 | most recent currency codes. I can
select the Japanese Yen and I see the value
| | 10:17 | appear there. I can select whatever
these other things are and it basically
| | 10:23 | gives me a user driven and session specific currency
calculator that is based on our HTML scraped data.
| | 10:31 | So web viewers, although primarily used
to display dynamic content from the web
| | 10:34 | within your layouts, it can also be
used to combine with the get layout object
| | 10:39 | attribute function in a script to
consume data from the web dynamically and
| | 10:44 | therefore enhance the functionality
of your existing FileMaker databases.
| | Collapse this transcript |
| Using data URLs in the Web Viewer| 00:00 | Web Viewer Layout Objects can be used
to take data within the fields in your
| | 00:04 | database records and display them
as web pages within your layouts.
| | 00:08 | And this works essentially because
FileMaker web viewer is an unstored
| | 00:12 | calculation that results in a web page,
not technically, but figuratively.
| | 00:16 | Web viewers can also display web pages,
because what they do is they borrow the
| | 00:20 | same engine that your computer's web
browser uses. Specifically on Mac, the
| | 00:25 | Safari engine is used; and the
Explorer engine is used on Windows.
| | 00:28 | So that way what you are trying to display
requires a plug-in or something like that,
| | 00:32 | make sure you install those plug-ins
on either of those two browsers,
| | 00:35 | depending on the operating system of course.
| | 00:37 | Now since web viewers use browser's engines,
| | 00:40 | that means that they can parse and display
things that are wrapped inside HTML.
| | 00:43 | That's basically what a web browser is.
| | 00:46 | So FileMaker Web Layout Objects that
are web viewers are really just using that
| | 00:51 | same concept and that same technology.
| | 00:53 | But what if you wanted to control the
text that's displayed in a web viewer?
| | 00:57 | Well, you need to wrap this text in HTML
in order for the browser to read it;
| | 01:00 | that's the same thing with the web browser.
| | 01:03 | So let's do something like this
inside our exercise files.
| | 01:06 | Say for example on this layout where
we've got the web viewer that displays a
| | 01:10 | map of the contact information.
It's programmed to display Google Maps,
| | 01:16 | specifically of all the data that you see here in
Address 1, City, State and optionally Zip as well.
| | 01:23 | But what if there's no data in those fields?
| | 01:24 | You notice here in the second record
we don't have any data in the fields and
| | 01:28 | all we get is a blue screen.
| | 01:30 | It doesn't let the user know much about why
they don't see anything in that web viewer.
| | 01:34 | Say instead, that we wanted to show
some text that tells the user that the
| | 01:38 | fields must be populated in order to
see a map that we need to modify the
| | 01:42 | calculation formula that's been
used to set up this web viewer.
| | 01:46 | So let's go into Layout mode,
I'm going to double-click on this.
| | 01:49 | NowI should point out here that I'm not
using the standard Google Maps option
| | 01:53 | that FileMaker provides.
| | 01:54 | Instead, I'm using a GetMap custom
function, and if you've got a copy of this
| | 02:02 | example file and a copy of FileMaker
Pro advanced, you can go under the File
| | 02:07 | menu to Manage, and then Custom Functions,
and you can see how that's written.
| | 02:11 | But essentially I've created something
that's customized that just takes
| | 02:14 | different fields and you use those fields
as parameters, and if you want to use
| | 02:20 | it, you'll notice that the custom function
is listed there, GetMap and I just
| | 02:23 | plug-in to different fields for the
parameters for this particular map.
| | 02:26 | So I just plug FileMaker fields in to
where the fields are here, with parameters
| | 02:31 | of the function and it renders as a map.
| | 02:34 | Now what we want to do though is
we want to add a condition in here.
| | 02:37 | So let's say we go in and we say,
if those fields are empty then let's
| | 02:42 | display some text instead.
| | 02:44 | So as we've talked about earlier in
this course, what I'm going to do is I'm
| | 02:48 | going to list all the different fields
that you see here, just go ahead and copy
| | 02:52 | these actually and, instead of delimiters,
I'm going to concatenate all of these.
| | 03:00 | So I'm going to say, if I put all these
together and it's empty and that means
| | 03:04 | that all the required fields are empty,
and therefore, we want to show some
| | 03:08 | text that tells the user that these all need
to have a value in order for this to work.
| | 03:13 | So I'll just add this as our test.
| | 03:15 | So 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:33 | Now let's check our syntax.
| | 03:35 | That looks good, we see that in our in
Layout mode, now, we go to Browse and Save.
| | 03:40 | We see that we've got the map here,
because that one has fields.
| | 03:45 | Now here, you think you would
expect to see text, wouldn't you?
| | 03:48 | Well, the reason you can't see text is
because we didn't format the text as HTML.
| | 03:52 | So let me show you for a second
what I'm talking about there.
| | 03:56 | So here is the text that we might want
to show inside of our web viewer and it's
| | 04:00 | just written as plain text. This is
how I put it inside of our calculation.
| | 04:04 | The problem with this is that it can't
be read by a web browser because it's
| | 04:08 | not formatted as HTML.
| | 04:09 | And even if you don't know a lot about HTML,
you'll know that if you add the HTML
| | 04:13 | and HTML head and body tags and then close
those tags, that now it's formatted as HTML.
| | 04:20 | Of course, I could add some things
like formatting and what not, but just
| | 04:23 | with the plain text, this is all I need to do
to actually have it be read by a web browser.
| | 04:28 | But even if you know how to format
HTML text, it's still not going to appear
| | 04:32 | because HTML actually needs to be hosted
by a web server in order to be displayed
| | 04:35 | if you're pointing to it from a web address.
| | 04:39 | But there is a technique that I want
to tell you about that you can use to
| | 04:42 | display HTML that isn't presented by a
web server, but instead, it's by using
| | 04:47 | something that's called the data URL.
| | 04:50 | Now the web page address specified for
web viewers, usually a website located on
| | 04:54 | the Internet, but it can also be a
file path reference to an HTML file.
| | 04:57 | So maybe you have a fully formatted HTML
file on your network somewhere around
| | 05:01 | a server and you are going to point to that
and have that be read inside the web viewer.
| | 05:06 | Web viewers in FileMaker Pro also
support this concept called the data URL.
| | 05:11 | And all the data URL is just a prefix
that you put in front of any HTML code
| | 05:15 | that tells FileMaker's web viewer,
don't worry about this being hosted,
| | 05:19 | just read it and parse it out as if
you're the web server basically.
| | 05:23 | All you do is, you just add a prefix
to your existing HTML that says
| | 05:27 | data:text/html, and then a comma.
That's all you have to do, and then this
| | 05:33 | will magically be parsed inside your web viewer.
| | 05:35 | Now if you want to flatten this out, this is
how it's going to look inside your calculation.
| | 05:40 | So let's take the same text and
instead of the text that we put in our
| | 05:43 | calculation, let's put this text in instead.
| | 05:46 | So back in Layout mode, we'll go in
and we'll modify this, and we'll say,
| | 05:50 | instead of just where it says these fields are empty,
I'm going to paste in the entire string of HTML.
| | 05:58 | Now we hit OK, we go into Browse mode,
save our changes, and of course, we see
| | 06:04 | that our map still draws when there
are fields populated for the record.
| | 06:09 | Here we don't have fields populated,
but what we'll end up seeing is the
| | 06:12 | text that we put in there. Your address
fields must contain values for the map to draw.
| | 06:17 | Now in this case we only use simple text
to display HTML, but you can embed any code
| | 06:21 | that can be written into HTML, into your web viewer.
| | 06:24 | This next movie, we're going to explore
how to extend that simple example that
| | 06:28 | you see here of just text, into a really
complex HTML string that represents
| | 06:32 | interactive images and even additional
code that's outside of HTML.
| | 06:36 | So really, the takeaway here is with the
combination of powerful web viewer and
| | 06:41 | the extensive HTML library, the possibilities
of what you can display in a web viewer
| | 06:45 | are bounded only by your
scripting skills and imagination.
| | Collapse this transcript |
| Using HTML5 in the Web Viewer| 00:00 | I've put together a couple of demonstration
files. These are not files that you're going
| | 00:03 | to find in the exercise files folders,
but some things that I put together,
| | 00:07 | because I wanted to show you some
particularly cool things that can be
| | 00:10 | done inside the web viewer.
| | 00:12 | In the last movie that we just did, we
talked about how we can have some text
| | 00:17 | show up as long as we wrap it in HTML
and as long as we use the prefix, which we
| | 00:23 | refer to as a data URL.
| | 00:25 | So if you recall, what we did there is
we had some text that was instructing our
| | 00:30 | users to populate the address
fields before a map could be drawn.
| | 00:34 | So instead of trying to draw the map
with some field references, we just
| | 00:37 | had some text show up.
| | 00:39 | If you even have a limited knowledge
of HTML, you know that any text that
| | 00:43 | you put in between these tags can show up.
| | 00:46 | So for example, instead of the instructions
that we did in the last exercise,
| | 00:52 | you see that I can just change some information.
| | 00:53 | So what you're seeing that I have
here is a demo file, again, not in the
| | 00:58 | exercise files, but something I just set
up for you to show you a couple of concepts.
| | 01:02 | And on the left-hand side what
I've got is a web viewer, and on the
| | 01:06 | right-hand side I just have a field.
As you can see, the web viewer, after
| | 01:10 | I type something into the field and commit it,
it's just rendering whatever text I write.
| | 01:14 | So the idea here is that I can show you
on the right-hand side what it takes to
| | 01:18 | actually have something appear on the left inside.
| | 01:20 | So again, this is how you get a piece of
text to show up in a web viewer.
| | 01:25 | Of course, you could have an HTML file
that's been hosted on a web server, but
| | 01:28 | in this case we're just putting it right into
a field, or we could have put it right into
| | 01:32 | the web viewer set up, but we have to
make sure to show the data URL first.
| | 01:37 | So let me take this one step further.
| | 01:39 | This is the idea of this demo is to kind of show
you what's possible inside these web viewers.
| | 01:44 | Now what I've done is I've still got
the web viewer and it's still showing the
| | 01:48 | information on this side, but instead
of having just that HTML information
| | 01:53 | that's showing the text, instead what
I've done is I've put in some CSS and sort
| | 01:58 | of style sheet information to, instead
of showing text, to show a box, or to
| | 02:02 | show a square with a certain color on it.
| | 02:04 | Of course, I could manually change
what this says inside the box, maybe
| | 02:10 | the color of the box.
| | 02:12 | I could even change the size if I'd like to,
or the location of the box within the web viewer.
| | 02:22 | Now keep in mind that I'm just manually
changing this data here inside this
| | 02:26 | folder, but you kind of get the idea
that if this wasn't a text field, if it was
| | 02:30 | maybe a calculation field or concatenated
set of a bunch of fields, I could have
| | 02:35 | a field that just does how close to the
top, how close to the left, the height,
| | 02:39 | the width, even the color.
| | 02:41 | I could have all those be input field,
or those could be something where I'm
| | 02:45 | using the calculation engine
to drive this information.
| | 02:47 | So that's kind of part of what I wanted to help
you see, to kind of get your imagination going.
| | 02:52 | Also, I could do the same for the
text that shows up inside of this box.
| | 02:56 | Here I could type this over
and put our Hello World message.
| | 03:01 | Now of course, this assumes that you
have a little bit of understanding of HTML
| | 03:05 | and CSS. As I go forward I'll be using
some JavaScript here, but I really
| | 03:09 | want you to understand how powerful the
web viewer is and how powerful using the
| | 03:13 | data URL with HTML certainly can be.
| | 03:16 | So let's take this even one more step further.
| | 03:18 | You see what I'm doing in step
three is that I'm showing an image.
| | 03:21 | Now this is another little thing that I've stumbled
across that I wanted to share with you.
| | 03:25 | I have another file here that I call
image and in this file this is sort of a
| | 03:30 | demonstration file that I put together.
| | 03:32 | There's not much to it, you can
easily extrapolate from what I'm doing.
| | 03:35 | But when FileMaker 12 came out, we
discovered a really interesting new tag.
| | 03:40 | This was a URL syntax that
allowed us to point to a database.
| | 03:47 | So in this case, I'm pointing to the
ISOImage database and a layout called
| | 03:53 | ISOimage; you see that here,
and the field is called image.
| | 03:58 | So I've got this field set up in the
database, you see here its called image.
| | 04:02 | It's a container field, it's even got
external storage on it. What I'm doing
| | 04:07 | in that case is, let's say we just blow
that out, and if we look at our demo file,
| | 04:13 | we'll see that we've already pulled this in.
But that will effect the next time
| | 04:16 | somebody loads this, because you can
see I'm putting that exact same image
| | 04:20 | reference into my HTML.
| | 04:23 | So what I'm doing here -- what we
found out was kind of interesting is
| | 04:26 | if I insert a picture into that field,
you'll see what happens is that now it
| | 04:33 | automatically shows up in a web viewer
and the web viewer is just simply
| | 04:38 | pointing to that address.
| | 04:39 | Now you can freeze this, and feel free
to use this code, but all we're doing is
| | 04:44 | just using the same string that we stumbled across.
| | 04:48 | The key to this string here is that
it's going filemakerxml/cnt/data.png.
| | 04:57 | Now these are PNG files, so you can
change that extension if you like to.
| | 05:02 | This was the way that we found that we
could store images inside of a hosted
| | 05:06 | FileMaker file inside of a container,
even with external storage, and then
| | 05:10 | still be able to reference the contents of
those containers within our interactive HTML.
| | 05:15 | So you'll notice here, instead of having
that box, what I've done instead, still
| | 05:21 | use some CSS to talk about the position.
| | 05:23 | You notice that I can manipulate that if
I like to as well. But what I did, when
| | 05:28 | I referenced the image, you'll see
this information here, I'm going to give a
| | 05:33 | little bit of padding, but here's that string.
| | 05:35 | The string that just simply finds the record,
points to the file, points to the layout
| | 05:39 | and then points to the container.
Then I give it some sizes and this
| | 05:44 | is the height and width that I want to show that at.
| | 05:47 | So a really neat way to incorporate the
contents of a container fields into your
| | 05:51 | HTML that's been presented inside of a web viewer.
| | 05:55 | So this is a neat way to allow your users to drive this.
| | 05:57 | So again, I'm trying to show you different
ways to use your imagination to make
| | 06:02 | this web viewer interactive
and dynamic at the same time.
| | 06:06 | So let's take this even a step further.
| | 06:08 | I know what you are thinking now;
we've gone way passed the HTML. But really,
| | 06:14 | all this is a referenced JavaScript file.
It happens to be called Kinetic.
| | 06:20 | If you're interested in getting Kinetic,
it's called kinetic_4.js and I just simply
| | 06:27 | found that in the jQuery Library.
| | 06:30 | This is something that you can go get.
Its public access. Personally, I
| | 06:34 | don't know much about JavaScript, but
I looked in the library and found one
| | 06:38 | that allowed me to manipulate different
images and literally just copied and pasted it.
| | 06:43 | So what I did is I copied and pasted it after
the data URL and before the rest of my HTML.
| | 06:48 | So it looks very daunting and very scary.
| | 06:50 | If you don't know JavaScript, you can
find someone that does. If you've got a
| | 06:55 | 10-year-old in your neighborhood I'm
sure they know how to do JavaScript.
| | 06:57 | But the idea is, it is all HTML.
| | 07:00 | So I preceded the script and then we've
got some additional information in here
| | 07:04 | that references that script and does
things like mouseovers and whatnot, and
| | 07:09 | here you see those references again to the images.
| | 07:11 | I've got three images this time.
| | 07:13 | I've got an image for the person,
which I can move around.
| | 07:17 | So part of the JavaScript is letting me
move this person around, and the other
| | 07:22 | part is allowing me to drag it on top
of something. Now it looks like I've
| | 07:27 | just seated the person into the chair,
but really what I've done is I've
| | 07:31 | instructed it. When I get into a certain
area with the first one and I release,
| | 07:35 | then I want to load the person in chair
image, so there's really three images here.
| | 07:41 | So again, I know it seems little
daunting, but I just want to let you know
| | 07:44 | what's possible with FileMaker Pro.
| | 07:45 | This is really just a very rudimentary example,
| | 07:48 | but try to get the imagination going.
| | 07:50 | So what I'm actually doing there is
just some JavaScript, inside my HTML,
| | 07:55 | a little bit of CSS, and I'm referencing
images that are stored in a container.
| | 07:59 | Now here's my favorite part; I can take all
that same code and add one more step to it.
| | 08:04 | So here's that same code again,
don't be afraid of it.
| | 08:08 | But now what I'm adding down on the
HTML section is something that is a call.
| | 08:15 | So I have a little function that I've said
that when I drag this person over
| | 08:19 | that seat, not only do I want to load
the third image, the InSeat image, but I
| | 08:24 | want to run something that's a fmp://
and then I reference a file, and you see
| | 08:31 | what I'm doing here, is I'm running a script.
| | 08:33 | I've got a script in this database
that's called ReportDragPosition.
| | 08:38 | What it does is it puts some text
and then it takes two variables;
| | 08:41 | dollar sign ($) left and dollar sign ($) top
and it displays the values of those variables.
| | 08:46 | The interesting thing is this HTML is
calling back to the database and running a
| | 08:53 | FileMaker Script, but it's also passing
it two variables dollar sign ($) left,
| | 08:58 | which is the value 300 and dollar sign ($) top,
which is the value of 200.
| | 09:01 | So all that together allows me to drag
this person onto a seat. When I
| | 09:05 | release it, it runs a script and in this
case the script just shows the dialog window.
| | 09:10 | These are some demo files that I put
together, again, it's not in the exercise
| | 09:14 | files, and these are things that I put
together for myself, for the purposes of
| | 09:17 | various other presentations.
| | 09:18 | I wanted to share this with you,
because this is the sort of the inception
| | 09:22 | of some very exciting and compelling things
are moving forward in the FileMaker world.
| | 09:26 | It combines FileMaker Web Viewer Layout Object,
data URLs, FMP URLs, a little
| | 09:31 | bit of JavaScript, some CSS and some
HTML5, put all that stuff together and you
| | 09:36 | get some really compelling and imaginative
things that you can do right inside
| | 09:40 | the layouts in your FileMaker databases.
| | 09:41 | Now if you are interested in more
information on this, I've written a free
| | 09:45 | article that can be found at this address:
| | 09:47 | www.isolutions-inc.com/html5.html,
and I cover all of the different
| | 09:57 | demonstrations that we went through here
with a lot more detail on data URLs,
| | 10:01 | HTML5, JavaScript even pointing
back to some of the lynda.com Essential
| | 10:06 | Training titles, and I even talk about the FMP URLs,
which I think are also very fascinating.
| | 10:12 | So I appreciate you taking the time to look at this.
| | 10:14 | I happen to think that after many
years in the FileMaker market, this
| | 10:18 | combination of technologies is going
to lead to some of the most dynamic and
| | 10:21 | creative and impressive things that
we're going to see embedded into FileMaker
| | 10:25 | Layouts that possibly we've seen ever.
| | Collapse this transcript |
|
|
10. Sharing Your Databases on the NetworkPeer-to-peer networks vs. FileMaker Server| 00:00 | One of the primary reasons that organizations
move to a database like FileMaker Pro
| | 00:05 | over just managing their data on
spreadsheets or Desktop databases
| | 00:09 | is for the ability to be able to share the
database and the data that's contained
| | 00:12 | within it live, with multiple users concurrently.
| | 00:15 | Centralizing your data and sharing it
is a major step forward in maintaining
| | 00:19 | data integrity for any organization.
FileMaker Pro is an excellent option for such a step.
| | 00:25 | Any database that's created in
FileMaker Pro can either be used as a
| | 00:28 | single-user database, which is just a
database like the one that we have here
| | 00:33 | on screen that I could just Save to my
Desktop, or like a device iPhone, iPad
| | 00:38 | or iPod Touch; or I can host this,
| | 00:41 | or present it in a hosted environment
where multiple users can all access the
| | 00:45 | data at the same time.
| | 00:46 | So depending on your needs, you may
or may not need to share your data,
| | 00:50 | although most users of FileMaker do
need to share their data even if it's just
| | 00:54 | sharing it with one other user, that's
what we would call a hosted environment
| | 00:57 | or a shared database.
| | 00:58 | Now one very important point here
that I want to make; we're talking about
| | 01:02 | sharing your FileMaker databases,
but I need to caution you with extreme
| | 01:07 | prejudice that this is not file sharing.
| | 01:10 | You should absolutely in no case ever,
ever, ever, file share a FileMaker database.
| | 01:15 | So what I mean by that is don't put your
database, like the database we have here
| | 01:19 | on screen, into a shared directory and
then open it up and have another user
| | 01:24 | open up that same file.
| | 01:26 | That might be how you work with your
spreadsheets or your word processing
| | 01:29 | documents, but those are extremely
different documents than what FileMaker is.
| | 01:33 | FileMaker databases, even a single-user
FileMaker database, is a delicate
| | 01:38 | balance of moving parts internally that
have been engineered in a very specific
| | 01:42 | way to allow for seamless multi-user access.
| | 01:45 | So you do not file share them.
| | 01:47 | Even if the word FileMaker is also
in the file sharing, they have no
| | 01:51 | relationship whatsoever.
| | 01:52 | So it's extremely important that you
never file share FileMaker databases.
| | 01:56 | The one reason for that is because
you could permanently damage a
| | 02:00 | FileMaker database by simply opening it
in a file sharing environment.
| | 02:04 | Those are not very common, but you
should be aware that that is a possibility.
| | 02:09 | FileMaker does however have a bunch of
different very elegant ways that you can
| | 02:13 | share these for multiple users, for
either two users at the same time or up to
| | 02:17 | hundreds of users, and I'm going to
talk about those here in this movie.
| | 02:20 | So your two options for sharing
FileMaker databases are one that's called
| | 02:24 | peer-to-peer sharing, which is using
FileMaker Pro clients talking to each other.
| | 02:29 | We're going to talk about that here and
then also sharing using FileMaker server.
| | 02:33 | So first let's take a look at peer-to-peer sharing.
| | 02:36 | Now you may not now this, but by simply
having a copy of FileMaker Pro, I have
| | 02:39 | FileMaker Pro 12 here, but also a copy
of FileMaker Pro 12 advanced,
| | 02:44 | this will work in the same manner.
| | 02:46 | If you have a copy of FileMaker and
other users on your same network,
| | 02:50 | and that's the key here, they need to be able
to see your computer on the network.
| | 02:55 | If you all have that, one of you can
set up your copy of FileMaker Pro,
| | 03:00 | the application, to serve as the host of a database.
| | 03:03 | So let's say, I've got this database, there
is a couple of steps that we need to do first.
| | 03:06 | I first need to set up the database so it
can be shared and that's one simple step.
| | 03:10 | If we go under the File>Manage>
Security you'll see extended privileges.
| | 03:15 | Now we talked about extended
privileges earlier in this course,
| | 03:19 | but the one extended privilege that is critical
to be being able to share is the fmapp,
| | 03:23 | which allows access via the FileMaker Networks.
| | 03:25 | So that means if you want to share
from one client to another or more
| | 03:29 | importantly on FileMaker server, you need to
have this turned on at least one Privilege Set.
| | 03:35 | So we see here the Full Access
Privilege Set has it turned on.
| | 03:37 | So we need one account that's active
to have the extended privileges assigned
| | 03:43 | to that Privilege Set.
| | 03:45 | So that's all that is required
for this database to be hosted.
| | 03:48 | So keep in mind, this is not a
default setting, you would have to go and
| | 03:52 | turn this on yourself.
| | 03:53 | So once you've got your database set for
hosting, let me show you how can set up
| | 03:57 | FileMaker Pro for hosting that database.
| | 04:00 | Now if you look under the File menu of
any copy of FileMaker Pro or FileMaker
| | 04:03 | Pro Advanced, you'll see that there's an
option for Sharing; and the first option
| | 04:08 | you see for Sharing is called FileMaker Network.
| | 04:10 | If I select that it pops open
the FileMaker Network settings.
| | 04:13 | Before I go any further with this I just want to say,
this is not an optimal hosting environment.
| | 04:18 | It's perfectly understandable if you
have maybe one or two users that need to
| | 04:21 | share your database, but I would go so
far as to say -- this is not an opinion,
| | 04:26 | this is the best practice -- that if you
can support this infrastructure within
| | 04:30 | your organization, anymore than
just one single user in a database or
| | 04:34 | potentially have others that might need
to share the same database not even at
| | 04:37 | the same time, you need to
host it on FileMaker server.
| | 04:40 | We'll go into the reasons why that is
in a second and this is not a recommended
| | 04:43 | hosting environment at all.
| | 04:45 | FileMaker Pro is intended to be set up.
They are very sophisticated hosting environment.
| | 04:50 | It is not a workaround of any kind.
It is intended to be hosted that way.
| | 04:54 | So if you need to though, cost permitting
of course, if you want to set up a
| | 04:59 | network of FileMaker Pro clients,
you can go with this route.
| | 05:03 | So all you need to do in that case is
open a copy of FileMaker Pro, this is
| | 05:07 | a copy that's on a computer that is hooked
up to a network that other users can see.
| | 05:11 | So when you hit on, you'll see one
change happen and that is that you get an
| | 05:16 | IP address that shows up here,
under the TCP/IP Address.
| | 05:20 | Now that's your address and this is the
address that you want to distribute to other users.
| | 05:24 | Down below then you'll see whatever
files that you have open and I only have the
| | 05:28 | one file open and I can go in and I
can Specify what level of Privilege Set
| | 05:33 | access I want to allow any users.
| | 05:36 | Or I can say, All users can see it or No users.
| | 05:39 | If I have some files open that I want
to host and some that I don't,
| | 05:43 | I can turn No users on some, and All users on
others, so whatever it is that you intend to do.
| | 05:48 | So once that's done, you just simply
hit OK and then now other users on your
| | 05:52 | network, who again, can see your IP
address from their machine, would go
| | 05:57 | under the File menu to Open Remote and what
they will see is the Open Remote file dialog.
| | 06:04 | But because they are on the same
network as you are, they go to Local Hosts.
| | 06:08 | They are going to see a list of servers,
or in this case this is your machine
| | 06:14 | that is acting as a server. What
they'll see is the name of the machine
| | 06:18 | and then when they click on it, they
will see the file name and they can simply
| | 06:22 | hit Open. So now, you see that I'm
actually logged into this file that's been hosted.
| | 06:28 | If they cannot see your computer acting
as a Host under the Local Host you can
| | 06:32 | go in the Favorite Hosts, hit Add and
then manually type in the IP address and
| | 06:36 | then click on it. Many times
that allows your users to see this.
| | 06:40 | So this is what's called a
peer-to-peer environment.
| | 06:42 | Now granted, this is supported by FileMaker Pro,
but is not optimal by any means.
| | 06:47 | It is not a best practice for hosting
databases, and again, the best practice
| | 06:50 | is, if you have more than one user,
you should be using FileMaker Pro Server.
| | 06:54 | FileMaker Pro is a database platform
that is intended to be shared with multiple
| | 06:58 | users and can be shared with workgroups
of up to hundreds of users, which we'll
| | 07:02 | discuss those limits in a second.
| | 07:04 | But if you find yourself having to
use this peer-to-peer networking, let me
| | 07:08 | present you with some of the caveats may be.
| | 07:11 | First of all your limit in a peer-to-peer
sharing environment is only nine
| | 07:14 | additional simultaneous users.
| | 07:16 | So including you, that's 10 people all
accessing a database at the same time.
| | 07:20 | You may have a workgroup that supports that number.
| | 07:23 | Do not mistake this stat., this is not FileMaker's
limit of how many simultaneous users
| | 07:29 | can access the database, this is not even close.
| | 07:31 | This is what the FileMaker Pro peer-to-
peer environment supports, and again,
| | 07:35 | it's not a best practice or
recommended hosting environment.
| | 07:39 | The host computer must have a static
IP address. It's not critical, but if you
| | 07:43 | have a machine that every time you
reboot the machine, it gives you a DHCP or a
| | 07:48 | dynamic IP address, you are going to
have to continue to redistribute that IP
| | 07:52 | address every time that you log on to your machine.
| | 07:55 | Additionally, the host computer must remain on
at all times or the connection will be lost.
| | 07:58 | There's no magic here.
| | 07:59 | You open up the file, you're the host,
when you close the file, whether it be,
| | 08:03 | because you've closed the FileMaker
application or you've closed your computer,
| | 08:06 | that connection is going to be gone.
That might not be consistent enough for
| | 08:10 | true workgroup environments, and
the connections are not secure.
| | 08:13 | The FileMaker has a very sophisticated
and industry class way to secure
| | 08:17 | communication between clients and
server when using FileMaker Server,
| | 08:21 | but that is not available to you when
you're doing peer-to-peer connections.
| | 08:25 | There are also no automated
backups available when you're going in
| | 08:29 | peer-to-peer environment.
| | 08:30 | So unlike the very industry grade and
stable backups that are available on
| | 08:34 | FileMaker Server, you'll notice that
there are none available and this can be up
| | 08:38 | to you the user, to continue to make
copies in to other locations if you want to
| | 08:42 | backup your databases.
| | 08:44 | And probably most importantly, the
performance could be compromised.
| | 08:47 | FileMaker Pro Server is set up to
allow hundreds of users' simultaneously
| | 08:51 | access to your database and allow them to do
that in a very performance rich environment.
| | 08:57 | Not the case when it's peer-to-peer,
you're at the mercy of your network
| | 09:00 | connections and more importantly, you
are at the mercy of the processing speed
| | 09:03 | of your workstation computer.
| | 09:05 | So this is not an optimal environment by any means.
| | 09:08 | Now FileMaker Server software, which is
another product available from FileMaker
| | 09:13 | Pro is the key for deploying
FileMaker Pro solutions to many users.
| | 09:17 | Using FileMaker Server, the FileMaker
Solution can be shared among tens or
| | 09:20 | hundreds of FileMaker Pro or
FileMaker Go clients, all at once.
| | 09:24 | All of them simultaneously accessing
and, depending on their privileges,
| | 09:28 | modifying data in your system.
| | 09:30 | Now most choose to use FileMaker Server
because they need to share for more than
| | 09:33 | nine simultaneous users.
| | 09:36 | But the following are reasons to
host FileMaker Pro files with FileMaker
| | 09:39 | Server, rather than the peer-to-peer
sharing with FileMaker Pro, beyond just
| | 09:42 | the number of users.
| | 09:44 | First of all you can host up to
125 files at once on one server.
| | 09:48 | Now keep in mind, you can have up
to a million tables in each file.
| | 09:51 | So really the file limits shouldn't
matter much since you can build a ton of
| | 09:55 | different tables into a single FileMaker
file and they can all be related tables
| | 09:59 | in a relational environment.
| | 10:00 | So 125 files on one single copy server.
You could have additional copies of
| | 10:04 | server with other files on them if
you like. You can provide data access for
| | 10:08 | up to 250 FileMaker Pro, Pro Advanced
or FileMaker Go clients, if you just have
| | 10:13 | the standard version of FileMaker Server.
| | 10:15 | It's the first tier of what
you can do with FileMaker Server.
| | 10:18 | Now there's a product that's called
FileMaker Server Advanced that lifts the
| | 10:22 | restriction of 250 clients and can
allow hundreds of different simultaneous
| | 10:28 | clients in a very safe and performance
rich environment with no compromise,
| | 10:32 | you just do need to upgrade to FileMaker
Server Advanced in order to be able to that.
| | 10:37 | You can schedule automated backups,
which is critically important to any data
| | 10:41 | environment and you can do so with
integrity checking to make sure that with the
| | 10:46 | databases that you are backing up
are not bad backups.
| | 10:49 | You can create FileMaker based websites
and web applications using PHP or XML or
| | 10:55 | even other applications that require XML;
very powerful capabilities here from a
| | 11:01 | web standpoint FileMaker.
| | 11:02 | All you need is FileMaker Server in
order to be able to host PHP applications
| | 11:06 | or XML applications.
| | 11:07 | There's another web technology
that's called Instant Web Publishing
| | 11:11 | that does require FileMaker Server Advanced.
| | 11:14 | You can also view key information
about hosted databases and connected users.
| | 11:18 | So whoever your database administrator
is can see who's connected at any given
| | 11:21 | time, full logs of information, all the
activities that they're performing, any
| | 11:24 | errors, all sorts of notification,
industry grade server level stuff.
| | 11:29 | You can also automate certain scripts
running in your FileMaker Pro solutions.
| | 11:34 | So for example, if you have a script
that automatically pulls in currency
| | 11:38 | exchange rates from the web everyday,
instead of having to have your users hit a
| | 11:42 | button to pull that in, you can create
a script and then go on to your server
| | 11:47 | and have that script automated to run in
the middle of the night, so that a user
| | 11:49 | doesn't have to do that.
| | 11:51 | I'll be showing you how to do
that later on in this course.
| | 11:54 | You get significantly better performance
out of your FileMaker databases when
| | 11:58 | they're hosted on FileMaker Server.
| | 11:59 | Now in FileMaker Server 12, it uses
all the resources available to you on the
| | 12:03 | hardware device and allows you to
create an optimal performance environment for
| | 12:09 | those hosted FileMaker databases.
| | 12:11 | You can also use external authentication
as we discussed earlier in this course.
| | 12:14 | So if you have active directory that's
been used to manage single sign-on for
| | 12:19 | example for all the other applications
in your Windows environment, you can
| | 12:22 | include your FileMaker databases in
that single sign-on scenarios as well, all
| | 12:26 | by using external authentication
although that does require that your databases
| | 12:29 | are hosted on FileMaker Server.
| | 12:31 | Any of these are legitimate reasons to
go with FileMaker Server for hosting.
| | 12:35 | Keep in mind that FileMaker Server is
another product that you must purchase,
| | 12:39 | but you should seriously consider
purchasing this product if any of the items
| | 12:44 | that we discussed earlier are
appealing to you or your organization.
| | 12:47 | And also, keep in mind although I don't
have any recommendations that there are
| | 12:51 | some organizations out there that
can provide hosting packages for you,
| | 12:55 | that mean that you don't have to buy
your own license of FileMaker Server, you
| | 12:58 | can just pay a monthly fee and
upload your databases to their servers.
| | 13:02 | But most important, sharing your
databases is the key to centralizing data
| | 13:06 | within your organization and FileMaker
provides either a peer-to-peer sharing
| | 13:09 | for much smaller networks, but really
the best practice here is any network with
| | 13:14 | more than one user accessing a
database should require the industry grade
| | 13:18 | product that FileMaker provides
that's called FileMaker Server.
| | Collapse this transcript |
| FileMaker Server vs. FileMaker Server Advanced| 00:00 | Once you decide that you want to share
your databases using FileMaker Server,
| | 00:04 | you must then decide which of the two FileMaker
server products are going to be right for you.
| | 00:09 | First there's FileMaker Server.
| | 00:11 | FileMaker Server allows you to host
125 files at once and provide data access
| | 00:16 | for up to 250 clients.
| | 00:18 | You can schedule automated backups and
even do custom web publishing with PHP or XML.
| | 00:25 | You can also gather all sorts of
information about the users and the databases
| | 00:28 | that are being hosted on server and
then even automate the running of certain
| | 00:32 | FileMaker scripts or even some
operating system level scripts.
| | 00:35 | The main reason that you would go
with any version of FileMaker Server is
| | 00:39 | because you really get significantly
better performance out of your databases
| | 00:42 | when they're being shared.
| | 00:44 | Now currently, at the time that
we're recording this, FileMaker Server 12
| | 00:48 | runs at a cost of $999.
| | 00:50 | Keep in mind there are organizations
out there that will allow you to host
| | 00:54 | your database on a shared server that
doesn't require that you buy a license
| | 00:58 | of FileMaker Server or FileMaker Server Advanced
and instead you would pay a monthly fee.
| | 01:02 | I don't officially endorse any of those
in particular, but they are out there
| | 01:06 | and they've been around for quite some time.
| | 01:07 | So that is an alternative to investing the $999.
| | 01:11 | But my stern advice is that if you're
hosting your database for even up to two
| | 01:15 | people, you should seriously consider
one of the two FileMaker Server products.
| | 01:19 | FileMaker Server is the least expensive of the two.
| | 01:22 | FileMaker Server Advanced, as its name implies,
| | 01:26 | it is a little bit more enhanced of a
product than FileMaker Server although
| | 01:30 | everything that FileMaker Server does
FileMaker Server Advance does as well,
| | 01:33 | it's just that there are some additional
features that you get when you purchase
| | 01:37 | and install FileMaker Server Advanced.
| | 01:39 | Mainly, you can provide data access to
an unlimited number of users of FileMaker
| | 01:43 | Pro clients, FileMaker Pro Advanced clients,
FileMaker Go clients, any client.
| | 01:48 | Of course you have the 250 user limit
on FileMaker Server and you have no
| | 01:52 | limit essentially on FileMaker Server
Advanced, although it does depend on the
| | 01:58 | assumption that you have a sufficiently powerful
server and your database has been optimized.
| | 02:04 | If you follow normalization techniques
and proper data modeling with your
| | 02:07 | FileMaker databases, you can really
set them up to be shared by hundreds
| | 02:12 | of users if necessary.
| | 02:13 | But if you get into the couple thousand
user range, really in any database
| | 02:18 | structure, even in a very overpowered
server, now you might be reaching the
| | 02:23 | limit of one iteration of FileMaker
Server. Keep in mind you can always have
| | 02:25 | multiple copies of FileMaker Server,
each running different databases, and you
| | 02:29 | can have dozens of them, and therefore, you
could service organizations of thousands if need be.
| | 02:36 | So keep that in mind and FileMaker
ceiling isn't published, but it does have
| | 02:40 | something to do with the server
that you are running it on and the
| | 02:43 | optimization of the database.
| | 02:45 | You can also do something where you
create local or external administrator
| | 02:48 | groups inside the administrator software.
If you have third-party consultants
| | 02:53 | or other individuals in the group
who don't need full configuration or
| | 02:56 | administrative access to your server,
you can allow them just to able to turn on
| | 03:00 | and off different databases, we'll
cover that later in this chapter.
| | 03:04 | If you're interested in publishing
your databases to the web using FileMaker
| | 03:07 | specific technology, which is called
Instant Web Publishing, you will be required
| | 03:12 | to host that database on a copy of
FileMaker Server Advanced. That is not
| | 03:15 | supported on FileMaker Server, but if
you do have a copy of FileMaker Server
| | 03:19 | Advanced, you can have up to 100
simultaneous users all accessing a database on
| | 03:26 | your FileMaker Server Advanced database
server and they can all access FileMaker
| | 03:31 | without a client and they can do so via a browser.
| | 03:33 | Also if you have other applications
that need to access data from hosted
| | 03:38 | FileMaker databases via ODBC or JDBC,
and again this isn't if your FileMaker
| | 03:43 | database needs to reach into other
applications via ODBC, this is just if it's
| | 03:47 | being hosted and if other applications
are going to pull data out of it or
| | 03:51 | interact with it via ODBC.
| | 03:52 | In that case you must host the database
with FileMaker Server Advanced and you
| | 03:57 | have a limit of 50 simultaneous remote
users. That's actually quite a bit of
| | 04:02 | remote applications all sharing access
simultaneously into your database so
| | 04:06 | that's something to be aware of as well.
| | 04:08 | This product is priced at $2999.
You can see there's a $2000 difference
| | 04:14 | just to be able to have unlimited clients
and to be able to do Instant Web
| | 04:18 | Publishing and ODBC or JDBC publishing.
| | 04:21 | So it really depends on what your
particular environment is and which one of
| | 04:24 | these two would make the most sense for you.
| | 04:27 | If you want to compare these products,
I put together a couple of screens here for
| | 04:30 | you, and talk about some of the
different things that are available. You'll see
| | 04:33 | that most things like the set up
administration, reliability, the fact that it
| | 04:38 | is a true 64 bit application, and some of
the security features, and also custom web
| | 04:44 | publishing, you'll notice that all those
are available in both of the products.
| | 04:47 | One thing I want to bring your attention
to is with Custom Web Publishing,
| | 04:51 | that's really mainly doing PHP applications
that use FileMaker as a backend.
| | 04:54 | It's very popular technique.
| | 04:57 | But if you're going to do that and you
have FileMaker Server, you can support up
| | 05:00 | to hundred concurrent connections.
| | 05:02 | If you have FileMaker Server Advanced,
that's 200 concurrent connections.
| | 05:05 | I'll talk about this more in the web,
that's not 200 sessions or connected users
| | 05:10 | at any given time, I'll talk more about
how that breaks down, but that's in any
| | 05:14 | given second there can only be 100 or
200 requests being processed from the web.
| | 05:20 | That does extrapolate out over thousands of users.
| | 05:23 | We'll talk about that more in the web chapter.
| | 05:26 | But the sharing limits change and
then of course administrator groups and
| | 05:31 | Instant web Publishing and ODBC
and JDBC connectivity all require
| | 05:34 | FileMaker Server Advanced.
| | 05:37 | FileMaker provides hosting options for
all types of network environments.
| | 05:40 | Before you decide which version of
server you'll need, you should look at how
| | 05:45 | many users you need to provide access
to and what types of access they will be
| | 05:48 | requiring of your databases
before you make that decision.
| | Collapse this transcript |
| Installing FileMaker Server and the Admin Console Start page| 00:00 | When you've made your purchase of
FileMaker Server and it comes time to install,
| | 00:04 | it's a relatively easy process.
| | 00:05 | We're going to go over that here in
this movie, but like any other software it
| | 00:09 | comes with one installer and it
installs all the server components onto your
| | 00:12 | desired machine or multiple machines,
which we'll talk about in a second.
| | 00:16 | But first let's take a look at the
components of FileMaker Server
| | 00:19 | and what is being installed for you.
| | 00:21 | FileMaker Server is made up
of many different components.
| | 00:24 | There is Database server, which is the core
database server that does all the hosting.
| | 00:28 | There is a FileMaker Script Engine,
which is a separate component that runs
| | 00:32 | FileMaker scripts and plug-ins.
| | 00:34 | And there is the Web Publishing Engine,
| | 00:36 | it's a separate suite of software that handles
all web connectivity to FileMaker Server.
| | 00:41 | Now the web server is part of all
these components, but it's not something
| | 00:45 | that's installed or managed by FileMaker Server.
| | 00:48 | FileMaker Server web publishing
requires the default web server, which is
| | 00:51 | either Apache on your Mac OS X or
Internet Information Server or IIS on
| | 00:56 | your Windows environment.
| | 00:58 | So you're going to want to have that
installed already before you do the
| | 01:01 | FileMaker installation and those come
free with any server grade operating
| | 01:05 | system on each platform.
| | 01:07 | Additionally there is the PHP engine
by the way, that if you're using custom
| | 01:12 | web publishing with PHP, the PHP engine will
need to be installed alongside the web server.
| | 01:16 | FileMaker Server can work with a PHP
engine, if you already have it installed.
| | 01:21 | However, you can install the version of
PHP that FileMaker requires at the same
| | 01:26 | time that you're installing your server components.
| | 01:28 | So keep in mind, the web server does
need to be installed ahead of time.
| | 01:31 | The PHP engine could be installed
ahead of time or you could just opt to let
| | 01:35 | FileMaker install that.
| | 01:36 | FileMaker will not install the web server,
but it will install the PHP server.
| | 01:40 | There is also the FileMaker Server Admin
server component, which is the component
| | 01:43 | that manages the deployment of FileMaker
Server components such as the web
| | 01:46 | publishing engine and displays the Server
Admin Console on client computers for
| | 01:51 | the purpose of configuring them.
| | 01:52 | We'll look at the admin console in the next movie.
| | 01:55 | The FileMaker Server Admin Console
component also gets installed when you
| | 02:00 | install server, that's Java-based administrative
application with which you can
| | 02:04 | administer one or more deployments
of FileMaker Server.
| | 02:07 | Now before you start the installation,
you want to make sure to check the system
| | 02:11 | requirements for your version that
you wish to install to ensure that the
| | 02:15 | software will run on your chosen machine.
| | 02:17 | I strongly recommend that you refer
to the FileMaker Server 12 Getting
| | 02:21 | Started Guide, which comes with FileMaker
Server but is also provided in this exercise folder.
| | 02:27 | In order to install FileMaker Server
you're going to need to install or run the web
| | 02:32 | server if you are in fact, going to be
using any web publishing; that needs to
| | 02:36 | happen ahead of time.
| | 02:37 | You'll quit any copies of FileMaker Pro
running on the install computer and it
| | 02:41 | is a best practice to not have any
copies of FileMaker Pro or Pro Advanced
| | 02:46 | installed on the same machine and server.
| | 02:48 | As a matter of fact, it is best practice
and a strongly worded best practice to
| | 02:52 | not have any other applications running on your machine.
| | 02:56 | You should have a dedicated machine that
you're going to use to install FileMaker Server.
| | 03:01 | You also need to make sure that you
haven't already installed a copy of
| | 03:04 | FileMaker Pro server using the same
license key anywhere else on your network,
| | 03:08 | because there will be a conflict upon installation.
| | 03:10 | You got to meet any prerequisites that
are stated in the server guide or any of
| | 03:15 | the other server documentation and
you're going to want to run the installer.
| | 03:20 | Now when you purchase a copy of
FileMaker Server or Server Advanced, you'll
| | 03:24 | get an installer document much like
you see here, but what we've done for the
| | 03:28 | purposes of this exercise is we've
gone to use the FileMaker Server Advanced
| | 03:33 | 30 day trial which is available at
filemaker.com/products/fms as in FileMaker Server.
| | 03:42 | So you can download this 30 day trial.
| | 03:44 | It does have some limitations, but
it does give you all the components of
| | 03:47 | FileMaker Server Advanced.
| | 03:49 | You'll also need to have an install key.
| | 03:50 | This is the install key that was
provided to us in this installer.
| | 03:53 | Normally you'll get a Name, an Organization
and a License Key, so that's all
| | 03:57 | information that you're going to need to have
before you proceed with this installation process.
| | 04:02 | You can just copy that information if
you'd like to, but make sure that the
| | 04:06 | Name and Organization that you're
provided with are typed into the installer
| | 04:10 | with the exact same syntax.
| | 04:12 | If they've got spaces and commas and
periods and stuff like that and either one
| | 04:15 | of those, you got to make
sure to take those into account.
| | 04:18 | So you can copy your License Key
and then open up your installer.
| | 04:22 | You'll double-click on the icon with the
arrow to install.
| | 04:27 | If you download it from the Internet,
you can just dismiss this warning.
| | 04:30 | You'll need to type in your admin
password if prompted, which will be required
| | 04:34 | if your computer does have one set up.
| | 04:37 | And you can read through the
information, hit Continue and Agree.
| | 04:42 | Now you have a choice to make.
You should be aware that you can install
| | 04:47 | all of the FileMaker components
either on one Single Machine, which we're
| | 04:50 | going to be doing here in this exercise
or upon Multiple Machines, really up
| | 04:54 | to three different machines.
You can split up the different components.
| | 04:57 | So if you choose Multiple Machines,
you're going to prompted to determine
| | 05:01 | which of the two machines is going to be the
master and the other is going to be the worker.
| | 05:05 | Now the master is just the machine
that's going to have the database engine
| | 05:09 | installed and the worker are the machine
or machines that will have things like
| | 05:12 | the web publishing engine or Administrative
Console or even the dedicated web
| | 05:16 | and PHP engines installed.
| | 05:18 | One key thing here is if you're going
to choose Multiple Machines you have to
| | 05:22 | install components on the worker
machines first before you install the master,
| | 05:26 | because when you run the installer
for the master, you have to tell the IP
| | 05:30 | addresses of those other machines.
| | 05:31 | So for the purposes of this exercise we're
going to choose a Single Machine installation.
| | 05:35 | If you want more information about Multiple
Machines, please see the server documentation.
| | 05:39 | You can also use this to uninstall an existing
copy of FileMaker Server from your computer.
| | 05:45 | We'll advance to the next screen and we
see that we have a License Key already
| | 05:49 | installed. This is the one provided
for the demo. Again not with the demo,
| | 05:53 | but when you actually do get you
license make sure that the syntax or the
| | 05:56 | Username and Organization
are exact before you proceed.
| | 06:01 | Once all the files are installed you'll
see a couple of things on screen.
| | 06:04 | First of all you'll notice that a shortcut
to the FMS 12 start page will appear
| | 06:09 | on your Desktop and also you'll be
prompted to start the Deployment assistant,
| | 06:13 | which we're going to do.
| | 06:15 | All you have to do to start the Deployment
assistant is hit Continue, or you
| | 06:19 | could quit at this stage and do the deployment later.
| | 06:22 | To launch the Deployment assistant you
just hit Continue and FileMaker will open
| | 06:27 | up a web page, and this web page is going
to be pointing to the IP address of the
| | 06:32 | server installation with the :16000.
| | 06:36 | That's how you can get to it
at a later date if you need to.
| | 06:39 | So what this page will do is download
the Admin Console to your machine, but if
| | 06:43 | you don't see it right away you can
click this to launch it automatically and
| | 06:48 | once the Admin Console is
downloaded you will see a .jnlp file.
| | 06:53 | The jnlp file is one that you can double-click to allow
you to run the FileMaker Administrative Console.
| | 07:01 | And again the FileMaker Administrative
Console can be run on the same machine as
| | 07:06 | the server or it can be run on another
machine that has access to that server.
| | 07:13 | Either way this is a separate
application from the FileMaker Server.
| | 07:17 | The first thing that you're going to
see when you launch the Administrative
| | 07:20 | Console for the first time is a screen
asking you to enter in a User Name and
| | 07:24 | Password and I strongly recommend that
you write this down somewhere, because if
| | 07:29 | you forget the User Name and
Password after this stage, you'll need to
| | 07:33 | uninstall the FileMaker Server and reinstall it
again in order to bypass the security settings.
| | 07:40 | So the next screen that you see is
something that allows you to import
| | 07:44 | installation settings from a previous version of 12.
| | 07:46 | So if you had Server 12 on another
machine and you uninstalled it and you
| | 07:51 | want to migrate to a new machine,
before you uninstall, as part of the
| | 07:54 | uninstall wizard, you can see an option that
allows you to save a separate file for your settings.
| | 07:58 | So if you had done that, you would hit
Yes, import my settings and import those
| | 08:02 | all in, so any further configuration wouldn't be necessary.
| | 08:06 | You can rename your server, if you have
multiple copies of FileMaker Server on
| | 08:11 | your network, you might want to name
them accordingly and put some description
| | 08:14 | of information on how to contact
somebody who is the administrator.
| | 08:18 | Then we get into the different technologies.
| | 08:20 | Now because we're installing FileMaker
Server Advanced, it's asking us if we
| | 08:23 | want to enable ODBC/JDBC,
we'll go ahead and say Yes.
| | 08:26 | Also asking us if we want to enable
the web publishing components and then
| | 08:29 | asks us which one of the components we want to
install, we'll leave all the default ones set.
| | 08:34 | And here is where you can choose to
defer to use your own PHP engine if you have
| | 08:38 | one previously installed in this machine.
| | 08:40 | Although it is recommended that you use
FileMaker Server's version if you don't
| | 08:43 | already have one installed.
| | 08:45 | Now you can choose between your One
Machine, Two Machine or Three Machines.
| | 08:50 | In this case we're going to choose One
Machine, meaning we're going to install
| | 08:53 | or use all of the components on this single machine.
| | 08:56 | And in this section, the Deployment assistant
is asking you, which web server you're using.
| | 09:01 | It's going to make a guess
based on your operating system.
| | 09:03 | Here we're on OS X, so it says Apache.
| | 09:05 | Now you can see your web server
documentation for how to install and start
| | 09:10 | either Apache or IIS.
| | 09:12 | But here we'll point to which web server
we're using and hit Next, at which time
| | 09:17 | it gives us a deployment summary
indicating all the selections that we've made
| | 09:22 | and then it will go through a process
of deploying where you can watch the
| | 09:25 | installation process happen.
| | 09:29 | And once completed you'll get confirmation
that the deployment was completed on
| | 09:33 | your log file and you can hit OK.
| | 09:36 | Once you're done with that installation,
you will see the Welcome screen appear,
| | 09:41 | which gives you a couple of different options.
| | 09:43 | You can click the Register FileMaker
Server, which allows you to go to the
| | 09:47 | FileMaker page to register your installation
or you can go to the Open FileMaker
| | 09:53 | Server Technology Test page, which
allows you to test things like instant web
| | 09:57 | publishing by simply clicking, you see
here your confirmation is that everything
| | 10:01 | is installed properly, or you can also
test to make sure the PHP is running,
| | 10:05 | where you see here that is running as well.
| | 10:08 | Now if you want to test FileMaker Pro
you have to open a copy of FileMaker Pro
| | 10:12 | and then you'll look under open remote
for a file that's called Server_Sample.
| | 10:16 | Installing FileMaker Server is pretty straightforward.
| | 10:19 | Just make sure that you have some of
the prerequisites in place beforehand and
| | 10:21 | of course that you remember
your User Name and Password.
| | 10:26 | Once you have FileMaker installed,
you can then use the Admin Console to
| | 10:29 | configure it which we will
cover later on in this module.
| | Collapse this transcript |
| Best practices| 00:00 | Before we move on to configuring
your FileMaker Server.
| | 00:02 | I wanted to take a moment to share with you just
some top line best practices for FileMaker Server.
| | 00:09 | You should consult FileMaker's documentation
on server, and if you're a member
| | 00:13 | of TechNet I strongly recommend that you
read a document that's called FileMaker
| | 00:17 | Server 12 Configuration Guide, which
is available to you with your TechNet
| | 00:22 | membership through filemaker.com.
| | 00:23 | But otherwise I wanted to share
with you some important points.
| | 00:28 | When you choose the hardware for which
you're going to install FileMaker Server,
| | 00:32 | make sure that you have some room to
expand. The best practice or the formula
| | 00:36 | here is to look at the exact size of
the databases that you have, and then
| | 00:42 | multiply that by 10 and that's about the footprint
that its going to leave from a storage standpoint.
| | 00:48 | FileMaker Server itself doesn't require a lot
of space for installation, it really just is a service.
| | 00:53 | So the only thing that you need
storage for is for the databases themselves,
| | 00:57 | but you're going to want ten times
the space just simply for the fact that,
| | 01:01 | you are going to be doing backups and saving
backups at least temporarily on the same machine.
| | 01:05 | Make sure that you're providing a
suitable environment for the machine in
| | 01:08 | best case scenario, you would have a
server room with all the other servers.
| | 01:13 | Don't use a personal desktop, don't
use a machine that already is a mail
| | 01:17 | server or especially not a file server;
you must have file sharing turned off
| | 01:21 | on the FileMaker Server.
| | 01:22 | And don't use one that could be accidentally
bumped into or possibly stolen for that matter.
| | 01:28 | Do not install FileMaker Server on a
user's workstation, for various different
| | 01:32 | reasons, not the least of which is stability
and making sure you have the most
| | 01:36 | resources available to your FileMaker Server machine.
| | 01:38 | And when at all possible, avoid running
all other services, specifically email,
| | 01:43 | printer file sharing, on same machine or
FileMaker Pro or FileMaker Pro Advanced
| | 01:47 | for that matter. The best case scenario
and the supported environment for
| | 01:51 | FileMaker Server is to be on a dedicated machine.
| | 01:55 | Backing up your database files is critical.
We're going to talk about that later in this chapter.
| | 02:00 | You may be tempted to use mirroring
or third-party backup software.
| | 02:04 | The key is to backup your databases
that are stored in the backups directory.
| | 02:10 | We will talk more about that later in this
chapter, but it's important that you know.
| | 02:14 | Never point any third-party backup
or mirroring software towards the live
| | 02:19 | databases directory; you can damage
those files if they're currently being
| | 02:23 | hosted and if they're active.
| | 02:24 | There's a lot of moving parts in a
FileMaker hosted database and it's very
| | 02:28 | important that you never backup or make
any manual copies of any files in that
| | 02:32 | directory. There is specifically a backup
directory for that purpose, and you can
| | 02:37 | use your third-party backup to back those up off-site.
| | 02:40 | We'll talk in more detail about
that in the chapter in Backing Up.
| | 02:43 | Do not use any anti-virus software to
scan live database files. Even if you are
| | 02:48 | going to the Internet FileMaker Server
services and components do not do any
| | 02:52 | installing of anything from the web.
There is no need to scan your live
| | 02:57 | database files. Do not by any means point your
scanning software at that live database directory.
| | 03:04 | Disable screen savers and sleep
functions and most likely you'll be using
| | 03:08 | headless servers in an optimal environment
anyways, but screen servers will
| | 03:11 | disrupt the stability of your FileMaker Server service.
| | 03:15 | Of course make sure that you have
enough storage for 10 times the databases.
| | 03:20 | And the key is, if you're going to choose
what you're going to spend money on
| | 03:23 | when you're choosing your hardware,
spend money on I/O or the disk speed.
| | 03:28 | It's a lot of RAM, multiple processors
and a ton of memory storage, don't add up
| | 03:33 | anywhere near to how important it is to
have fast I/O. If you can get away with
| | 03:38 | 15,000 RPMs of speed, that is the best
case scenario; 10 is recommended, 75 might
| | 03:45 | be a little low, but if you have a choice
between an additional processors or
| | 03:50 | more I/O speed, go with I/O speed every time.
| | 03:52 | All the FileMaker Server does is read and write that's it.
It barely uses any other resources,
| | 03:57 | It will certainly try to give your
server the fastest I/O possible.
| | 04:01 | You may also look into, in addition
to have fast hard disk possible
| | 04:05 | Multi-disc RAID systems or Reliable Storage
Area Network or SAN systems for hosted databases.
| | 04:11 | You definitely want to turn off indexing
services or Spotlight, as these can be
| | 04:16 | disruptive to the performance of your
FileMaker Server and if it is a truly
| | 04:19 | a dedicated server you don't need
anything indexed on the operating system level.
| | 04:24 | Also exclude your live database
directory or even both directories from your
| | 04:29 | Time Machine backups. You can use
Time Machine to back up just the backup's
| | 04:33 | directory but definitely exclude your
live database directory from your backups.
| | 04:38 | It is however recommended to disable Time Machine
completely if you're on the OS X environment.
| | 04:43 | Verify that Shadow Copy is also disabled
on Windows if you're in a Windows
| | 04:47 | environment; these features reduce
performance of FileMaker Server.
| | 04:52 | Things like Shadow Copy and Time Machine can be
very CPU intensive and it's recommended
| | 04:56 | that these are disabled on the server machine.
| | 05:00 | Shadow Copy, which is sometimes referred
to as volume snapshot service or VSS,
| | 05:05 | is a backup and restore function that
creates a point in time copy of files.
| | 05:09 | And generally a feature like this
provides little benefit on a server machine.
| | 05:12 | If this feature is enabled it will
significantly slow down the reading and
| | 05:16 | writing of the disk which is the server
I/O which is all FileMaker is actually
| | 05:20 | doing on your machine.
| | 05:22 | Installing FileMaker Server is pretty straightforward,
configuring it is pretty straightforward.
| | 05:26 | But make sure that you address some
of these simple best practices and of
| | 05:29 | course consult other documentation on
best practices, and make sure that you're
| | 05:33 | giving your FileMaker Server environment
the best chance to perform at its highest level.
| | Collapse this transcript |
| Configuring FileMaker Server| 00:00 | In order to configure the settings
on your FileMaker Server you'll need
| | 00:04 | something called the Admin Console.
| | 00:06 | Now you are presented with the ability
to start up the Admin Console at the end
| | 00:10 | of the installation process. If you
chose not to do that you can invoke the
| | 00:14 | download for the Admin Console by
going to your web browser and typing in the
| | 00:19 | IP address where you've installed
your server. If you've installed your
| | 00:22 | server on multiple components putting
the IP address at the web server, and put
| | 00:26 | in :16,000, that's the port that FileMaker
communicates on. Then you'll be
| | 00:31 | presented with the FileMaker Start page,
at which time you'll hit the Start
| | 00:35 | Admin Console download page, and it will open
up the Admin Console and prompt you to log in.
| | 00:44 | You may also see a .jnlp file that got
downloaded during the process and you
| | 00:49 | can just go right to that file and double-click
on it which will also open up the Admin Console.
| | 00:53 | This process will also prompt to save
a shortcut on your desktop or whatever
| | 00:57 | location, if that's also more comfortable for you.
| | 01:00 | Now again Admin Consoles can be
installed on remote machines, as long as that
| | 01:04 | machine has network
access to the FileMaker Server.
| | 01:08 | So if you have a laptop you can have
various different Admin Consoles all
| | 01:13 | installed on that as long as you can
connect to the Internet and manage your servers.
| | 01:17 | For example, as a consultant I have
various different Admin Consoles installed
| | 01:21 | on my machine at the office that
allow me to log into my client's remote
| | 01:25 | servers, to perform any kind of
maintenance or configuration tasks.
| | 01:29 | So in order to configure, we need to log
into our Admin Console, and this is the
| | 01:34 | Username and Password that you
set up during the deployment process.
| | 01:39 | Once you log in you'll be presented
with the FileMaker Server Admin Console
| | 01:44 | Overview. What you want to see
here are green checkboxes next to all the
| | 01:49 | different services, so you see we've
got the three different components;
| | 01:52 | Web Server, Web Publishing Engine,
Database Server. In this example they're
| | 01:55 | all installed on the same server, so I
see them all under the blue header with
| | 01:59 | the IP address of the machine where they're installed.
| | 02:02 | If they're installed on three different
machines you'll see three blue headers,
| | 02:05 | all with their own IPs or two
different machines and so on.
| | 02:08 | So in order to begin the
configuration process you'll click down on the
| | 02:11 | left-hand side to Configuration.
| | 02:13 | You'll see different hyperlinks
that'll get you to the same places as the
| | 02:17 | navigation on the left-hand side.
| | 02:18 | But we'll start with General Settings.
| | 02:20 | Now in General Setting this is where
you can name your server we've named it
| | 02:24 | during the deployment process, I
can name it something different.
| | 02:27 | This is of course for the purpose of
if you have multiple different servers all
| | 02:31 | in your same network.
| | 02:32 | I should also note that if you're
running the trial and you then choose to
| | 02:36 | upgrade and purchase an actual license
key, all you have to do is go to this
| | 02:40 | tab General Settings Server Information
and hit the Change License Key button.
| | 02:44 | It'll allow you to upgrade to a fully
working and licensed version of FileMaker
| | 02:47 | Server without having to change any of your
configurations or even pull the service down.
| | 02:52 | The Email Notifications tab is not
to be confused with any email sending
| | 02:56 | features that you build in the FileMaker.
| | 02:58 | FileMaker allows you to send emails
through scripts either using the email
| | 03:02 | client, or in a more robust fashion, directly
through an SMTP server; that is not what this is.
| | 03:09 | In that case, that's all on the SMTP
server side; all you're building into your
| | 03:13 | FileMaker scripts are SMTP information.
| | 03:16 | This is specifically for if you want
FileMaker Server to send you, the
| | 03:20 | administrator, any notifications about
errors or warnings that are coming from
| | 03:25 | activity that's being logged
on the FileMaker Server side.
| | 03:27 | So if you are administrator and you
want to be alerted if the service goes down
| | 03:31 | or if there's some error encountered,
then what you would do is put in the SMTP
| | 03:34 | information that you want FileMaker
to use, because FileMaker is not a mail
| | 03:39 | program or SMTP program. That is what
this is for; you put that information in
| | 03:44 | here, setup your account, and then you
can tell it which emails will receive
| | 03:47 | these notifications and you can
comma separate those for multiple emails.
| | 03:51 | You can also choose Errors or Errors
and Warnings. Warnings or errors are a
| | 03:55 | little bit more verbose of notification.
| | 03:58 | Admin Console can be restricted under
the Admin Console tab, to just a series of
| | 04:02 | IP addresses or one IP address.
| | 04:06 | You can also set up a different Username and Password.
| | 04:08 | If you forget your Username and Password
you have to uninstall and reinstall FileMaker Server.
| | 04:13 | But if you want to change it you can
go in here and change it to the Username
| | 04:18 | and Password button right here.
| | 04:20 | You can also have it automatically
check for updates, when you go to the
| | 04:23 | FileMaker Start page in your browser.
| | 04:25 | Finally Auto Start means, when you
restart the machine do you want it to
| | 04:29 | automatically restart the Database
Server and or the web Server service?
| | 04:33 | This is recommended for true server
environments, but if you've just setup
| | 04:36 | FileMaker Server on your laptop or a
test environment, maybe you want to disable
| | 04:40 | these because you don't always want that service on.
| | 04:44 | Now Administrator Groups are something that
are specific to FileMaker Server Advanced.
| | 04:49 | I just logged in using my admin privileges
that allow me to get access to the
| | 04:54 | Admin Console, but I could setup
subgroups for let's say consultants or
| | 04:59 | individuals that I just need to be
able to upload their own databases.
| | 05:03 | As an IT person or administrator of
the server, I probably don't want to be
| | 05:07 | burdened with, having to continue to replace files
every time somebody changes some things offline.
| | 05:12 | So instead what I would do is I would
set up a group, I would name the group
| | 05:16 | whatever I want, and then I would give
it a password, and I could enable the
| | 05:22 | Start page and say, Here are your files.
| | 05:29 | What we want to do is put in a Password
and Confirm the Password, and this
| | 05:36 | is what we will distribute to the different users.
| | 05:39 | And the link that we give them will be this
link that you see down here in the bottom.
| | 05:43 | First we're going to want to save, what
we've done give them a folder, these are
| | 05:48 | group folders telling it which databases
they have access to, so we're going to
| | 05:52 | give them the access to sample database.
| | 05:54 | So now when you see that
you've got access to the databases,
| | 05:59 | and you've given them all the privileges
that you want them to have, and
| | 06:03 | passwords you can then save this setting.
| | 06:07 | And after you save the setting, you can
then click on this button and you'll see
| | 06:11 | what's called the Group's Power User page.
| | 06:13 | So this is something that they can use to --
you just distribute this link with
| | 06:17 | the IP address :16000/groups, and then
the name of the group that you set up.
| | 06:23 | So here's a message that you typed in.
This, by simply clicking on it,
| | 06:27 | will allow them to open any of these files in either
Pro or Instant Web Publishing as appropriate.
| | 06:34 | But they also then, can use the Group
Name and the Password that you've given
| | 06:41 | them to login through the administrative
console, if necessary, as well.
| | 06:46 | So Administrator Groups, great idea if
you have individuals who have to manage
| | 06:50 | their own databases, but it does
require FileMaker Server Advanced.
| | 06:52 | On the Database Server side you can
manage how many client connections you can
| | 06:56 | have, running on the server at any given time.
| | 06:59 | You don't really need to manipulate this;
it doesn't really allocate resources in
| | 07:02 | any way, shape or form, but you can
power this down if you're not going to use
| | 07:06 | the maximum number of clients.
| | 07:08 | You can set the idle time. This is
something, if you set up in your security
| | 07:12 | settings that users will be logged off
after the idle time is met, you can set
| | 07:17 | that idle time here by both checking
it turn it on and then setting what the
| | 07:20 | maximum time is that you want to use.
| | 07:23 | And if you have a directory service this
where you would configure the Directory
| | 07:26 | Service information; same thing with
Databases here. You don't have to really
| | 07:32 | set it to a lower number, if you
don't want to, but if you only have a few
| | 07:36 | databases it can't hurt to drop that
down and save whatever the little resources
| | 07:40 | are allocated to it.
| | 07:41 | Down on the bottom of the page is the
database cache; this is an important setting.
| | 07:45 | You'll notice here that, it's set by
default to a 128 MB, and this is database
| | 07:49 | cache that is used for everything from
live backups, to indexing to a little bit
| | 07:54 | on the performance side of your databases.
It might be something that you're
| | 07:59 | not familiar with, but one thing I can show
you is, if you go over to Statistics here,
| | 08:03 | you'll see that there's this thing called Cache Hit %.
| | 08:06 | A Cash Hit % is something that
you want to have between 90% and 95%.
| | 08:11 | And you don't want it at a 100% like
you see here, because that means that the
| | 08:14 | FileMaker Server Service is currently
using a 100% of the allocated RAM cache,
| | 08:19 | which likely means that it needs more than that,
| | 08:21 | it's just using everything that you've given it.
| | 08:24 | So the way that you can give it
more is by upping this amount here.
| | 08:27 | You see that FileMaker Server Admin
Console has given us an estimate of 3072 MB
| | 08:34 | available on this machine, and so I
can up that percentage to whatever limit
| | 08:40 | that I want to, and then save that.
| | 08:44 | And then, what I'll do is let it run
possibly for few days or week or so
| | 08:47 | depending on your activity.
| | 08:49 | And see if I've gotten my peaks or my
averages down into the 90 to 95 range.
| | 08:54 | If I see that it's too low then I can go back to the
Database Server and drop this download a bit.
| | 09:00 | But this is what you have available to you for
RAM cache, and this is what's currently allocated.
| | 09:04 | So you can play with those, until
you get to that sweet spot of 90 to 95.
| | 09:08 | Security has some interesting settings here.
| | 09:10 | First of all, I think the most important one,
down on the bottom, is that
| | 09:13 | FileMaker allows you to use
industry grade encryption to encrypt the
| | 09:16 | communication between your
FileMaker Pro clients and FileMaker Server.
| | 09:20 | And all you have to do is simply
turn on Require secure connections.
| | 09:25 | This will turn on SSL encryption of
course, it does add a little bit of extra
| | 09:29 | data packets to encrypt all that data,
and then between your FileMaker Pro at in
| | 09:33 | Advanced Clients and your FileMaker
Server and any client that's using a session
| | 09:37 | even IWP for that matter, those will all be encrypted.
| | 09:41 | This is the only setting that requires you
to restart the service after you apply it.
| | 09:46 | Client authentication can be turned to
allow FileMaker accounts only, or if you
| | 09:51 | decide that you're going to use
external authentication, you'll have to come
| | 09:54 | onto the server and turn on FileMaker
and external server accounts.
| | 09:58 | Keep in mind that you turn this on,
on the server it's the only thing that
| | 10:01 | you have to do on the server, but you
do have to go configure those accounts
| | 10:04 | as group names in your Security
Settings and we covered that in the first
| | 10:08 | chapter in this course.
| | 10:10 | The File Display Filter gives you the
opportunity that when a user goes into
| | 10:14 | file open remote and they select the server name.
| | 10:18 | On the right-hand side window they can
either see all the different databases
| | 10:21 | that are hosted on this server or only ones
for which they have a username and password.
| | 10:27 | So if you turn on List only the databases
each users authorized to access, they
| | 10:31 | will then be prompted to enter a username
and password or an account name and
| | 10:35 | password once they select the Server,
and then after they enter that they'll
| | 10:40 | then be given a list of only databases
that have that account active, so that
| | 10:45 | way we don't see any other databases
from any other groups.
| | 10:49 | Keep in mind however that they will
have to authenticate yet again, after
| | 10:53 | selecting the file from the File List.
| | 10:55 | I'm not sure why that is, but that is something
to set expectations for your users.
| | 11:00 | On the Folders these are all the
locations of the Backup Folders and Progressive
| | 11:04 | Backup Folders. It's advised not to change
these unless you decide to keep your
| | 11:08 | data in its separate volume then your
application, otherwise you should leave
| | 11:12 | these settings as is.
| | 11:14 | Leave your FileMaker Logging settings
as it is as well. Inside your Log Viewer
| | 11:19 | is where you can see the different
modules that are being tracked.
| | 11:23 | All that is driven by the activity on the
server, but here is where you can
| | 11:28 | either change your intervals or change
the Log Size, and also say what other
| | 11:32 | types of events that you want to log.
Access and Usage statistics are optional.
| | 11:37 | Server Plug-Ins are outside the scope of
this discussion. These are third-party
| | 11:42 | applications or plug-Ins that are
created by other manufacturers. See their
| | 11:45 | documentation for use, but you should
know that before you have any server-side
| | 11:48 | plug-ins you need to enable FileMaker
Server to run them in the first place,
| | 11:53 | and then install them per the third-party
instructions and you'll see them here once enabled.
| | 12:00 | Finally turning on any web publishing
technology is rather easy.
| | 12:04 | You can go in here to General Settings
and this is where you can manage your
| | 12:08 | limit of web Publishing Sessions.
| | 12:10 | Keep in mind that Instant Web Publishing
is really only the web technology that
| | 12:14 | actually uses database sessions, so it
has a maximum of 100. You can even knock
| | 12:19 | that down from 100, if you only
expect to have a handful of users.
| | 12:23 | It's not the same thing as Custom Web
Publishing sessions. We'll talk about that
| | 12:26 | again in the Web Publishing Module.
You do not use database sessions for
| | 12:30 | Custom Web Publishing. So this 200
limit means 200 concurrent users all making
| | 12:35 | a request of your server at the same time.
That usually takes about a second
| | 12:38 | or less than a second to do that, and
that means something completely different
| | 12:42 | than the amount of sessions available for instant web.
| | 12:44 | So even though this looks like it,
does not mean that Custom Web Publishing
| | 12:48 | Applications have only twice as many
transactions available from the web as a
| | 12:52 | Instant web Publishing session.
| | 12:54 | Here is where you can turn on PHP, turn on or turn
off XML and turn on or turn off instant web publishing.
| | 13:02 | And finally, if you choose to have
FileMaker Server Advanced be the host of ODBC
| | 13:08 | connections, what this means is that
someone or some other application more
| | 13:12 | likely, wants to access data that's stored
in a FileMaker database, that database
| | 13:17 | needs to be hosted on FileMaker
Server Advanced, not FileMaker Server but
| | 13:20 | FileMaker Server Advanced.
| | 13:21 | And again it's not if your database is
reaching out, using ODBC to consume data
| | 13:26 | from another source, but only if
it's acting as a host, meaning another
| | 13:29 | application is trying to consume data from FileMaker.
| | 13:31 | So these are your General Settings
for the FileMaker Server Admin Console.
| | 13:36 | You can come back and change these at
any time, but these are the recommended
| | 13:39 | settings when you first set up your
server and of course, all these are
| | 13:43 | administered through the Server
Admin Console, so of course see FileMaker
| | 13:47 | documentation 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:00 | Many of the most common administrative
tasks in FileMaker Server concern the
| | 00:04 | management of database files.
| | 00:06 | FileMaker Server Admin Console not
only allows you to configure FileMaker
| | 00:09 | Server, but it gives you the ability to
upload and manage files on the server.
| | 00:14 | If you have FileMaker Server advanced
you can also configure Administrative
| | 00:18 | Groups to allow users to be able to
back up and verify Databases as well.
| | 00:27 | Once you've logged in to the Admin
console you'll notice that there is a
| | 00:31 | section called Databases.
| | 00:33 | This will display all the Databases that
are currently being hosted on FileMaker
| | 00:36 | Server, and in addition it also shows
you columns for each of the extended
| | 00:41 | privileges or the technologies that
it's enable to be able to be used with.
| | 00:45 | So for example this database the
FileMaker Server sample is available for use
| | 00:51 | and access through FileMaker Go,
Instant Web Publishing, XML, PHP, and even via
| | 00:56 | ODBC, Clients and that's intentional in
the sample file, because it's meant to
| | 01:01 | test all the technologies.
| | 01:02 | But if there are users that are logged
into the database when you click on a
| | 01:05 | database you'll see all of their Computer Names,
Account Names, the Type of client
| | 01:10 | that they are using in their IP
Address all listed down below.
| | 01:14 | For databases that are already being
hosted by FileMaker Server you can do
| | 01:19 | different actions like Open them, Close them,
Verify, Pause, Resume, Upload, and Remove.
| | 01:26 | So for example I have a FileMaker
database that has a status of Normal,
| | 01:31 | which means it's currently being hosted.
| | 01:33 | If I were to select Close, I would then
hit Perform Action and I would see that
| | 01:38 | status changed to Closed.
| | 01:39 | Any closed file is now
eligible to be able to be removed.
| | 01:45 | So if you actually want to remove and
replace a database file, what you would
| | 01:49 | have to do is first close it like I hit
done, then go to Remove, and perform the
| | 01:55 | action and then you would want to
upload a new database in its place or if you
| | 02:00 | have a database that's closed you can
simply go to say Open and then you'll see
| | 02:05 | the Status changed to Normal
after you hit the Perform Action.
| | 02:09 | Now if you have a database that isn't
yet on the server and you would like to
| | 02:13 | have it hosted, you can use
the FileMaker Upload Assistant.
| | 02:16 | You'll notice here in the upper corner
of your Admin Console screen there's an
| | 02:20 | icon for uploading a database.
| | 02:22 | This will prompt the Upload Database
Assistant window and the first thing
| | 02:26 | you are asked to do is choose a folder
or subfolder in which you want to add
| | 02:31 | your database file.
| | 02:33 | By default there is always going to be
a databases folder and you can create
| | 02:36 | subfolders if you'd like to.
| | 02:38 | For example I can create a subfolder
for exercise files, and then I will
| | 02:45 | select that one and I will now
select Add Database. Here's where I can
| | 02:49 | navigate throughout the database, to
the location of where the database is
| | 02:56 | that I want to host.
| | 02:57 | And I select the database and now, hit Next.
| | 03:01 | After a brief checking of the
configuration of the file, I can choose to
| | 03:05 | automatically, open the database
after upload, and then I see the Upload
| | 03:08 | Status and it indicates that it's successful
and then I see a confirmation of the database.
| | 03:13 | Once I'm done I can hit Finish or I
can go back and upload another one.
| | 03:17 | And now I see that Database
listed here with the status of Normal.
| | 03:21 | I also see that it's configured for access
via Go/Pro but not any of the other technologies.
| | 03:26 | If you wish to replace your database
that's been hosted on FileMaker Server with
| | 03:30 | one that's currently offline something
that maybe you've added some new features
| | 03:34 | to or imported some data to, here are
the steps that you would have to do.
| | 03:38 | First you select the database that's
currently on the server, and you hit Close,
| | 03:44 | and Perform Action and you see the
status change and now you have to hit Remove,
| | 03:50 | hit Remove, and confirm and
now you see that database gone.
| | 03:56 | Now if you want to upload a new
Database you can say Upload, Perform Action,
| | 04:01 | choose the folder hit Add Database.
| | 04:04 | And now select the database that you
want to replace it, you see the checkbox,
| | 04:10 | hit Next wait for your configuration,
hit Next again, and then confirm.
| | 04:16 | New in FileMaker 12 is also the
ability to be able to download databases that
| | 04:21 | are currently hosted on the server.
| | 04:23 | So for example we have got the Sample
database folder, we have got the Ex Files
| | 04:29 | database folder here, and
inside that folder is a Database.
| | 04:32 | If I want to copy of such a database,
I can go into here, select the Download
| | 04:36 | Database action and hit Perform Action.
| | 04:39 | This indicates to me that the files
must be closed before I can make a copy.
| | 04:43 | So of course I'll go back and hit
Close, perform the action, go to Download,
| | 04:50 | and now perform that action.
| | 04:51 | And now it asks me, where I want to
save this database, and I'll hit Download.
| | 04:57 | Now the nice thing about this is that
you can run the Admin Console on the
| | 05:00 | machine that's remote to the server,
which means you might have a laptop that
| | 05:04 | you log in via the network, and
connecting to FileMaker Server and you can
| | 05:08 | download a copy of the database.
| | 05:09 | Of course, you do have to take the
database offline. As an alternative to
| | 05:13 | creating a copy of the database by closing it first,
| | 05:16 | what you can do, if you have an Open
database, is you can go into the back ups
| | 05:24 | under Schedule, select Daily and hit Run
a Schedule Now and wait for the status
| | 05:31 | to change to OK, and then you can
actually go into your databases directory to
| | 05:36 | grab that new backup.
| | 05:38 | Now I am on an OS X Machine so here's
where you can find the database backups.
| | 05:43 | On Windows you would start with the
program files directory select FileMaker,
| | 05:47 | then FileMaker Server.
| | 05:49 | On Mac you go Library, and then
FileMaker Server, and then the rest is the same.
| | 05:53 | There is a directory called Data
and then a Directory called Databases.
| | 05:58 | Inside the Databases directory
you are going to be looking for the
| | 06:02 | subfolders that you created.
| | 06:04 | These are your live database files.
| | 06:06 | This is the directory that you should
never manage, you should never handle this
| | 06:10 | with backup systems, or create mirrors
of this, or use this for virus scanning,
| | 06:15 | or even manually copy files out of here.
| | 06:18 | This is the directory that should be off
limits at all times. Instead, the backups
| | 06:22 | directory is the one that you want to manage.
| | 06:25 | These files are not live they're currently
offline. You see that whenever a
| | 06:29 | backup is created, it creates a
complete copy of the database folder.
| | 06:33 | And so here's a file that I could copy,
or drag onto another device, or move it
| | 06:39 | somewhere where I can work with it offline.
| | 06:42 | So the take away here is never touch
anything in the Databases folder, always
| | 06:47 | just use the Backups folder, and you
can use backups to manually create a
| | 06:52 | database if you want to pull
something offline while its being hosted.
| | 06:55 | FileMaker Server provides an Admin
Console to allow you to manage databases that
| | 06:59 | are being hosted on that machine.
| | 07:01 | Using the Admin Console to manage
databases, provides you with a safe method for
| | 07:04 | uploading, opening, closing, and even
downloading databases from your server,
| | 07:09 | even if you're accessing the server remotely.
| | Collapse this transcript |
| Scheduling backups| 00:00 | Many Database systems are
used all day and everyday.
| | 00:03 | One of the strengths of database is their
ability to store and retrieve critical data.
| | 00:07 | This critical data however needs to be
protected and storage in databases does
| | 00:11 | not constitute much protection on its own.
| | 00:13 | So any data that's critical to an organization
must be protected through some
| | 00:17 | scheme of data backups.
| | 00:19 | So in this movie I am going to talk to
you about the powerful backup features
| | 00:22 | that are available in FileMaker Pro
Server that are there to protect the data
| | 00:25 | that's stored in a your FileMaker Pro solutions.
| | 00:27 | There are a couple of very important
rules that I want to establish before we get
| | 00:31 | into the backup mechanisms.
| | 00:33 | First of all, do not use backup software
to directly backup open FileMaker files.
| | 00:38 | I cannot stress that enough.
| | 00:41 | You need to be aware that there
are two directories that contain
| | 00:44 | FileMaker backup data.
| | 00:46 | Inside your FileMaker Server directory,
inside the data directory, there is a
| | 00:49 | Databases directory but under no
circumstances should that ever be manipulated
| | 00:54 | by human or by automated system.
| | 00:56 | Those files must be kept in their place
without being touched or manipulated at all.
| | 01:01 | And this goes for backup tools.
| | 01:03 | Backup tools have means to deal with
open files such as simply waiting 'till a
| | 01:07 | file is closed, and all these other
things, but none of them take into account
| | 01:10 | the sensitivity of FileMaker databases.
| | 01:12 | So please understand never, ever,
ever backup open FileMaker files
| | 01:17 | and in open FileMaker files any file
found within the databases directory.
| | 01:21 | However you can backup, or copy,
or move to a different location
| | 01:26 | any file that's found inside the Backups directory.
| | 01:29 | Just want to make that perfectly clear.
| | 01:31 | Now these warnings are not meant to suggest
that FileMaker Pro databases cannot be backed up.
| | 01:35 | FileMaker itself contains features that
will assure safe, clean backups, of our
| | 01:40 | active FileMaker Pro databases that
will take data from these database folders
| | 01:45 | into the Backups folder. That is exactly
what the backup scheduling does
| | 01:50 | inside the Administrative Console. That's what
we are going to be talking about in this movie.
| | 01:55 | Backed up copies will be incomplete
and likely corrupt, so remember that.
| | 01:58 | There is also significant risk to the
live hosted databases that they will also
| | 02:02 | become corrupted if you try to copy
something from the live databases folder.
| | 02:06 | The idea here is that you have got
live databases you are going to use the
| | 02:11 | FileMaker Admin Console on the
server-site to create backups.
| | 02:15 | Once you have those backups created, then
you can do something with them in any
| | 02:19 | kind of automated fashion.
| | 02:20 | So as you see here on screen, let's
say we've got a couple of different files,
| | 02:23 | Bonsai, FTSMeetings.
| | 02:26 | We use FileMaker Server to create a
scheduled backup and it creates some files
| | 02:31 | in the Backup directory. Then you can
do things like transfer those backed up
| | 02:34 | files to remote, network backups,
tape backups, remote disk any kind of
| | 02:39 | offsite storage location.
| | 02:40 | Note that this lesson that we are
talking about here does not attempt to teach
| | 02:44 | us everything we need to know
about the full backup regimen.
| | 02:47 | Once you've used FileMaker's built-in backup
mechanisms as suggested here on screen,
| | 02:50 | it's still going to be necessary for
you to use system level backup
| | 02:54 | software to create a more durable backup.
| | 02:57 | Also it's highly recommended to
create some sort of strategy that involves
| | 03:00 | remote or offsite backups, because just
having something local on your machine
| | 03:03 | doesn't protect you against damage to the machine itself.
| | 03:06 | So how do we create backups in backup's directory?
| | 03:10 | Once you log into the FileMaker Admin Console,
you'll notice that there is a section
| | 03:13 | called Schedules underneath the Administrative area.
| | 03:15 | When you first log into Schedules
you'll see that there are three Schedules
| | 03:19 | already reconfigured by default,
FileMaker does these for you.
| | 03:22 | One of them is called Daily, the next Hourly,
the next Weekly; they are pretty self explanatory.
| | 03:27 | And you'll notice that the Daily
has a check under Enabled, which means
| | 03:30 | that right out of the box, after installation,
it's already setup to create daily backups.
| | 03:35 | You'll also see that you've got some
actions available to you to create, edit,
| | 03:39 | duplicate, delete and run other schedules.
| | 03:43 | So how about we take a look at the
existing schedules by choosing Edit a
| | 03:47 | Schedule and hit Perform Action.
| | 03:51 | So when you setup a Schedule or Edit a
Schedule, you can choose all databases
| | 03:54 | that are being hosted, or you can
setup special backup schedules for
| | 03:57 | individual sets of databases.
| | 04:00 | So for example I could just go to the
Sample file databases, and even within
| | 04:05 | that I could just select a single database if I want to.
| | 04:09 | But here we'll select the sample directory
and then we tell it where, we want to store it.
| | 04:14 | All that you can do here is make sure
that it's in a subdirectory below the
| | 04:20 | data directory and you can call it Backup,
so you can create another directory
| | 04:24 | if you would like to.
| | 04:25 | Now the number of backups
is an interesting option here.
| | 04:28 | What this will do is create a folder in your Backups
directory for everyday that this schedule runs.
| | 04:33 | And you can tell it how many you want to keep.
| | 04:36 | So if you say 7 for example, that
means on the seventh day, it's going to
| | 04:41 | create a new directory and that directory is
going to replace the oldest one that you have.
| | 04:45 | So you've always got the last seven days of backups.
| | 04:49 | And you'll notice inside our Data directory,
inside Backups, that each backup
| | 04:55 | directory that's created has the word
daily, weekly, whatever it is that it's
| | 04:59 | called and then a timestamp and inside that are
a direct and save copy of the Databases directory.
| | 05:06 | So what you are actually telling FileMaker
to do in this case is create seven
| | 05:10 | of those, each gets a unique name and it only gets
overwritten after the seventh copy has been made.
| | 05:17 | You can also tell FileMaker you want
to verify backup integrity and what that
| | 05:21 | does is make sure that the backups
that are being created are not corrupt.
| | 05:25 | And if, so it will send an error message
and possibly notify you if you have
| | 05:29 | that setting setup in the database.
| | 05:31 | It's also a good idea to create a
clone of a backup, because if you do find
| | 05:35 | that you've got corrupted databases, all you can
do is recover them to extract data out of them,
| | 05:39 | and then migrate the data into the
healthiest shell or clone of a database.
| | 05:43 | So if you are creating a clone every
time you create a backup then, you're
| | 05:47 | always going to have a healthy shell on hand.
| | 05:50 | Next you'll see where you can pick the
Frequency. You can pick Daily, every so
| | 05:54 | many days, once, one time only, weekly,
whatever it is that you like. You can
| | 05:58 | pick Start Dates or even End Dates if you
want to just run them during a certain cycle.
| | 06:02 | Once per day at a certain time, or run
them X number of times or X number of
| | 06:08 | hours, starting at a certain time ending at a
certain time, whatever it is that you prefer.
| | 06:12 | And you can name the schedule and even
have notifications being sent and here it
| | 06:18 | tells you that you need to go into
General Settings to setup your SMTP
| | 06:21 | Information in order to be able to send emails.
| | 06:24 | But here we can do a comma delimited list of
individuals who are going to receive these emails.
| | 06:29 | There is your summary and then you can
hit Finish and we'll just say No on that one;
| | 06:33 | Hourly, Weekly, these are already created.
| | 06:36 | So the idea is you can create your own
customized ones. Maybe certain databases
| | 06:41 | need to be backed up more often than
others; maybe certain groups of databases
| | 06:44 | need be backed-up more than others.
| | 06:46 | The recommendation is to at least have
one daily backup perhaps a couple hourly
| | 06:50 | and then do weekly backups on top of that.
| | 06:53 | That way you're only going to have so
much data loss at any given time.
| | 06:57 | Then always make sure to have multiple
versions of the backup; 7 for daily and
| | 07:01 | for hourly it's up to you to pick; but weekly
it might be a good idea to do four those as well.
| | 07:06 | Backing up your databases is one of the
most critical responsibilities you have
| | 07:10 | as a database administrator.
| | 07:11 | So make sure all of your databases are
backed-up appropriately and that any
| | 07:14 | third-party backups are only
pointing to the backup's directory.
| | 07:18 | FileMaker Server Scheduling tool is the
perfect way to schedule these safe backups.
| | Collapse this transcript |
| Scheduling scripts to run on the server| 00:00 | We have already taken a look at FileMaker
Server's ability to schedule backups.
| | 00:05 | But we can also use that scheduling
engine to do other things, and the most
| | 00:09 | significant of those is the ability to run scripts.
| | 00:12 | So in addition to being able to run
what are called System-Level Scripts, or
| | 00:16 | scripts that are written to actually run
on the OS level, not within FileMaker.
| | 00:20 | FileMaker Server can also execute FileMaker Scripts
that were created inside hosted FileMaker Pro files.
| | 00:27 | Of course those were the scripts that
we were talking about that we see under
| | 00:31 | Manage Scripts and any script that you
create inside a database it's hosted by
| | 00:34 | FileMaker can be run or scheduled
to be run by FileMaker Server.
| | 00:39 | However there are some caveats; you need
to make sure that your script and script
| | 00:45 | steps are compatible to be run.
| | 00:48 | And the way that you can tell that is
by opening up your Edit Script Window and
| | 00:52 | you'll notice in the bottom left in a
corner that you have a dropdown that lets
| | 00:56 | you choose all the different technologies
that could run a script and it tells
| | 01:00 | you which ones are going to be compatible.
| | 01:02 | So if we hit Server you'll notice that
first of all in the script that you have
| | 01:06 | already authored, you might notice things like,
Perform with dialog (NOT COMPATIBLE)
| | 01:09 | those types of things.
| | 01:11 | But if you scroll through all the script
steps on the left-hand inside you'll
| | 01:15 | see that some of them are grayed out,
some of them are not grayed out. All the
| | 01:19 | ones are grayed out are not eligible
to be run inside a server-side schedule.
| | 01:24 | You might also look at some that say
they are compatible but might have some
| | 01:27 | portion of it not compatible.
| | 01:29 | Some of these are pretty logical there
are pop-ups that you don't even have a
| | 01:33 | user there to pop up, some other
things like inserting different things like
| | 01:37 | containers that's going to be impossible
to do, or exporting field contents and
| | 01:42 | those types of things.
| | 01:43 | But if you've written a script you can
audit whether or not it can be compatible
| | 01:47 | on the server, but everything
looks good then you can host your
| | 01:50 | database on FileMaker Server and then
setup a schedule that will run those scripts.
| | 01:54 | The way that you setup a schedule is in the
Admin Console, under the Schedules section.
| | 02:03 | So here you can create a new Schedule,
and you'll see when you create a new
| | 02:07 | Schedule that you select the
task that you want to Schedule.
| | 02:10 | So the most popular one is to create
backed-up databases or even verify
| | 02:15 | databases that are running, or even
sending messages to users so you might
| | 02:20 | want to send the message to users to
get out of the database if your about to
| | 02:24 | run a backup or something like that.
The one we are going to focus on here
| | 02:26 | is to run a script.
| | 02:28 | So let choose run a script and you'll
see that we have two different options.
| | 02:33 | One is to Run a FileMaker Script
which of course are the ones that you've
| | 02:37 | designed inside the Database under the manage
scripts or a System-Level Script as well
| | 02:40 | A System-Level Script for example
could be a script that opens up some
| | 02:45 | other application and has it export out
a CSV file of a bunch of data and put it
| | 02:50 | into a certain directory.
| | 02:51 | Than you could have a FileMaker script
that runs an import script that goes and
| | 02:56 | looks for a file of that name in that directory.
| | 02:58 | Now sometimes the timing of those two
scripts executing is going to be very
| | 03:02 | delicate so that's what this
third option is here Script Sequence.
| | 03:05 | Script Sequence allows you to pick a
System-Level Script and then a FileMaker
| | 03:10 | script and instead of timing them
properly, it's just going to wait till the
| | 03:14 | first one is done and then run the
second one, however you set that up.
| | 03:17 | We are going to focus on FileMaker Scripts here.
| | 03:20 | So I choose FileMaker Script, I hit Next,
and now I pick the database that has
| | 03:23 | the script that I want to run.
| | 03:25 | So let's say here we want to run the
script every night. That was the script
| | 03:29 | that we created in the previously in the
course where we were scraping, currency
| | 03:34 | rates, from a web source and we're
updating that date inside our database.
| | 03:38 | Let's say instead of having users do
that, or have it happening on the opening
| | 03:41 | of a database, we want to run
that in the middle of the night.
| | 03:43 | So we point to that database, and
then we have to log in, because if you
| | 03:48 | remember some of the scripts or some of
the actions inside the scripts are going
| | 03:52 | to have privileges that are required
in order to be able to do so.
| | 03:56 | So you have to put in account that's
going to have all the privileges necessary
| | 03:59 | to run every step in the script
and then you pick the script.
| | 04:03 | And that script that we were using is
called Scrape Rates and you can also
| | 04:07 | pass a parameter to it.
| | 04:08 | So you could say something like server or
if you want to know how this script was run.
| | 04:13 | In this case we don't need any script
parameters, so we'll hit Next and here we
| | 04:17 | can give it a maximum amount of time to run.
| | 04:20 | This is purely optional but you can say,
give it a 10 minute option, and then
| | 04:24 | abort the schedule if that time is
reached or the server has stopped.
| | 04:28 | That's completely optional and
not really used that often.
| | 04:31 | So now what we can do is
pick when we want this to run.
| | 04:35 | So we can say we want it to run daily
and how about if we run it just after
| | 04:40 | midnight, so we know we have the daily rates,
and we can call this Scrape Rates, hit OK.
| | 04:50 | Let's choose not to Send Email Notifications,
review everything then hit Finish.
| | 04:57 | And now we see that already enabled and
we see that hasn't run yet, because it's
| | 05:01 | not that date or time yet and at some
point we can turn this off, or go in and
| | 05:07 | make edits if we want to.
| | 05:09 | And here is a number cases where the
ability to run scripts from the server
| | 05:12 | could be useful it's really up to you
and what you're doing with your databases.
| | 05:14 | But things like periodic updating of
calculated values, not to unlike what we're
| | 05:19 | doing with the Scrape Rates, but
inventory quantity on hand, student GPAs.
| | 05:24 | Because you are going to be searching on
stored updated values and its likely to
| | 05:27 | work much faster, if your searching
on dynamically calculated field data.
| | 05:31 | So you might want to think about
running the script every day that just goes
| | 05:35 | and sets all those values rather
than having untored calculations.
| | 05:37 | That way our users can search on them
more quickly or even use them as key
| | 05:42 | field in relationships.
| | 05:43 | You might also have to do reporting,
or summarization of data for reporting
| | 05:47 | purposes, or flagging records daily,
such as doing deduping, or finding
| | 05:52 | overdue invoices, or importing
records from other sources, like I mentioned,
| | 05:57 | or doing exporting, or emailing of
records, or emailing of reports kind of
| | 06:01 | auto report generating.
| | 06:03 | So you can write all the scripts
in FileMaker and then you can have
| | 06:06 | FileMaker Server run them.
| | 06:07 | When running these scripted actions,
do not require users to access your
| | 06:11 | FileMaker databases but they can still
add very powerful functionality to your
| | 06:15 | system. Nearly any hosted database
can benefit from this in some way.
| | 06:19 | So 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 PublishingUnderstanding web publishing options| 00:00 | Web publishing helps solve the problem
of how to get your FileMaker Pro
| | 00:04 | solution or the data in your solution into the
hands of the greatest number of potential users.
| | 00:10 | The best way to make a FileMaker Pro
solution's data fully functional and
| | 00:13 | accessible is to have users connect to
it using the FileMaker Pro client and a
| | 00:18 | host that database on FileMaker Server.
| | 00:20 | However, in some cases this isn't practical.
| | 00:22 | Perhaps because there is too many users,
maybe more than 250 supported by
| | 00:27 | FileMaker Server or simply because it
just doesn't make sense to get them all of
| | 00:32 | FileMaker Pro client.
| | 00:33 | Or even because those users are physically
too remote, or even unknown to you,
| | 00:37 | which might lead to some either slower
performance, or if they're unknown
| | 00:41 | there is no way you can get them a
FileMaker client; really, there is a
| | 00:44 | plethora of reasons why users might
need to be able to have access to your
| | 00:48 | FileMaker data via the web.
| | 00:49 | A lot of the time using the FileMaker Pro
client may not be necessary because
| | 00:54 | the larger user base needs only a small piece
of the solution's overall functionality and data.
| | 00:58 | In either case, some form of
web publishing may be in order.
| | 01:02 | So why might you want to web
publish in the first place?
| | 01:06 | Perhaps, you have many users who would need
to interact with only a subset of your data.
| | 01:10 | For example, let's say you've got
a database solution where you store
| | 01:13 | information on vendors and you want
them to be responsible for updating contact
| | 01:16 | information and certifications
and different things like that.
| | 01:20 | That way you can extend only that
functionality out to the vendors thus
| | 01:24 | removing the need for you to be
able to manage that information in the
| | 01:27 | liability of its correctness.
| | 01:29 | Also when external users need occasional
access to solution data this might be
| | 01:34 | again, individuals updating profiles
or somebody just adding a one-time
| | 01:38 | application to your database, a lot of
things that are taking the burden of data
| | 01:42 | entry off of you and then, again the
liability of the accuracy of that data.
| | 01:46 | Also you may need to go to the web when
FileMaker Pro data needs to be blended
| | 01:51 | into an existing site.
| | 01:52 | Perhaps you want people to be able to
search on the inventory when they go to
| | 01:56 | your website or even you need some
shopping cart functionality or you want to be
| | 01:59 | able to do course registration, or whatever it is.
| | 02:02 | If the data is stored inside a FileMaker
solution you wanted to be integrated
| | 02:06 | seamlessly into your existing website
presence then, you need to web publish.
| | 02:10 | Quite simply when users do not have a
FileMaker client, although I do want to say
| | 02:14 | this is very important,
| | 02:16 | using the web is not a replacement
simply because users who could have a
| | 02:20 | FileMaker client don't.
| | 02:21 | We are or not talking about building a
web application to circumvent the need
| | 02:26 | for actually purchasing FileMaker licenses.
| | 02:29 | FileMaker licenses are always the best
plan if you have an internal solution and
| | 02:34 | however many users you might have,
it's always a better idea to access your
| | 02:38 | database solutions with the
client if that's possible.
| | 02:40 | Of course some of these other
scenarios it might not be possible.
| | 02:45 | Also keep in mind there are third-parties
out there like in the example of the
| | 02:48 | vendors or people filling out
applications, or signing petitions, or
| | 02:51 | registering for courses or whatever it
is, it's just going to be impossible for
| | 02:55 | them to have a FileMaker client.
| | 02:56 | The general public in the cases of
shopping carts or other types of e-commerce
| | 03:00 | perhaps they're not going to have
FileMaker and you want to be able to have as
| | 03:04 | many people interfacing
with your database as possible.
| | 03:08 | Simply put, when you're defining the
requirements of a system, you may identify
| | 03:12 | certain users or groups of users that
are not going to have access to FileMaker.
| | 03:16 | These could be those online applications
who are selling products or vendors
| | 03:19 | or parents checking on children's
grades or potential customers viewing
| | 03:23 | inventory, the list goes on; but let's face it.
| | 03:25 | The reality is there's a web culture
that's very mature and it's been
| | 03:29 | establishing in nearly every industry.
| | 03:31 | So it's your responsibility to be able
to extend your business rules out to the
| | 03:34 | web into those who expect to find your data there.
| | 03:37 | Now you have some decisions to make when
it comes to web publishing in FileMaker Pro;
| | 03:41 | really you have two options.
| | 03:44 | You've got Instant Web Publishing,
which is referred to as IWP, or Custom Web
| | 03:49 | Publishing, which is referred to as CWP.
| | 03:52 | They are two vastly different technologies
and I will give you my personal
| | 03:57 | opinion that I've never used Instant
Web Publishing in any practical scenario,
| | 04:01 | but I am a big fan of Custom Web
Publishing and use it all of the time.
| | 04:05 | The technologies that we're talking
about when we say Custom web Publishing
| | 04:08 | are really just PHP;
| | 04:09 | building an application that can be
run in a browser that can access your
| | 04:13 | FileMaker data and represent it in
a way that's been coded with PHP.
| | 04:18 | Instant Web Publishing is an interesting
technology. It's something that's been
| | 04:22 | around in FileMaker for many versions.
What it allows you to do is publish
| | 04:26 | your FileMaker database. I make that
distinction because with Custom Web
| | 04:31 | you're just dealing with data but with
Instant Web, you're dealing with data the
| | 04:35 | layouts that you create, all the layout
objects, scripts that you create, access
| | 04:39 | privileges, the whole nine yards
and that is pretty attractive.
| | 04:42 | Although Instant Web, even though it
really is just the client experience in a
| | 04:46 | browser, is not intended in any way
to be an option or an alternative for
| | 04:51 | circumventing the purchase of a client license.
| | 04:54 | Custom Web Publishing also has the
ability to do some real interesting
| | 04:58 | things from a user interface standpoint but all
of those get built into the actual custom app.
| | 05:03 | So Instant Web Publishing will present
information exactly in the same way as
| | 05:07 | it is FileMaker Pro.
| | 05:08 | As a matter of fact when you are designing
layouts, you are designing the look
| | 05:12 | and feel of the interaction that the
users are going to have via Instant Web.
| | 05:16 | In Custom Web you can take that data
and integrate it in with style sheets in
| | 05:21 | HTML and make it look and feel any way
that you want inside of the technology
| | 05:25 | that you already used to using on the web.
| | 05:28 | There are some limitations to the
browsers that can use Instant Web but there
| | 05:31 | are no limitations to the browsers
that can use Custom Web Publishing.
| | 05:35 | Instant Web Publishing has a ceiling
where you cannot exceed 100 consecutive
| | 05:40 | users on a hosted database.
| | 05:42 | Of course you do need a copy of
FileMaker Server Advance in order to be able to
| | 05:46 | even host an Instant Web Publishing solution.
| | 05:50 | Instant Web Publishing uses something
called a database session and those are
| | 05:54 | capped out at a hundred.
| | 05:56 | Custom Web Publishing has no cap.
| | 05:58 | As a matter of fact even though it's
stated that depending on your version of
| | 06:02 | FileMaker Server you either have 100
or 200 consecutive interactions we're
| | 06:06 | talking about requests at any
given second with a database.
| | 06:09 | So it doesn't mean that someone is on
your web page trolling through your data,
| | 06:12 | they are not even connected
to your database in that case.
| | 06:15 | It's only when they for example hit a
Submit button, or add a record, or perform
| | 06:19 | a search or something only for that
brief second in time can you accommodate a
| | 06:23 | 100 or even 200 consecutive users.
| | 06:25 | This expands pretty quickly out to thousands
of users on your web application if you need it.
| | 06:31 | If your system doesn't need to integrate
with other web based systems like SSL
| | 06:35 | or shopping cart systems or any
other kind of technology Instant Web
| | 06:38 | Publishing works but if you need any
of those other integrations, Custom Web
| | 06:42 | Publishing is your only option.
| | 06:44 | And I like to boil it down to, if you
really need to publish your database and
| | 06:48 | its scheme along with the layouts and
scripts and all those things that you
| | 06:51 | already developed use Instant Web.
| | 06:52 | Otherwise if you only need to share
publisher data then Custom Web Publishing
| | 06:56 | is the option for you.
| | 06:57 | Now keep in mind that in some cases
where it appears that Instant Web
| | 07:01 | Publishing is the appropriate option,
because maybe you want to share your
| | 07:05 | database to remote users who only
have access to the web, I would strongly
| | 07:09 | recommend that you explore using
FileMaker Go on compatible iOS devices like the
| | 07:15 | iPad, or the iPhone, or iPod Touch,
because they could probably access the
| | 07:19 | database via those devices and have a
richer experience than they would with
| | 07:24 | Instant Web via the browser.
| | 07:25 | And in both cases the browser is a
free client and so is FileMaker Go.
| | 07:29 | So if you've identified some users
during your planning stage that require
| | 07:33 | access to data but cannot access
FileMaker the client, then web publishing is
| | 07:37 | very appropriate option for you.
| | 07:39 | If you've already ruled out FileMaker Go,
then you're left with deciding between
| | 07:43 | Instant Web Publishing and Custom Web
Publishing, and between those you can find a
| | 07:46 | technology that fits your solution
and your business rules.
| | Collapse this transcript |
| Understanding Instant Web Publishing (IWP)| 00:00 | As the name suggests Instant Web Publishing,
which is often and will hereafter be
| | 00:05 | referred to as IWP is a FileMaker Pro
technology that makes a substantial subset
| | 00:10 | of database functionality
available through a web browser.
| | 00:12 | And it doesn't require clients, which
frankly is why it's the most popular.
| | 00:17 | In theory, publishing a FileMaker Pro
database to the web using Instant Web
| | 00:21 | Publishing can be as easy as enabling a
few extended privileges in an existing
| | 00:25 | solution, but in practice it's rare
that a FileMaker Pro solution of any
| | 00:29 | complexity will translate seamlessly
to the web so there are some things that
| | 00:33 | you need to take a consideration.
| | 00:34 | We're going to covering those in detail
throughout the rest of this chapter.
| | 00:38 | But it's generally best practice to
create a web friendly workflow within your
| | 00:42 | solution that will cater to the different
display capabilities and behaviors of
| | 00:45 | your Instant Web Publishing application.
| | 00:48 | But before you go ahead and do that
or before you even choose Instant Web
| | 00:51 | Publishing, it's important to really
understand what Instant Web Publishing
| | 00:55 | is and what it's not.
| | 00:56 | So first you've got a maximum of a
hundred simultaneously connected users.
| | 01:01 | Instant Web Publishing uses database
sessions and FileMaker Server Advanced,
| | 01:06 | which by the way is the only copy of
server that can be used to host a database
| | 01:10 | for Instant Web Publishing access.
| | 01:12 | The Server Advance does require that
there only be a hundred or less database
| | 01:18 | sessions from an Instant Web Publishing client.
| | 01:20 | Of course those clients are browsers,
which can only be Safari, Firefox,
| | 01:25 | or Internet Explorer.
| | 01:27 | Other browsers are not
necessarily supported or tested.
| | 01:30 | And the databases of course, need to be
hosted on Server Advance, which is a bit
| | 01:34 | more expensive than FileMaker Server.
| | 01:36 | And it's probably more appropriate
for a defined user base; what I mean by
| | 01:40 | that is that you know who these users are,
you know what activities they are going to perform.
| | 01:44 | Quite frankly, they're familiar with FileMaker
and what a FileMaker database looks like.
| | 01:48 | So if you've got some people who
usually work in your network or in your office
| | 01:52 | and on occasion they want to work from
home or the road maybe then you offer
| | 01:56 | them access via Instant Web Publishing.
Because really, it's about setting the
| | 02:00 | expectation that with the user of how
the experience is going to work, and how
| | 02:04 | it might be different from their
expected FileMaker client experience.
| | 02:07 | Keep in mind with Instant Web Publishing,
just like FileMaker Pro, there is no
| | 02:12 | way to separate the data from its presentation.
| | 02:14 | So the layouts are there the workflow,
layout, objects, all those things are there
| | 02:19 | in Instant Web Publishing, whereas in
other web technologies, you can have the
| | 02:22 | data and then you can use whatever
web technology like JavaScript or PHP
| | 02:27 | combinations with HTML, that type of
thing, to actually handle the presentation
| | 02:31 | for you. All that's altogether in one
thing in the browser in Instant Web.
| | 02:35 | So really the way I like to frame
this up is that Instant Web Publishing
| | 02:39 | provides you with the means to create a
web-enabled FileMaker Pro application.
| | 02:44 | It's not web Published FileMaker data,
like Custom Web Publishing is, but
| | 02:48 | instead it's the entire application or the
entire solution that's published to a browser.
| | 02:53 | IWP can be an excellent solution but
it has its limitations, we're going to
| | 02:57 | discuss those later in this chapter.
| | 02:59 | But if you're needs are not met with
Instant Web Publishing, one of the Custom
| | 03:02 | Web Publishing technologies might be
the right choice. Or perhaps, and I strongly
| | 03:06 | encourage this, if you do need to web-enable
or remote-enable your FileMaker
| | 03:10 | application, you should definitely
take a look at FileMaker Go, which is the
| | 03:14 | FileMaker client for any IOS device.
| | 03:18 | So you might want to compare and contrast
Instant Web Publishing with your same
| | 03:22 | database in FileMaker go.
| | 03:24 | Web technologies in FileMaker Server allow
you to give your solutions a very broad reach,
| | 03:29 | potentially as wide as the web itself.
| | 03:30 | However, there are some trade-offs to be
aware of, depending on which option you choose.
| | 03:34 | And IWP is really the best choice
when you want to create a web-enabled
| | 03:37 | FileMaker Pro solution.
| | Collapse this transcript |
| Preparing your files for IWP| 00:00 | Once you've decided that you want to
share your FileMaker databases using
| | 00:03 | the Instant Web Publishing technology
then, you need to make that FileMaker
| | 00:07 | Pro database available.
| | 00:09 | And making that database available
via the web begins in the file itself,
| | 00:12 | specifically by way of the
FileMaker extended privileges.
| | 00:16 | If you remember in our chapter on
Managing Security, you recall that there is a
| | 00:22 | Extended Privileges tab under your
Manage Security window. This manages all
| | 00:27 | the different technologies that are
available that can access your database.
| | 00:31 | One of those is the Instant Web Publishing
extender privilege or FMIWP and you
| | 00:36 | need to make sure that it is assigned
to at least one Privilege Set that has an
| | 00:42 | active Account in the system.
| | 00:44 | So we see here that the web privilege
set has one active account assigned to it
| | 00:50 | in the extended privilege for
IWP is assigned to the web account.
| | 00:55 | So that is all you actually need to do
to be able to share your database via
| | 01:00 | Instant Web Publishing.
| | 01:02 | Keep in mind this is the same way that
you set up your database to be able to
| | 01:06 | be accessed using PHP for example, but
in both cases, it's not just a matter of
| | 01:11 | setting up extended privileges,
but instead so there is some design
| | 01:14 | considerations and subscripting
considerations that you're going to need to do
| | 01:18 | as far as building the database itself.
We'll cover all those later in this chapter.
| | 01:23 | Now just simply enabling your extended
privileges are not enough to be able to
| | 01:27 | allow FileMaker to be able to host
databases for Instant Web Publishing.
| | 01:31 | You're going to need to set up one
of the different hosts that you have
| | 01:34 | available to you to be able to share
your databases to users with browsers.
| | 01:39 | There are a couple of different options
available to you when it comes to hosting.
| | 01:43 | The first option you have is through
the FileMaker Pro Client and the second
| | 01:47 | option is through FileMaker Server.
| | 01:49 | Now when I say FileMaker Pro Client
I mean FileMaker Pro or FileMaker Pro
| | 01:52 | Advanced. You can turn on the application
and enable it so that it can act as
| | 01:58 | the host, which means of course you need
to be connected to the Internet to have
| | 02:02 | to have a static IP and other
users need to have your IP address.
| | 02:06 | So the differences here as opposed to
hosting with the client and hosting with a
| | 02:10 | copy of FileMaker Server Advanced
because of course FileMaker server does not
| | 02:14 | allow for Instant Web Publishing hosting.
| | 02:17 | But the main differences are you can
support up to 5 concurrent users via the
| | 02:20 | FileMaker Pro Client or up to 100
concurrent users via FileMaker Server.
| | 02:25 | You have no secure connections on the
client but SSL encryption available to you if
| | 02:29 | you needed on the server, no backups or
automation whatsoever on the client but
| | 02:33 | scheduled backups if need be on the
server, no event monitoring, of course event
| | 02:38 | monitoring and logging on the server.
| | 02:39 | So let me show you how you would set
up the FileMaker Pro or FileMaker Pro
| | 02:44 | Advanced application to act as a
host for Instant Web Publishing.
| | 02:48 | If you have a FileMaker Pro application
you can open it up and under the File
| | 02:53 | menu you go to Sharing>Instant Web
Publishing and you're presented with the
| | 02:58 | Instant Web Publishing dialog and you
can hit On and keep in mind that if you
| | 03:03 | have FileMaker Pro Server already running
on the machine you are going to have
| | 03:07 | to change the ports.
| | 03:09 | I have that set up here for training
purposes but it's very unlikely that
| | 03:12 | well, first of all you should never have FileMaker
Pro installed on the same machine as server.
| | 03:16 | But if that's the case you can change to
an alternate port. FileMaker provides an
| | 03:20 | alternate port for IWP which is 591.
| | 03:23 | Once that's turned on and of course
it can't be turned on in this training
| | 03:27 | environment, you'll see a URL here
and if you chose 591 you'll see the URL
| | 03:32 | appended with that port at the end
of it; a colon (:) and then 591.
| | 03:36 | You simply distribute that URL to any
users that need access to your database.
| | 03:40 | Then go into your database and either
check it for no users or all users.
| | 03:45 | If you choose all users or any of the
specified Privilege Sets. then users will
| | 03:48 | be able to hit that IP address and then
see the Instant Web Publishing homepage
| | 03:53 | with this database shown.
| | 03:55 | Now it's not the preferred option for
Instant Web Publishing but instead, if you
| | 04:01 | have FileMaker Server you can go
into the Configuration panel, choose Web
| | 04:06 | Publishing and select Instant Web Publishing
and make sure that enable Instant
| | 04:11 | Web Publishing has been checked.
| | 04:13 | Now it's also a good idea to have a
session timeout here, which we'll talk about
| | 04:17 | when we take our tour of the
Instant Web Publishing interface.
| | 04:20 | I suggest having that on and the default
of 15 minutes is pretty good because,
| | 04:25 | otherwise you've got those hundred
sessions and if users just log out of their
| | 04:29 | window without exiting or killing the
session, something else needs to log them
| | 04:32 | out in the session timeout will do that.
| | 04:35 | You also have some control
over the number of those sessions.
| | 04:38 | So for example, if you want to lower
that even below 100 you can go into the
| | 04:42 | General Settings under the Web Publishing
engine and lower the default setting
| | 04:46 | of 100 down to whatever your preferred
number of concurrent sessions might be.
| | 04:50 | Now once you have FileMaker Server set
up to be able to host for Instant Web
| | 04:54 | Publishing, you need to have a database added
that has Instant Web Publishing enabled.
| | 05:00 | So let's replace the database that we
have here that doesn't have Instant Web
| | 05:04 | Publishing enabled with one that does.
| | 05:06 | So we'll close this, perform the action,
wait for that to be closed, and then now
| | 05:12 | we'll remove, and confirm
and now we've removed that.
| | 05:18 | Now we will use the Upload Assistant and
we'll add a database from our exercise files.
| | 05:28 | Here's one that we've set up to make
sure it had the extended privilege.
| | 05:33 | Now we simply upload it like any other
database, and confirm, and we hit finish, and
| | 05:42 | you see now that we've got a
database that has the Instant Web Publishing
| | 05:46 | extended privilege active and
now is accessible via the browser.
| | 05:50 | Now in either case, whichever option you
use to host your databases you're going
| | 05:54 | to have to distribute the IP address to your users.
| | 05:57 | So in either case you're going to want
to enter in the IP address, so in this
| | 06:00 | case we'll enter in the IP address.
| | 06:06 | Now once you enter this information
you can hit enter and your users will be
| | 06:10 | presented with what FileMaker calls
the Instant Web Publishing homepage.
| | 06:14 | FileMaker provides you with two different
ways that you can host your database
| | 06:17 | for Instant Web Publishing access and
once your database is hosted it'll now be
| | 06:21 | available for access via the web browser.
| | Collapse this transcript |
| Touring the IWP interface| 00:00 | Once you've configured your database
files to be shared via Instant Web
| | 00:03 | Publishing and set up your host to host
the file for Instant Web Publishing, you
| | 00:09 | can then enter in the IP address of
that server and up will pop the Instant Web
| | 00:14 | Publishing homepage.
| | 00:15 | What you'll see on this homepage
are two hyperlinks in this case or a
| | 00:18 | hyperlink for every database file that's
configured to be shared on Instant Web
| | 00:22 | Publishing. All your users have to do
is click on the database.
| | 00:28 | If there's a password they'll be prompted with
entering the password here and they can log in.
| | 00:35 | Now this is a very important point,
you'll notice that this indicates that
| | 00:39 | the layout is not supported for
Instant Web Publishing because it does not
| | 00:43 | contain the classic theme.
This is the very first thing I want to show you.
| | 00:47 | Back in FileMaker in Layout mode you'll notice
that each layout can potentially have a theme.
| | 00:54 | So all these different themes that are
provided in FileMaker 12 and older are
| | 00:59 | not compatible on Instant Web Publishing.
| | 01:01 | However, there is one which is
really the lack of a theme which is called
| | 01:04 | classic which is compatible on Instant Web Publishing.
| | 01:08 | What you want to do is have databases,
we created a series of databases that
| | 01:14 | only use the classic theme and those
are the ones that you're going to want to
| | 01:18 | have accessible to you from the web.
| | 01:20 | Now going back to our tour of the
interface, if we look at the FileMaker
| | 01:24 | Server sample, we see that it does
have layouts that are configured already
| | 01:28 | for the classic theme and we can take a look
at some of the functionality of FileMaker here.
| | 01:32 | First thing you'll notice is that
the status toolbar that you're used to
| | 01:35 | when you're using the FileMaker Pro client is
almost fully intact here inside the browser.
| | 01:40 | You'll notice that you can navigate
from record to record just like you
| | 01:42 | would inside the client.
| | 01:44 | You can see that you can add New
Records, Edit, Delete and even Omit or
| | 01:49 | Duplicate Records are show Omitted
Records and all that type of stuff that you
| | 01:53 | are use to under your records menu.
| | 01:55 | Of course your menus are different, so
you really going to have to rely on the
| | 01:59 | status toolbar for this functionality.
| | 02:02 | But notice some of the things that are
the same we've got the ability to view
| | 02:06 | something as a list, view it as
a table, and view it as a form.
| | 02:09 | Of course, if you set up any rules or
restrictions inside your database those
| | 02:13 | same restrictions will be translated here.
You also have the ability to navigate
| | 02:17 | between different layouts.
| | 02:19 | Of course, here you see that we've only
got two layouts that are showing because
| | 02:23 | inside your Privilege Set for the web
and for any accounts that are going to be
| | 02:27 | accessing for the web, you can go in
and restrict access to only layouts that
| | 02:32 | have the classic theme applied.
| | 02:34 | But you can still click inside records
it might be one thing that you have to
| | 02:39 | set an expectation with users about is
that editing provides a different state.
| | 02:43 | So for example, in FileMaker Pro you
just click into a field start editing and
| | 02:47 | then click out of the field and it's saved.
| | 02:50 | Little bit different thing going on
here, you click into a field you notice
| | 02:53 | that you're in sort of an editing
mode and you can tell that because your
| | 02:56 | status toolbar has options change and
now there is this Submit button or Cancel
| | 03:00 | button or even Revert.
| | 03:01 | So any change that you make,
your users than have to hit submit.
| | 03:04 | This is something that
they're likely already use to;
| | 03:07 | from using the web but it's not going
to be something that they're used to if
| | 03:11 | they're just using the FileMaker Pro client.
| | 03:13 | So you could also train them to hit the
Edit Record, which will just bring them
| | 03:17 | into that same mode and then of
course train them that they have to submit.
| | 03:21 | Things like deleting records and adding
New Records are all the same but in the
| | 03:25 | case of new record, same kind of
thing here, you have them entering some
| | 03:31 | information and even on a new
one they do have to hit Submit.
| | 03:34 | Finding records is the same thing. It
takes you into a different view but that's
| | 03:39 | something that users are used to already
because they have to be in find mode,
| | 03:43 | you can have multiple requests, you
can use you the Omit, you can Duplicate a
| | 03:48 | Request or you can use your Extend and,
Constrain, and Revert found sets all the
| | 03:52 | stuff that you're used to, it wouldn't
have been able to navigate through those
| | 03:55 | different requests here.
| | 03:57 | That Find mode is something that
users are probably already used to.
| | 04:00 | Sort is actually rather interesting.
| | 04:02 | Sort will present a dialog that looks
very much like the sort dialog at your
| | 04:06 | users are already trained to use and
you'll be able to move different fields
| | 04:11 | over and performs sorts just
like you're used to doing.
| | 04:14 | Now one thing that you should be aware
of is when you're looking at records in
| | 04:18 | a list, we can't see it here because we only got
four records, but that there are some limitations.
| | 04:23 | In list view users can only see
25 records on screen at a time.
| | 04:27 | And table view they can see
50 records on screen at a time.
| | 04:31 | So than your record navigation now has
you navigate from batches of 25 to the
| | 04:36 | next batch of 25 or in the case of tables
from one set of 50 to the next set of 50.
| | 04:41 | Now what this is,
| | 04:42 | is this kind of a web term and this is
something that is familiar in web applications.
| | 04:47 | For example, if you go to Google you
only see ten of the results on screen.
| | 04:52 | And this is called a fetch size and
FileMaker is controlling your fetch size
| | 04:55 | here because let's say you have a
FileMaker database that has millions of rows
| | 04:59 | of records in it which is fully
supported on the desktop and it doesn't do
| | 05:03 | anything the web other than that's
just a lot of data to be pushing out to a
| | 05:08 | browser any browser or any
technology for that matter.
| | 05:10 | So FileMaker limits it to just batches
of 25 or batches of 50 in table view
| | 05:15 | because it doesn't have that layout
overhead and therefore you don't choke web
| | 05:19 | browser or the application or
your servers or anything like that.
| | 05:22 | So that's there for your protection but
another thing that you're going to have
| | 05:26 | to train your users on that
let them have that expectation.
| | 05:28 | Now the most important thing about
this user experience on Instant Web
| | 05:32 | Publishing is the logout screen.
| | 05:35 | Now you could have different
buttons, we'll discuss these later.
| | 05:38 | You see that scripts are supported in
the layouts just like they are elsewhere
| | 05:43 | in the application. You've got thing
like dropdowns and tab controls and web
| | 05:47 | viewers and even viewing containers;
all that stuff is still supported.
| | 05:50 | But what you do have to
manage is the users logging out.
| | 05:55 | If they don't hit logout and they
simply close this window that database
| | 05:59 | session is still open and it's still
being reserved for them on the server.
| | 06:03 | Unless you set your server up to allow
for a timeout that's just going to keep
| | 06:07 | going until either the web server
or your FileMaker Server times out.
| | 06:11 | You need to train your users to be
able to hit the logout button, which will
| | 06:15 | take them back to the homepage and
just let them now that closing the window
| | 06:20 | will not stop the session.
| | 06:22 | Of course, you can incorporate a
script step for exit application into your
| | 06:27 | different scripts or even
assign that to a button on screen.
| | 06:30 | Looks a lot like the FileMaker-like
experience at your users are used to but you
| | 06:35 | do want to take the time to either
design a layout that fits within some of
| | 06:39 | these IDP design restrictions or even
train your users about some of these
| | 06:43 | restrictions so that they can have a
trouble-free user experience when they're
| | 06:47 | accessing your database
through Instant Web Publishing.
| | Collapse this transcript |
| Design considerations in IWP| 00:00 | Enabling and configuring a FileMaker Pro file for
Instant Web Publishing is pretty straightforward.
| | 00:05 | Your FileMaker Pro layouts as well
as a good portion of FileMaker Pro
| | 00:09 | experience should come to life in a
web browser by simply turning on Instant
| | 00:12 | web Publishing web Hosting, and then
hosting the file under either server or
| | 00:17 | one of FileMaker Pro clients.
| | 00:19 | For simple straightforward solutions
it's really pretty much that easy, but with
| | 00:23 | anything with any level of complexity,
you may need to do some additional work
| | 00:26 | before your database is ready for IWP.
| | 00:29 | So in order to be able to do this before
you decide to deploy your database via
| | 00:33 | Instant Web Publishing, there are some
tradeoffs that you need to consider when
| | 00:37 | you want to go to IWP.
| | 00:39 | So first let's look at the features
that are available in that work faithfully
| | 00:43 | within the IWP experience.
| | 00:45 | FileMaker Pro Security model works just
like it would on the client, as a matter
| | 00:50 | of fact Accounts and Privileges governs
web interactions as well as the Desktop
| | 00:54 | and as a matter of fact, one account
can be setup to allow access via the
| | 00:58 | Desktop and Instant Web Publishing if
need be. FileMaker Pro therefore offers
| | 01:02 | single security model for all
forms of different deployment.
| | 01:07 | It does a pretty good job of rendering layouts.
| | 01:09 | IWP presents these very faithfully, it
uses an HTML CSS based rendition of the
| | 01:15 | FileMaker Pro layouts that only uses
the classic theme. So as long as you don't
| | 01:19 | use any other themes besides classic, your
layouts will render faithfully on the web.
| | 01:24 | Instant Web Publishing users can view
charts that are created in FileMaker Pro,
| | 01:27 | but cannot edit an existing chart or add a
new chart to a layout like you can in client.
| | 01:32 | In addition, if the data for a chart
changes, a refresh of the browser is
| | 01:36 | required for the chart to update.
Otherwise you get those nice charts that
| | 01:40 | you design inside your FileMaker layouts
and they look just like they would
| | 01:43 | inside the FileMaker client.
| | 01:45 | As we saw on our tour, the status
toolbar enhances the look and feel of the
| | 01:49 | Instant Web Publishing for your users
by closely resembling what they already
| | 01:53 | see in FileMaker Pro.
| | 01:54 | This should ease the transition between
FileMaker Pro clients in IWP, but we
| | 01:58 | will require a little bit more training
when it comes to things like submitting
| | 02:02 | after different editing or record
creation. Record management
| | 02:07 | for the most part creating, editing and
deleting database records in Instant Web
| | 02:10 | Publishing, is just the same
as you would in FileMaker Pro.
| | 02:14 | But some actions that occur during
database editing, such as portal refreshes
| | 02:18 | and field validations, might happen a
step later in Instant Web Publishing,
| | 02:21 | because of the need to hit the Submit button.
| | 02:24 | Searching and sorting;
| | 02:26 | pretty much exactly what people are
going to be used to. So if you really just
| | 02:29 | need to provide a database for the
purpose of allowing others to search, then
| | 02:33 | Instant Web Publishing is a
pretty good option for that.
| | 02:36 | Instant Web Publishing can perform
scripted actions via buttons, we're going to
| | 02:40 | talk later in this module about some
of the constraints, when it comes to
| | 02:44 | scripting in Instant Web Publishing.
Most steps are in fact compatible, but once
| | 02:48 | you're familiar with the ones that aren't,
you can then design scripts that are
| | 02:51 | specific just to IWP deployments.
| | 02:55 | Now just as importantly, it's important
to look at some of the features that are
| | 02:59 | not available to Instant Web Publishing
users. These are certainly things that
| | 03:02 | you can take into account
before you design your database.
| | 03:04 | But if you already have a pretty robust
database created, these should be things
| | 03:08 | that you take into consideration when deciding
whether or not IWP is the right move for you.
| | 03:13 | Script triggers; not supported in IWP.
| | 03:16 | They are supported in one strange
scenario and that is, if another script step
| | 03:22 | that was not triggered by a Script
trigger causes some action that would
| | 03:25 | normally trigger a script, then in
fact, your Script Trigger will run.
| | 03:30 | So for example, let's say you have a
script that says go to field, if you do a
| | 03:35 | go to field script step and any script
step that you have for on object enter
| | 03:40 | for example, will trigger.
| | 03:42 | But that can't be very predictable,
and so really you should just expect that
| | 03:46 | the script triggers aren't going to
be available to you in your Instant Web
| | 03:50 | Publishing workflows.
| | 03:51 | List views as we discussed in our tour
will only show 25 records at once, while
| | 03:55 | table view shows only 50.
| | 03:57 | We discussed the fetch size reasons
behind those. And of course, the layout
| | 04:01 | themes, classic themes is only
supported on IWP and if your database is
| | 04:05 | converted from previous version, then
all of the Layouts are already set up to
| | 04:09 | use a classic theme.
| | 04:10 | But if you created a new database
using a non-classic theme or modified any
| | 04:13 | existing layouts to another theme,
those are not going to be supported IWP.
| | 04:19 | You don't have the ability to get into
the managed security or database to be
| | 04:24 | able to do things like update your
schema or your fields or anything like that;
| | 04:27 | it's just really just for the user experience.
| | 04:30 | Preview mode is not available in
Instant Web Publishing. There are some things
| | 04:34 | that FileMaker Pro relies on, that
are not controlled within a browser.
| | 04:38 | Things like Preview mode really don't
make sense, because when you print out of
| | 04:43 | a browser, you are really just at the
mercy of the browser, and then the driver
| | 04:47 | that you have available there, rather than any
layouts or constraints that you set up in FileMaker.
| | 04:51 | So for that same reason printing; it
is not that you can't print, it's that
| | 04:56 | you're printing what you see in the browser.
| | 04:58 | Instant Web Publishing uses a frameset,
so it's not very elegant, you can't
| | 05:02 | get very clean sort of letters that
you can print out that are worthy of you
| | 05:06 | sharing with clients or customers or
something like that or reports or anything.
| | 05:10 | Just like any other web page, you can
print what you see on the screen and you
| | 05:14 | can do your best to create print ready
layouts, but for the most part, printing
| | 05:18 | is not going to be the same
experience that you have on the client.
| | 05:21 | Things like Spell check Rich text
editing, those are not available on
| | 05:25 | the browser because the browser doesn't have
Spell check or Rich text editing available to it.
| | 05:30 | Container fields are interesting, you
can insert items like videos or images or
| | 05:34 | sound bites or even files into
a container field in FileMaker.
| | 05:38 | And it's possible to view the container
field data from within IWP, but it's not
| | 05:42 | possible to modify it.
| | 05:44 | You cannot for example, insert images into
container field via Instant Web Publishing.
| | 05:48 | Files placed in the container fields in FileMaker Pro;
| | 05:51 | that'll be viewable in downloadable
from the web, assuming your browser is
| | 05:54 | configured correctly to
download and display these files.
| | 05:57 | So this is something to take into
consideration. IWP could be a great way to
| | 06:01 | allow people access to different
documents, and allow them to download them, but
| | 06:05 | they just can't insert or replace
anything that they see in the browser.
| | 06:10 | Web Viewers work in IWP, but require
some special considerations and testing to
| | 06:14 | ensure that they function as they were designed.
| | 06:16 | For example, a web page displayed in
a web viewer may have a link with an
| | 06:20 | associated attribute that when clicked
will completely replace the IWP page.
| | 06:24 | For example, the back and forward
actions of the set web viewer are not
| | 06:28 | supported in Instant Web Publishing,
although it's possible to use the browser's
| | 06:31 | shortcut menus back and forward
buttons that are being emulated in those
| | 06:35 | features in the web viewer, anyways.
| | 06:37 | Additionally, if the URL calculated
by a web viewer does not contain a colon,
| | 06:42 | Instant Web Publishing will automatically add
the http:// scheme to beginning of it.
| | 06:47 | So these are things that you did
not have to take into account on your
| | 06:51 | Desktop, but you may have to
take into account for Instant Web.
| | 06:54 | Multiple windows; you can still initiate
a script that opens a new window inside
| | 06:58 | FileMaker's Instant Web Publishing,
but it doesn't open a new browser window.
| | 07:02 | What it does is it completely replaces
the window that you're in already, with
| | 07:06 | whatever the contents or the layout is
in the new window that you're calling,
| | 07:10 | then when you close that window, it
just brings you back to the window before.
| | 07:13 | So the layering of the new window is
still intact, but every window opens up
| | 07:18 | fully maximized, users can't resize it
and they have no control over them.
| | 07:23 | It's something that you have to take
into consideration in your workflows.
| | 07:27 | We talked about the User interaction, as
far as prompting users for confirmation
| | 07:30 | of edits and new records;
| | 07:32 | those are things that you
can probably train them for.
| | 07:34 | There are some slight graphical elements
where our things won't render correctly
| | 07:37 | in IWP, maybe require more space, and
things that are rounded look squared,
| | 07:41 | those types of things.
| | 07:43 | Layout object resizing and conditional
formatting are not supported in Instant
| | 07:47 | Web Publishing, any kind of keyboard
shortcuts, custom menus or any local
| | 07:52 | desktop interaction is not
supported in Instant Web Publishing.
| | 07:56 | The big one is Lookups, because of
the request response pattern of web
| | 08:00 | interaction, which is where you have
to click into to put something into a
| | 08:03 | field, and then hit Submit, and only
at that point is it pushing that change
| | 08:07 | back to the database.
| | 08:08 | Because of that whole concept, picking
a customer ID from a dropdown for
| | 08:13 | example and having a populated bunch
of related fields on the layouts, that's
| | 08:16 | not going to work until after you hit Submit.
| | 08:18 | So any kind of Lookups or any sort of
Updating of related values that will
| | 08:22 | populate other fields on a layout, all
require that you submit the change before
| | 08:27 | you can actually see those
reflected in Instant Web Publishing.
| | 08:31 | Instant Web Publishing does a great
job of reproducing FileMaker Pro layouts
| | 08:34 | with an HTML and CSS driven
browser environment. With that said;
| | 08:38 | there are a few things that do not
translate well from FileMaker Pro clients to
| | 08:42 | the browser, and a few things that
require different approach than you might
| | 08:46 | typically take in FileMaker Pro.
| | Collapse this transcript |
| Scripting in IWP| 00:00 | Support for FileMaker Pro Scripting
is one of the most powerful features of
| | 00:04 | Instant Web Publishing but not all
the script steps in FileMaker Pro can be
| | 00:08 | executed from web, although many can.
| | 00:10 | The way that you can see which ones are
compatible, which ones are not, is to go
| | 00:14 | into the Manage Script dialog, pick
really any one of your scripts and you'll
| | 00:19 | notice in the bottom left-hand corner,
there is a Show Compatibility dropdown.
| | 00:23 | If you choose Instant Web Publishing,
it will show you all of the script steps
| | 00:27 | in your authored script that are non-
compatible, because they will show up as
| | 00:31 | grayed out, but then also you can
review all the different script steps on the
| | 00:35 | left-hand side and see which ones are
grayed out, verses which ones are still
| | 00:39 | black and available to you.
| | 00:41 | In general, the following categories
of Script steps are not web compatible:
| | 00:45 | anything that might interact with
the local desktop environment, such as
| | 00:48 | importing or exporting, or saving
records as PDF, or Excel, or dialing the
| | 00:53 | phone, those types of things; anything
that edits container-field data such as
| | 00:57 | Insert Picture, or File, or that type
of thing, or even Export Field Contents;
| | 01:02 | Script steps that manage multiple
windows or adjust the size or position of
| | 01:05 | Windows; or steps that manipulate the
FileMaker Pro files, like Save copy As, or
| | 01:10 | even Open file or Close file; Spellchecking;
| | 01:15 | Script steps that open any element of
the user interface, like Open Manage
| | 01:19 | Database, or open up Help; even
anything that involves Preview, because
| | 01:23 | that's not supported;
| | 01:24 | Or anything that involves presenting
users with a dialog box, or something that
| | 01:29 | they need interact with outside of a
window, of course, the Windows will show up
| | 01:33 | maximized, but any kind of dialog box
with user interaction is not going to be
| | 01:37 | available in Instant Web Publishing.
| | 01:39 | The web Compatible Script Steps make
the essential core of the FileMaker script
| | 01:43 | functionality available to IWP based solutions.
| | 01:46 | But constraints involving the lack
of interaction with the desktop in the
| | 01:49 | absence of a preview mode, are the principal
areas where the workarounds may be
| | 01:53 | needed. Also keep in mind that you
don't have that multi window management.
| | 01:57 | And it could seem like it's a significant
deficiency, but many, if not most,
| | 02:01 | multi window workflows can be configured
to work in Instant Web Publishing's
| | 02:04 | single window presentation style.
| | 02:07 | So there are a couple of different
things that you can do to sort of trap or
| | 02:11 | workaround those limitations within your scripts.
| | 02:13 | For example, we saw before a how when
we went into our Instant Web Publishing
| | 02:18 | Homepage and tried to open up our
database, that we had a non-supported theme
| | 02:24 | that wasn't the classic theme that
was being presented, and therefore we
| | 02:28 | couldn't log into that system.
| | 02:30 | Now curiously the script that's being run was the culprit.
| | 02:35 | So if you go under Manage Databases
you'll see that there's a script called
| | 02:39 | On First Window Open and that runs the
first-time users are logging into a database.
| | 02:45 | So right now we're not taking into
account any of the IWP users and we're
| | 02:49 | taking users to a default layout and apparently
that layout doesn't have the classic theme.
| | 02:55 | We do have a couple of different
layouts that we've created, albeit it is not
| | 03:00 | uber attractive, we are working within
the bounds of the classic theme. Those
| | 03:05 | are the customer details IWP
and the Customers IWP layouts.
| | 03:10 | What we've done is also set up a
Privilege Set for web users that restricts
| | 03:18 | them to only seeing those layouts.
| | 03:25 | But the problem is if we have a script
that's taking them to those layouts, we
| | 03:29 | are going to get that error when the users try to login.
| | 03:32 | So what we can do is modify the script.
I am going to show you a technique
| | 03:38 | here for how you identify that the
user that logged into your database is
| | 03:42 | logging in from Instant Web Publishing.
| | 03:43 | And you get a bit of a clue here,
because we can see it already. We've got a
| | 03:47 | couple of If statements that you see
that are using, If, PatternCount and then
| | 03:52 | GetApplicationVersion.
| | 03:54 | GetApplicationVersion is a function
that will extract the user's client with
| | 04:00 | some version information.
| | 04:02 | But what's interesting is regardless
of the version or the exact syntax it's
| | 04:05 | being presented by the GetApplicationVersion
there are some keywords that are
| | 04:09 | available and we can do a PatternCount on those.
| | 04:12 | So here we are doing PatternCount
for iPad and for Pro.
| | 04:17 | So what we are going to do is we are
going to copy these and present another set.
| | 04:26 | This time we are going to go
and use the keyword of web, which will
| | 04:30 | capture any instant web visitors.
| | 04:34 | And we'll going to Layout mode Customer
Details, and instead we will take them
| | 04:39 | to the Customer Details IWP that we setup.
| | 04:42 | And additionally, because there are
some different script steps that don't
| | 04:46 | affect Instant Web Publishing users,
but do have some unsupported script
| | 04:49 | steps, what we are going to do is we
are going to exit the Script only if we
| | 04:54 | detected that its web.
| | 04:55 | So we will take them to the Layout,
but then we will exit the script.
| | 04:59 | So let's hit Save and see how their
user experience differs, here's our
| | 05:03 | database on the Network, and now here's
our database, if we log in via Instant Web.
| | 05:11 | And we see now with that error has gone
away and it has detected that this is an
| | 05:16 | Instant Web Publishing user, and in fact,
taken the user directly to the layout
| | 05:20 | that we designed for IWP.
| | 05:22 | And now because of the Privilege Set
that we also created for this web user,
| | 05:26 | they are restricted to only
the two compatible layouts.
| | 05:31 | Now in addition to trapping users
in doing different things or avoiding
| | 05:35 | different things, if they happen to be
logging in via Instant Web Publishing,
| | 05:40 | we can also manage what happens when the
user encounters a non-compatible script step.
| | 05:45 | If an Instant Web Publishing user
triggers a script that contains a
| | 05:48 | non-compatible script step, there
are a couple of possible outcomes.
| | 05:52 | In most cases the script will
simply stop once it reaches the
| | 05:55 | non-compatible script step.
| | 05:57 | On the other hand, if we were to go
into a script like the one we're just
| | 06:03 | working with, instead of exiting the
script completely to avoid that, what we
| | 06:08 | can do is add something called the Allow
User Abort Script. Add that to the very
| | 06:13 | top of the script and if we turn it off,
then any script steps that follow, will
| | 06:20 | be skipped and the execution will continue.
| | 06:22 | So for example, we can run the script
and even though we'll get to the set zoom
| | 06:26 | level, instead of the script dying
right there, it will just skip over it and
| | 06:30 | continue on with the rest
of the compatible scripts
| | 06:32 | So in general, you want to avoid
situations in which IWP users could trigger
| | 06:36 | scripts that contain non-compatible script steps.
| | 06:39 | Such Script steps could either stop your
script dead, or force the script to run
| | 06:43 | with critical steps skipped.
| | 06:45 | But here's a way that you can mitigate
that and skip it if you'd like to, but
| | 06:49 | the more common approach is to detect
what kind of user you have and then
| | 06:54 | direct them to things or layouts possibly
or features that are supported within
| | 06:59 | Instant Web Publishing.
| | 07:00 | There are also some special Script
steps that you should be aware of.
| | 07:05 | There are Script steps that do one
thing inside FileMaker Pro, but perform
| | 07:09 | in another way in the Instant Web
Publishing. When you're creating these
| | 07:12 | webs compatible Script steps, these are Script
steps that you are going to want be aware of.
| | 07:17 | These Script steps are the Open Record/
Request; executing the Script step is the
| | 07:21 | equivalent to having the IWP user press
the Edit Current Record button near the
| | 07:25 | top of the Status toolbar or when they click into a field.
| | 07:29 | So if you want to emulate that experience,
if you are hiding the Status toolbar
| | 07:32 | on the web for example, and want to have
a scripted button to take the user into
| | 07:36 | that mode, Open Record/Request is the
one that you're going to want to use.
| | 07:39 | And at the same time Commit Records/
Request is the equivalent to the user having
| | 07:44 | to press the Submit button.
| | 07:46 | So there's that Submit button that
you see on screen, you can either script
| | 07:50 | it, so it does it for them, or have a
button on screen that has the Commit
| | 07:54 | Records/Requests attached to it and it'll
perform the same thing as a Submit button.
| | 07:58 | Revert Record/Request is like the
Cancel button in the IWP Status toolbar.
| | 08:03 | Exit Application is a very important one.
This will act like the Log Out button,
| | 08:08 | and if your users can't see the Log
Out button, or if you want to have some
| | 08:12 | extra reminders in there that they
should hit the logout button, then attach the
| | 08:16 | Script step of Exit Application to
any clickable button that has a script
| | 08:20 | attached to it on screen.
| | 08:22 | Support for FileMaker Pro scripting is
one of the most interesting features of
| | 08:26 | Instant Web Publishing, but knowing
how to trap or avoid these incompatible
| | 08:30 | Script steps, can help you create an
environment in Instant Web Publishing that
| | 08:33 | is smooth and fluid for your
Instant Web Publishing users.
| | Collapse this transcript |
| Setting up your file for PHP| 00:00 | Custom Web publishing or as I refer to it,
CWP, comprises of a family
| | 00:05 | of technologies that are more flexible and
more powerful than Instant Web Publishing.
| | 00:10 | With CWP, you have complete control
over how FileMaker data is presented.
| | 00:14 | CWP also lets you wrap your FileMaker Pro
data in the look and feel of an
| | 00:18 | existing website because you're using
technologies that'll present it to a
| | 00:22 | browser in different forms of HTML.
| | 00:25 | However, this power comes at a certain price.
| | 00:27 | CWP does not leverage any layout designs
or screen elements that you may have
| | 00:32 | created in FileMaker Pro.
| | 00:33 | So although I can present customer
data on the web, I can't show things like
| | 00:38 | this layout or different buttons that
I have designed or some of the dropdown
| | 00:42 | menus, but all the data and even some
of the ways that data are presented like
| | 00:46 | in portals and dropdowns,
those are compatible in PHP.
| | 00:49 | They just have to be written
or recoded in a PHP application.
| | 00:53 | And it is up to you to design your
application's web look and feel and
| | 00:57 | eventually in something that'll look like HTML
using whatever tools are best suited for the task.
| | 01:02 | Now you must also create scripts in one
of CWP supported programming languages,
| | 01:07 | which most commonly is PHP.
| | 01:10 | CWP solutions however require that you
have FileMaker Server or FileMaker Server
| | 01:15 | Advanced even for development purposes,
because you're going to want to test your
| | 01:19 | PHP application and be able to
provide that application with data.
| | 01:23 | Now I should note that members of the
FileMaker technical network who have a
| | 01:27 | FileMaker developer subscription do
have access to a free FileMaker Server
| | 01:30 | Advanced development license that can
be used to build and test multi-user
| | 01:34 | solutions without the need for a full
version. Or you can do like we've done in
| | 01:38 | this training and go and download the
free 30 day trial version, which has full
| | 01:44 | capabilities of FileMaker Server Advanced,
which also allows you to be able to
| | 01:49 | test your PHP applications.
| | 01:51 | Now the PHP programming language is a
very versatile tool or language that can
| | 01:56 | be used to publish FileMaker data on the web.
| | 01:59 | PHP is a text-based programming language.
| | 02:01 | It's a very popular scripting language
that is widely used in the open-source
| | 02:05 | community and it excels at connecting
many kinds of databases to the web.
| | 02:09 | Now FileMaker Pro has its own connection
library that employs PHP to connect
| | 02:14 | FileMaker Pro databases and it's
called the FileMaker API for PHP.
| | 02:19 | So before you can start creating a
PHP application, you need to set up your
| | 02:23 | database so that it's accessible to PHP.
| | 02:26 | If you want to allow your database to
be accessed by PHP while it's hosted on
| | 02:29 | FileMaker Server, you're going to need
to set up some special layouts and then
| | 02:34 | allow access to those layouts
via the PHP extended privilege.
| | 02:36 | Custom Web Publishing relies on
layouts that are already defined within a
| | 02:40 | FileMaker file. That's one of the
interesting things; you have to set up all
| | 02:44 | the fields that you want to work with
on PHP into one layout and then you point
| | 02:47 | all of your PHP coding activity to that one layout.
| | 02:51 | So rather than inside your code talk
about which fields you want, you can set up
| | 02:56 | which is something similar to what a view might be.
| | 02:59 | Instead of showing all of the different
fields available, you can just set up
| | 03:03 | separate little views that compartmentalize
just the fields that you want.
| | 03:06 | So let's do one of those for
example inside of our file here.
| | 03:09 | Let's go into Layout mode and we're
going to go, New Layout. Let's say we
| | 03:15 | want to be able to interact with the
customer table via PHP. In this module I'm
| | 03:20 | going to supply you with a already
completed PHP application that does that very
| | 03:24 | thing; allows you to add, edit or
delete records in the customer table.
| | 03:28 | So before we can do that we need to create a
layout for us to be able to communicate with.
| | 03:32 | So I'm going to pick the Customers
table and I'm going to use a naming
| | 03:36 | convention that allows me to see when I
see this layout in the list that this is
| | 03:42 | in fact one of my PHP layouts.
| | 03:44 | I could prefix it with PHP, but in this case
I use the suffix of PHP and I am
| | 03:49 | going to pick the standard form although
it really doesn't matter because PHP
| | 03:52 | doesn't adopt anything like form or
list view or table view from the layout
| | 03:55 | that we're setting up.
| | 03:57 | NowI'm going to carefully pick the fields that
I want to have available to my PHP application.
| | 04:04 | This of course will require some
planning ahead of time, and this is something
| | 04:08 | that you're going to want to do before
you create the layout, so that you know
| | 04:12 | exactly what you're going to need and what
you're not going to need in your PHP application.
| | 04:18 | Once I've chosen all the different
fields that I want to have included, I
| | 04:22 | can then move onto the next step, which is
usually selecting the theme, but it doesn't matter;
| | 04:27 | themes don't matter for PHP applications.
| | 04:29 | Again, we're not adopting anything
other than the data that's inside the fields.
| | 04:33 | We're just compartmentalizing which
fields we want to have access to.
| | 04:35 | Anything, on the layout doesn't matter to PHP.
| | 04:38 | So we'll just go ahead and
pick Classic and be done with it.
| | 04:41 | So you'll notice in Browse mode, it's a
very plain layout, doesn't have all the
| | 04:47 | fields that are available to us
in the database, but that's fine.
| | 04:51 | We actually don't want to have any
layout objects or anything else like
| | 04:55 | images or anything like that on this
layout because it will have to be processed
| | 04:59 | to some degree when it's
being called upon from PHP.
| | 05:02 | So we want to go with the
very minimalist approach here.
| | 05:04 | So now in addition to creating these
PHP layouts, and by the way we created one
| | 05:09 | just for customers here.
| | 05:10 | But if we wanted to interact with the
Invoices table or the Products table, we'd
| | 05:14 | want to go and create isolated PHP
layouts for those tables as well.
| | 05:20 | So the example that we're going to do here,
we are just going to create it for customers.
| | 05:24 | So in addition to that, I need to have
a Privilege Set under my Manage>Security
| | 05:29 | that allows for PHP access. So it's a
common practice to be able to set up a
| | 05:35 | custom PHP Privilege Set and then I
can go in and allow my application to
| | 05:42 | create, edit and delete in all tables.
| | 05:44 | But I would go in Custom Privileges and
leave everything else off except for the
| | 05:49 | PHP Layout that I just created.
| | 05:52 | So we'll say records are modifiable,
the layout is view-only.
| | 05:55 | We can't modify a layout via the
web browser so that's irrelevant.
| | 05:58 | Then of course we want to make sure
that this is accessible to the PHP
| | 06:04 | application so we have to turn
on the extended privilege for PHP.
| | 06:09 | Now once we save this, we can hit OK;
| | 06:12 | verify that we have access to the database.
| | 06:14 | And now we can upload this database
to FileMaker Server or FileMaker Server
| | 06:18 | Advanced and make sure that FileMaker
Server Advanced is set up to be able to
| | 06:22 | host for a PHP application.
| | Collapse this transcript |
| Setting up to host files via PHP| 00:00 | Getting ready to host files via PHP, or for XML
for that matter, is a very straightforward process.
| | 00:06 | An important distinction between
Custom Web Publishing and Instant Web
| | 00:09 | Publishing though, is that Custom Web
Publishing requires FileMaker Server.
| | 00:13 | It's not possible to use FileMaker Pro
or Pro Advanced as a client to host the
| | 00:17 | files for either PHP or XML access,
as you can of course with Instant Web.
| | 00:24 | To configure the FileMaker server for
Custom Web Publishing access using the
| | 00:28 | admin console is rather simple.
| | 00:30 | So you will log into the admin console,
you'll click over to the Web Publishing
| | 00:34 | option under Configuration and you'll
choose PHP. All you have to do is make
| | 00:40 | sure that the box is labeled Enable
PHP make sure that that's checked.
| | 00:45 | Having XML on is not required but if
you wanted to setup your server for XML
| | 00:51 | hosting and the same thing applies here.
Just click in and Enable the XML publishing.
| | 00:55 | Then you'll need to upload a database that's
been configured to be accessible via PHP.
| | 01:01 | You'll select the Upload Assistant,
choose the location and we're going to
| | 01:07 | pick the exercise file in our next movie so
that we can connect it to a PHP application.
| | 01:16 | Upload this file, go through the normal
steps that you are used to and what you
| | 01:22 | want to confirm at the end of this
process is that you see the PHP extended
| | 01:27 | privilege turned on, on that database or series
of databases that you hope to connect with via PHP.
| | 01:33 | One important thing to note of course
is that the server running the PHP
| | 01:38 | engine must also have the web server
running. You are going to want to see
| | 01:43 | documentation for both PHP engine, the
PHP engine as well as your web Server,
| | 01:47 | whether it be Apache on Mac or IAS on
Windows for details on how to turn those on.
| | 01:53 | Now if you views the demo FileMaker
Server Advance from TechNet or if you own a
| | 01:57 | server installation on a single machine,
all those components are already going
| | 02:01 | to be on one machine, so you're going
to want to make sure that you've got
| | 02:05 | FileMaker server running. If you go
into the Overview, you want to make sure
| | 02:08 | that you have a nice green checkbox
next to the Web Publishing Engine and you
| | 02:12 | want to make sure that you have a nice
green checkbox next to the Web Server and
| | 02:16 | then also that you show PHP enabled.
| | 02:18 | Once those are all setup, you're ready
to create your PHP web application or
| | 02:22 | even host the web application and
have it interact with your database.
| | 02:26 | So any FileMaker database can be set
up for access via PHP by simply creating
| | 02:30 | layouts that isolate the fields that
you wish to use and then enabling the PHP
| | 02:34 | extended privilege for that layout.
| | 02:37 | Once enabled you can upload your PHP
ready database to FileMaker Server or
| | 02:43 | FileMaker 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:00 | Custom Web Publishing technologies are
programming technologies in the traditional sense.
| | 00:05 | A programmer writes program code in
one or more text files and then a web
| | 00:09 | Application Engine interprets those files.
| | 00:11 | As with certain programming languages,
syntax errors can stop your program cold
| | 00:15 | and there can be significant learning
required to become proficient with PHP.
| | 00:20 | Custom Web Publishing offers great
power, but it does not offer the same easy
| | 00:24 | use as the mouse driven development
tool set of native FileMaker Pro.
| | 00:27 | But as we've established earlier in
this discussion, when you need Custom Web
| | 00:31 | Publishing, you need something that
doesn't have access to the client.
| | 00:34 | So all the same for certain classes
of problems, Custom Web Publishing is
| | 00:38 | certainly the best choice for
Web Publishing your FileMaker data.
| | 00:43 | Although authoring PHP pages is
outside the scope of this title, I have gone
| | 00:48 | ahead and created a simple set of
PHP pages that communicate with the
| | 00:52 | Invoices_11_09 database.
| | 00:54 | And I have included the database and
the entire set of PHP Application Files in
| | 01:00 | the exercise files for you to work with.
| | 01:02 | However, they are there for you to pick
apart and try to get some exposure to PHP.
| | 01:07 | Please do not contact the author
or lynda.com support if you're
| | 01:10 | experiencing issues or want to make
modifications. See the FileMaker Server or
| | 01:15 | Web Server support documentation only,
but I have provided this application to
| | 01:20 | you for learning purposes.
| | 01:22 | But what I do insist that you do, do is to
consult the lynda.com online training library.
| | 01:29 | If you go into the online training library
and search for PHP, you'll find a
| | 01:33 | plethora of courses that will help
you to get familiar with PHP, from having
| | 01:38 | no experience whatsoever, or even into more
advanced programming knowledge regarding PHP.
| | 01:44 | So again, we provided you with an entire
PHP Web Application and its supported
| | 01:49 | database inside the exercise files for this course.
| | 01:52 | But we'll ask you to refer to other resources
for support or learning more about PHP.
| | 01:57 | Because quite frankly we can talk
for weeks to you about PHP and all the
| | 02:01 | different great things it can do.
| | 02:03 | So first thing that you are going to
have to know is that all the PHP files are
| | 02:07 | going to need to be placed in a
certain directory inside your web server.
| | 02:11 | So you'll notice that we have entire
folder with PHP files in it. This is the
| | 02:17 | entire family of files, including error
pages and CSS, and every thing that you
| | 02:21 | are going to need to run this in a web browser.
| | 02:24 | And it has to be placed in a specific
location and it's a very easy place to find.
| | 02:28 | I'm on a Mac, so I'm running Apache, so
the way that you get to the Apache web
| | 02:33 | root folder is to click on Library, then WebServer
and then it's the Documents folder,
| | 02:38 | that's where the web root folder is on Mac.
| | 02:41 | On Windows the path is the www.root
folder, and any folder that you place inside
| | 02:47 | there will then be inside the web root.
| | 02:50 | So all we have to do is take these files,
drop them into the documents
| | 02:54 | directory, and we we'll authenticate,
and now anything that's in the web root,
| | 03:01 | like any other root, can be accessible
by just putting in the IP address of this
| | 03:05 | machine, and then forward
slash (/) with the directory name.
| | 03:08 | So the directory name is php, and
I've got a page in here called home.
| | 03:13 | So let's open up Safari and type in
the IP address of the web server, or if
| | 03:20 | all the different components are
running on the same machine, it's the IP
| | 03:23 | address of that machine.
| | 03:24 | So IP address/PHP/home.php.
| | 03:35 | So all you have to do is do the IP
address/the directory where all your PHP
| | 03:41 | files live, and then forward
slash any one of those PHP files.
| | 03:45 | So in this case I have created a very
generic homepage with all the different
| | 03:49 | navigation you need, and when you hit Enter,
you will be able to see your PHP application appear.
| | 03:55 | So nothing fancy, what I've done is
created a style sheet that is nearly devoid
| | 04:00 | of any style, but it's called White.CSS
and I'll show that in the second.
| | 04:05 | But the homepage contains references
to navigation, and some brief text that
| | 04:09 | I put on here, but I wanted to show you some
of the basic ideas behind what you can do with PHP.
| | 04:16 | So here's an example of finding
all the records in the database.
| | 04:19 | So you'll notice that I've found 1535
Records, if I go back to the database and
| | 04:26 | navigate over to Customers details, we
see that we in fact do have 1535 records.
| | 04:34 | I can delete one of those records if
I'd like to, just to show you that we have
| | 04:39 | got no tricks up our sleeve
and we are going to go back.
| | 04:44 | And you'll see now by simply refreshing,
we have got 1534, now that refresh
| | 04:48 | action is very important.
| | 04:50 | Because right now, I'm looking at data
from a FileMaker database, but I am in
| | 04:55 | the browser, but I am not connected to the database.
| | 04:58 | I do not have a database session.
| | 05:00 | I'm not using a thread on the database.
Unlike Instant Web Publishing where,
| | 05:03 | in between when you are connected and you
log off, you are using up one of those threads.
| | 05:08 | With PHP the only time I actually interact with
the database, is when I press one of these buttons.
| | 05:14 | So for example, if I simply click on
the button to show me the detail page
| | 05:17 | for one of my Customers, I've communicated just
for that split second with the FileMaker database.
| | 05:24 | So when we talk about having a
limitation of either 100 concurrent users
| | 05:29 | supported by FileMaker Server for
Custom Web Publishing, or in FileMaker Server
| | 05:33 | Advanced we have upto 200 concurrent users.
| | 05:36 | It's extremely important to take into
account what we are talking about, when we
| | 05:40 | talk about users and their session.
| | 05:42 | So right now I just hit the Edit button
and in less time than it took to
| | 05:47 | refresh this page, I was communicating with the
database server, and therefore I had a session.
| | 05:52 | If several other web users and I, all
hit that button at the same time, 200 of
| | 05:57 | us will be able to get a request back in that split second.
| | 06:00 | And any one beyond that will just be queued up
and then a second later will get their request.
| | 06:05 | So we're not going to get errors,
people aren't going to be kicked out.
| | 06:08 | It's really, really important that you
don't frame up the limitations for PHP in
| | 06:13 | the same way that they are for IWP.
Throw out all that understanding. There are
| | 06:17 | no database sessions. As long as you
have an application that it only receives
| | 06:22 | requests of up to 100 concurrent at a
time or 200 at a time, you're well within
| | 06:26 | the bounds of FileMaker.
| | 06:27 | So what this actually translates into, depending
on what you have going on with your application,
| | 06:32 | like right now I have been sitting here
talking to you, and I haven't actually
| | 06:34 | interacted with the database more than a few times.
| | 06:37 | So while I've done that there could
be hundreds, possibly even thousands of
| | 06:40 | other users out there doing the same thing.
| | 06:43 | So you can simply do the math
determining what kind of actions you're
| | 06:46 | expecting. If people are just adding
records to the database, well then, think
| | 06:49 | about how many records you expect
to be added in the 24 hour period.
| | 06:53 | Do some math depending on how many
hours that would be, and then within those
| | 06:57 | hours get it all the way down to a second,
and that can tell you how many records
| | 07:01 | being added you can support within a
24-hour period or even an hour period.
| | 07:05 | So that's the math that I used
to determine the transaction.
| | 07:08 | Now don't get me wrong you can
create new amazon.com or google.com
| | 07:11 | with FileMaker as a back end,
it just doesn't make sense.
| | 07:14 | You are not going to have the multiple thousand
transaction abilities that you have in those cases.
| | 07:19 | But for several hundred or thousands of
users over a 24-hour period, it's very
| | 07:25 | likely that you can pull this off.
| | 07:26 | I've created applications over the last 10 or
15 years that have supported that kind of a load.
| | 07:31 | And FileMaker Server 12 has just
recently been reengineered and the web
| | 07:35 | Publishing Engine completely tore down from scratch,
which of course serves Custom Web Publishing.
| | 07:41 | In order to be able to accommodate
even more users or twice as many
| | 07:44 | transactions as it's been able to do in the past.
| | 07:46 | So trust me when I tell you these are
not the limitations that Instant web
| | 07:50 | Publishing has, as a matter of fact,
they are not even in the same conversation.
| | 07:54 | So let's get back to showing you some demonstrations.
| | 07:56 | I want to add a record, a Customer record,
| | 08:05 | I am just going to put a couple of pieces of
data in here. And now I'm going to hit Save.
| | 08:09 | Again, just communicated, done communicating;
even in less time than it takes me to actually say it.
| | 08:14 | But now if I go back to the database I
want to show, you the Company's name is
| | 08:20 | Sample, and now I see Sample, and I see
that that record has now been added and
| | 08:26 | I am back up to 1535 records in my database.
| | 08:29 | And also, I can go in here in Edit and call it
Super Sample, go back, save my change,
| | 08:38 | and we can go back into the database and
without even refreshing we see that's updated.
| | 08:43 | So the idea here is you can have live
interaction with your FileMaker database,
| | 08:47 | and enforce any rules that you
might have inside your PHP application.
| | 08:50 | This is about as low end of a PHP
application as you can get, but it can do
| | 08:55 | things like Find, and I do a search, I
see I have three records, I can click on
| | 09:02 | one of them, and again like I said, I can
do my editing, or I can look at all my
| | 09:07 | records at once, find all them. Then
I added something interesting here, it's
| | 09:11 | called the Customer Summary Report.
| | 09:13 | I want to show you that there is
no layout in the FileMaker database.
| | 09:19 | There's Invoices summaries,
printing, Customer PHP, that's it.
| | 09:24 | No Customer Summary, there is not even
Customer Summary fields created inside the Schema.
| | 09:30 | As a matter of fact, we have no summary
fields created in the Customer Table.
| | 09:34 | But what I was able to do in PHP is
create essentially a SubSummary Report
| | 09:40 | that groups all 1500 contacts, and you saw it
had a brief delay, but it didn't take long to do that.
| | 09:46 | Groups them all by state then
gives me a count of each state.
| | 09:49 | I did all this programming inside of PHP.
So that I don't have to bother the
| | 09:54 | database with this processing, instead
I can have this happen on the browser
| | 09:57 | side, and let the client manage this.
| | 09:59 | So just an example of what can be done with PHP.
| | 10:03 | So what's going on in the backend of
these files, here I am showing you the
| | 10:09 | same files that we've been working with
inside of a Text Editor just to give you
| | 10:12 | a glimpse of what PHP code looks like.
| | 10:16 | There are a couple different types of files.
| | 10:18 | First I have got a CSS file, if you're
familiar with any kind of cascading
| | 10:22 | stylesheets, you can see I've set it
up in the same way. I've got header
| | 10:27 | declarations in here, container stuff, page navs.
| | 10:30 | I have got every possible CSS that
FileMaker could use within its API, but
| | 10:35 | really I didn't actually populate them with
anything more than just black and white color.
| | 10:40 | But if you're familiar with CSS, this format
should look very familiar to you as well.
| | 10:45 | I've got things like Add Record Pages.
And you'll see I am doing things like
| | 10:50 | calling other pages like FM View and Error PHP.
| | 10:54 | The FM View is a page that's very critical
for you to be able to control, or any
| | 10:59 | FileMaker application that you create
in PHP requires an FM View file.
| | 11:03 | This is where all sorts of things live, like,
the Usernames and Passwords for logging in,
| | 11:08 | how your session management happens
and all these different functions that
| | 11:12 | are happening are all written inside
this FM View, and then you'll notice that
| | 11:18 | other pages throughout the application,
all call the FM View.
| | 11:22 | So instead of having to write all of
that code in each one of these individual
| | 11:26 | files, I just call it. I will write it
inside FM view and I refer to it here.
| | 11:30 | The same is true for the error pages.
| | 11:34 | You see that I write an error page
and then I'm calling it from various
| | 11:38 | different records in the database.
| | 11:40 | The report is the one that does that
SubSummary Report without going into it.
| | 11:46 | You'll see some things that are kind
of familiar though. See things like
| | 11:49 | variables declared and if statements,
in the same kind of formats as you might
| | 11:54 | be used to, a lot of use of variables.
And then you see common HTML.
| | 11:59 | This is so that we can render all
the data that's being produced by all
| | 12:04 | these functions into something that can
actually be interacted with inside of a web browser.
| | 12:10 | So I implore to you take a look at
all these different files and try to get
| | 12:13 | familiar with PHP, and again, consult
the lynda.com online training library for
| | 12:18 | more information on what all of
this means when you're inside the code.
| | 12:21 | Now at the very least you can take the
files that I provided to you and point
| | 12:26 | them to your database instead, and
maybe work a little bit with the CSS and
| | 12:29 | possibly end up with an application
after some slight modifications that will
| | 12:33 | allow you to use it with your own
database. Not the least of which is changing
| | 12:37 | the database name inside these files to
your database name, and the layout name
| | 12:42 | to your layout name and then the
rest is customizing the application.
| | 12:46 | PHP and FileMaker combine to offer
great power, but it does not offer mouse
| | 12:50 | driven development tool set of native
FileMaker Pro, but it doesn't have to.
| | 12:54 | So you should set that expectation before
you jump into PHP, you can completely
| | 12:58 | customize the user's experience and do
all sorts of things that you don't even
| | 13:02 | have to do inside of FileMaker, just by
using the FileMaker PHP API, along with
| | 13:07 | the database and FileMaker PHP applications.
| | 13:10 | All the same, for many classes of users
and requirements, PHP is certainly the
| | 13:14 | best choice for web publishing.
| | Collapse this transcript |
|
|
ConclusionGoodbye| 00:00 | Well I hope you enjoyed
FileMaker Pro 12 in Depth.
| | 00:03 | If you aren't sure about anything I
have covered in this course, feel free to
| | 00:07 | come back and check out
these chapters for a refresher.
| | 00:10 | This is by no means a comprehensive
list of features of the FileMaker product,
| | 00:14 | but it just serves as a great way for you
to enhance your FileMaker development skills.
| | 00:18 | Although lynda.com has all the best
online training available, if you're looking
| | 00:22 | for some additional resources
online, you can check out the
| | 00:25 | filemaker.com/technet and for free you
can join the FileMaker Technical Network.
| | 00:32 | This will give you access to dozens
and dozens of technical briefs on white
| | 00:35 | papers, some of which I've
referenced inside this course.
| | 00:39 | And also you can find me at
isolutionstraining.com where I have all sorts of
| | 00:44 | free videos and papers that I've
linked to on this page and I'd also like to
| | 00:48 | hear from you if you have
any questions about training.
| | 00:50 | But most important, good luck on those
databases and we'll see you next time.
| | Collapse this transcript |
|
|