Excerpted from CF Advisor, February 1999.The "Studio" Route to CF's Many Powerful FunctionsCold Fusion provides us with an incredible wealth of functions for performing everything from string and date manipulation to array and list processing.Learning about them, let alone figuring out how to use them, can be a challenge. There are just so many to choose from. And remembering any parameters required and their expected order is even more difficult.
The Expression BuilderYou may find yourself hopping to Studio's help to find out how to use these functions, or you may have a bookmark in your browser to the CF Docs html files. But to access them even more quickly and easily, consider using the "insert expression" command, available while you're editing text in the Studio editor. Just right click where you intend to put the function, and select "insert expression". You can also access this command with the keystroke Ctrl-shift-E or from the Tools menu command, where it is instead referred to as "expression builder". With any of these approaches, you'll be presented a small window with a hierarchically-organized list of the available functions.
More important, they're available in categories, so you're reminded of the available functions grouped as "date and time", "display and formatting", "string", etc. This makes it even easier to remember or discover new functions.
Selecting one of the category names in the left pane will display a list of that category's functions in the right pane. Sometimes, though, being forced to navigate a hierarchical list can be frustrating if you already know the name of the item you seek but perhaps not the category that the list builder applied to it. Fortunately, Allaire has not limited your forms of access. If you select the top-level "functions" category, you actually get a list of ALL the functions. If you place the cursor in the list, or in any of the panes, and type the first letter of the item you seek, that item will be displayed without need to scroll down the list. This can make it very easy to quickly find a particular function that you know about, perhaps to see its syntax and parameters as described in the next section.
Help TextOf course, this is more than just a categorized list of functions (valuable as that is). By selecting one of the functions and double-clicking (or pressing enter), you will be shown the expected parameters, in their proper order. That's really helpful.
What's more, you can see explanations of the parameters as well as related functions by calling up what is basically the help text for that function, just as would be found in the Reference Manual or via the online help. But you can access it easily within this expression builder window. There are two ways to do so. If you look closely below the right pane (showing the list of functions), there are two small icons: one looks a bit like a clover leaf and the other shows stacked up/down arrows. Clicking either of these will display the help text, each in a different manner. The first will open a new window in Studio to display the help, while the second will simply extend the size of the "expression builder" window and open a new pane within it to show the help text. The latter may be preferable for a quick review where the help you seek may appear in the top of the help text (see figure 4). The former is more suitable if you really want to "read" the help text in its entirety.
To help you remember which icon calls up which form of display, note that if you place your mouse cursor over either of the two, you'll see a pop-up help text which shows that the first is meant to "show help in a separate window" while the second is to "toggle embedded help".
Expression InsertionAll this would be powerful enough if all you wanted was to review/learn the available functions. But, to quote the old Ginzu knife TV commercials, "Wait, there's more!". When you have double-clicked a function as described at the top of the previous section, the syntax is displayed in a command line pane of the window. This serves as more than just a reminder: it's a fully editable window, so that you can replace the displayed parameters with your own intended variables, strings, etc. Then, by clicking the "insert" button, you can easily insert the expression into your own text.
There's Still More! Much More Than Just FunctionsEven if you do have a complete handle on (or lack of interest in) CF functions, however, there's still more the expression builder can do for you. As it's name implies, it's an "expression" builder. In Studio parlance, an expression can be comprised of functions, constants, operators and variables. And the expression builder has categorized lists of all these elements. While you're looking at the list of topics you're currently interested in, scroll down the expression builder's list of elements (the left pane) and you'll see that below the functions are also available:
The list of CF Variables categories may surprise you. It includes:
An example of this is the "CGI variables" list.
These and all the other elements in the expression builder are a great way to be reminded about what's possible in CF. And the ease of access will probably increase the likelihood of your taking the time to use them. Keep in mind that, as with the functions list, you can either view a list of categories for each element in the right pane and then see the items in that category in the right pane, or you can select the element name (such as "constants" or "operators") and see a list of all the items of that type.
Other Keyboard Shortcuts for Fast AccessFor folks most comfortable with keyboard shortcuts, you'll probably notice that the expression builder and the separate help window aren't closed by simply pressing escape. That's seems frustrating at first. You would probably resort to just closing it by clicking the "x" button in the upper right corner like any window. If you're keyboard savvy, you might also try Ctrl+F4 or Ctrl+W (often used to close windows in various other contexts). They don't work here either. While you may be reluctant to try it, I'll share that it is indeed an Alt+F4 that will close the window. Just be sure to use this while the expression builder still has "focus", or you may close CF Studio by mistake. Some other ways to maximize keyboard efficiency include using the tab key to move around the panes, the up/down arrow keys to move through the displayed lists, as well as the previously mentioned "accelerator key" to locate an item that starts with a selected character. With all these shortcuts, you can quickly find, display, and close the help text for, say, the "parameterexists" function. Here are the keystrokes you could use (plus an explanation of the result):
This may sound like a lengthy list, but they can be performed in as little as 8 seconds if you're just looking up the syntax for a particular function.
A Quirk About Expression InsertionNote one thing about using the right-mouse-click to call up the expression builder: you may have the cursor on the line at which you're typing and intend to enter the expression, but if you happen to casually right-click some other place on the screen, the inserted code will go to the place closest to that mouse-click, not where you were typing. The upshot is, if you intend to do an insert, be sure to place the mouse where you want the code inserted (or avoid the problem by using the menu command or the shortcut, CTRL+SHIFT+E).
Close Cousins in an Impressive FamilyFinally, let's recognize the related "tag chooser" and "insert SQL statement" commands. The tag chooser calls up the tag editor to insert (and display help for) any CFML, HTML, HDML, VTML, or even custom tags. Like the expression builder, it also shows these in useful categories, so you can find the "flow control" CFML tags or the "tables" HTML tags. Note that when you select one of the items (single-click), it shows the syntax in a bottom pane of the window, whereas if you double click it you open the "tag editor", another handy Studio invention that lets you easily edit any tag via an interactive, somewhat object-oriented interface. Selecting "apply" from the tag editor will insert the tag in your text. There's a quirk here, though. Some tags (perhaps due to their simplicity) will not display in the tag editor if you double-click them: instead, the tag will just be inserted in your text automatically. No need to "apply" (pardon the pun). Note that both the "tag chooser" and the "tag editor" can be closed with the escape keystroke. And that the Tag Chooser can be called up with the keystroke, CTRL+E. Finally, the "Insert SQL Statement" command (no apparent keyboard shortcut) will also help you visually and interactively build a SQL statement (and optionally a complete CFQUERY tag). It will connect to your local or remote databases and is a powerful command well worth mastering. |
|
| User Groups | Other Resources | Press Releases | Company |
© 1998-2024, Charles Arehart, SysteManage |