Level: Intermediate, Version: FM 8 or later

Magic Key, part 2

I ended yesterday’s article promising a couple improvements on the techniques showcased therein. To avoid unnecessary repetition I am going to assume you have read it.

The first improvement is to eliminate the highlighted steps in the “parse current field” script. Is it really possible to create a related record and populate multiple fields in that record using a single Set Field step?

Absolutely, and you can follow along in today’s demo file, magic-key-multipredicate-check-box-reporting, if you are so inclined. Continue reading “Magic Key, part 2”

Level: Intermediate, Version: FM 8 or later

Magic Key, part 1

Today we’re going to look at a technique called Magic Key, which allows you to flexibly create and populate related records. I believe that the name originates with European developer Ugo Di Luca, and we’ll get to the details in a moment, but first let’s look at a scenario where it might come in handy. Have you ever built or inherited a system with data stored in text fields formatted as check box sets?

There are pros and cons to this approach, and one of the cons is that data stored in this manner can be a pain to report on. But I have good news: Magic Key can help alleviate that pain Continue reading “Magic Key, part 1”

Chart, Level: Intermediate, Version: FM 11 or later

Array Charting, part 3

[This article assumes that the reader is familiar with part 1 and part 2 of this series.]

The other day, I ended part 2 of this series by looking at the y-axes of a variable-array-based chart, and commenting, “Note that all 52 variables for each of the 12 data series are individually enumerated. I’m thinking that there is a smarter way to go about this, but that is code for another day.”

Well, now I’m thinking that “another day” has arrived.

Continue reading “Array Charting, part 3”

Chart, Level: Beginner, Version: FM 11 or later

A Charting Tip from the Old Advance Man

Here’s a tip I picked up from Steven Blackwell the other night on Friday Night FileMaker Chat. FileMaker 11 doesn’t provide an obvious way to prevent a user from interacting with a chart in browse mode (e.g., copying, clicking on, dragging, or mousing over to view tooltips).

Continue reading “A Charting Tip from the Old Advance Man”

Chart, Level: Advanced, Version: FM 11 or later

Array Charting, part 2

Last week we looked at building a FileMaker 11 native chart based on data that has been parsed into a field-based array.

2011-07-11-b

I happen to like field-based arrays, for reasons I’ll get to in a minute, but is a field-based array really necessary to generate the above chart? Continue reading “Array Charting, part 2”

Level: Intermediate

Dynamic Variable Instantiation

6 Apr 2016: A “SetVarByName” custom function can make things a whole lot easier. For details, see Set Variable by Name.

31 Oct 2014: This was originally embedded inside another article, but I now realize it should have been a standalone post, so I am belatedly taking corrective action and making it so.

Although FileMaker provides a “Set Field By Name” script step, it does not provide a direct method to dynamically declare the name of a variable.

dvi

Note that I said there isn’t a “direct” method to accomplish this… but it can be done indirectly.

Creating Variables on the Fly

There’s something cool and slightly miraculous about being able to dynamically name and populate variables at runtime. In the code below we don’t care about $x at all — it’s just a convenient way to access the calculation engine so we can invoke the Evaluate and Let functions.

We’ll come back to that in a minute, but first let’s consider a much simpler example. If we know the name of the variable we want to declare, but want to specify the repetition dynamically, it can be accomplished in a very straight-forward manner, like so:

non-dynamic variable instantiation

This gives us a variable named $array_01[x] where “x” represents whatever number is currently in the $rep variable.

The following also achieves the same result, but normally we wouldn’t bother since it’s more work with no additional benefit. But it does show that a variable can be defined via Let, with the rep specified dynamically — in this example, via a variable, $rep, but Get(RecordNumber) or any calculated expression would work.

However, the technique breaks down if we try to dynamically specify the name of the variable itself. In the above example, we’re telling FileMaker to define a variable named $array_01 with whatever repetition number happens to be sitting in the $rep variable.

But we want to declare a variable named $array_xx where “xx” could be anything from “00” to “12” and is based on the value sitting in the $column variable (padded with a leading zero where appropriate), and to pull that off we need to bring out the heavy artillery, i.e., Evaluate.

It makes my head hurt, but it actually works.

Chart, Level: Intermediate, Version: FM 11 or later

Array Charting, part 1

In recent postings we’ve looked at…

While these three techniques may not appear to have much in common, all of them are used as building blocks in today’s demo, line-chart-from-field-array. Our data set is a table of web site visits, by week and by state, beginning in March 2006 and running through June 2011.

Wouldn’t it be nice to to use FileMaker 11’s built-in charting capabilities to produce a line chart showing weekly visits per year? Continue reading “Array Charting, part 1”

Level: Intermediate, Version: FM 8 or later

Fast Summaries

Editor’s note: for additional thoughts on this subject see Fast Summaries Revisited and Fast Summaries Re-revisited.

Have you ever wished you could pull the values from a summary report, and use them in a script or a calculation? Back in the FileMaker 6 days, Mikhail Edoshin introduced a technique to do just that.

He called the technique Fast Summaries, and I came to employ it extensively in my own solutions. Continue reading “Fast Summaries”