Let’s Play Cards!
The Card Window was introduced in FileMaker 16. We learned some pretty cool development techniques and use cases for Card Windows during a FileMaker Developer Conference 2018 session.
Card Windows can be a great tool for transactional programming. You can easily arrange for transactional events to either pass or fail, meaning all edits/adds/deletes that happen during the transaction are either committed or not. Cards can be leveraged to guide the user through a process, storing the data via global fields, variables or JSON arrays along the way. Ultimately, the data will only be committed if the user completes all of the steps. Incidentally, you can also use slide panels to create this user experience.
Multiple Card Windows
Once you open a Card Window you can’t open another card window on top of it — or can you? There are many instances where I would love for users to be able to open multiple Cards at the same time, but it isn't very obvious how to create this functionality. The trick is to open a new Dialog Window after you open the first Card Window and make it smaller than the size of the first Card Window. Then open a new Card Window within the Dialog Window and make it the same size as the Dialog Window. Let me demonstrate...
Step 1: Open first Card Window
Step 2: Open new Dialog Window to provide a base for the second Card Window
Step 3: We did it!
A magician never reveals his secrets, but I'll make an exception this one time. Since a Card is attached to the window it was spawned from, users can click outside of the "Card on Card" window and effectively hide it from view (including the Dialog Window). As a best practice, when opening a subsequent Card Window, check to see if the Card Window is already open and if it is, select it. If a window isn't already open, go ahead and create it. Or as long as the starting window is not maximized, you could place the subsequent Dialog and Card Windows outside of the starting Windows so that the user can see both, regardless of which one is active. If you use this method, the Cards will not appear to be stacked so keep that in mind if you want to maintain the semblance of an ordered process.
Dynamically Add New Rows
Imagine you want users to enter data in a Card Window one row at a time, such as when adding data to child records. They would start with a single field/row of fields and they can request to display a new row as they go.
You can create this experience by first adding all of the fields/rows on a slide panel and then scaling the slide as large as needed to hold all of the records. Next, move the bottom of the slide panel up to hide all fields or maybe only display the first row by default and anchor the bottom of the slide panel. Be sure to create an "Add Row" button, which will simply resize the height of the Card window to display the additional row. Basically, instead of actually adding a row, all you're doing is resizing the window. Pretty cool trick, huh?
You can take this process further and store the data in global fields until the user completes the data entry. At that point, the data can be transferred and committed to the appropriate records. This will help to preserve the integrity of the database.
Modular Card Window Database
Did you know that you can create a separate database just for Card Windows? This is is a powerful concept that is generally used for adding functionality like what you can get from ModularFM. Then you will have a resource of functionality that can be shared between multiple solutions or very easily added to new solutions.
Don't forget that Card Windows do not work with WedDirect or server-side programming, neither scheduled scripts nor Perform Script on Server.
I hope you found my recap helpful. There's always lots to learn at theFileMaker's Developer Conference. Check out the session materials in the FileMaker Community for more details. And, we have more FileMaker tips and tricks to share.
Join our mailing list to keep up with the latest news and information about FileMaker and other custom app development tools.
This article is also posted on FileMakerProGurus.com.