Volume Number: 16 (2000)
Issue Number: 8
Column Tag: Tools of the Trade
Lasso Studio for Dreamweaver 1.5
By William Porter
Web database programming for the rest of us?
Lasso is a tag-based programming (or, if you prefer, scripting) language used to send instructions to the Lasso Web Data Engine (WDE). The Lasso WDE runs on a web server as a plug-in or CGI, where it is typically used as middleware to enable the web server software to talk to a back-end database such as 4D or FileMaker Pro. While the Lasso language itself is fairly high-level, it is nevertheless a reasonably complex language with hundreds of tags, and the fact that Lasso code gets scattered around in the HTML code of web pages makes writing it and reading it somewhat difficult. Until recently, Lasso developers had no choice but to rely entirely upon text-editors like BBEdit to do their coding. But with the release of the Lasso Studio for Dreamweaver (LS/DW) in December 1999, Lasso developers finally got a graphical interface to work with. And with the version 1.5 update, released in early Spring 2000, the LS/DW is ready for prime time. Lasso hasn't gotten any easier and doing advanced work with Lasso still requires that you get your hands dirty. But building a basic Lasso-powered site is now truly within the reach of non-programmers.
Like Lasso itself, the Lasso Studio for Dreamweaver does not care much what DBMS it interacts with. Lasso WDE can communicate with 4D, FileMaker Pro and ODBC data sources. For the purpose of this article, we are assuming that the database being published is running under 4D Server.
The Configuration Wizard
Let's imagine that you have kept your used bookstore's inventory in 4D for years and now you want to put the inventory online using the Lasso Studio for Dreamweaver. In order to get started, open the database under 4D Server, crank up the Lasso Web Server and finally, launch Dreamweaver. If everything is properly installed and configured, you'll see a number of new items in the Dreamweaver Commands menu (see Figure 1).
If you are working on your site for the first time, the Lasso Studio will need to know some things about your database files: their names, the names of the fields, layouts and value-lists in each file. Gathering this information is the job of the Configuration Wizard, which uses Lasso to query the databases and store this information in a "snapshot" file.
The snapshot file is the key to everything. Without it, you can't work. With it, you don't even have to have 4D or the Lasso Web Server open to create Lasso pages in Dreamweaver. This makes it possible for teams of developers to share snapshot files without actually sharing the databases or needing to have Lasso running on every machine. And if you work on multiple projects, you can create multiple snapshot files, name them, then load the one you need for your current work session.
Considering the importance of the snapshot file, it's unfortunate that the Configuration Wizard, which creates it, is the weakest part of the Lasso Studio. If you want to create different snapshot files for different projects, you'll have no choice but to do that manually, because the Configuration Wizard does not ask you to name the file it creates. More seriously, some users have found it difficult or impossible to use the Wizard with success, although the latest release of the Lasso Studio for Dreamweaver extensions fixed all the problems I myself experienced earlier. It is important to keep in mind that the LS/DW configuration wizard will only work if you have Lasso installed properly installed and configured properly and if your database is properly registered with Lasso security. These are tasks that beginning users - LS/DW's audience - sometimes find confusing. Fortunately, as a last resort, it's possible to create a snapshot "manually," if you have to.
When the configuration wizard is done, it will display the names of all the data sources it found (the names of your open files) and ask you to select one to work with. You can change your selection at any time later on by using the Database Selector dialog (Figure 3).
Figure 3. The Database Selector dialog.
Lasso Studio Basics
The Lasso Studio for Dreamweaver adds four pages to the Dreamweaver objects palette. These contain icons that you can use to insert tags that access data sources, tags that create Lasso forms, tags that rely upon Lasso extensions, and programming tags (like conditions, tokens, file manipulation tags, and others).
Figure 4. The Lasso Form objects.
For example, you can create a one-page Lasso search form using the Lasso Form page of the palette (Figure 4). With a blank document open, click on the "Lasso Form" object to insert a form area. (For some reason, the Lasso Studio will place the form at the top of the editable area regardless of where the insertion point is. You can cut and paste the form where you want it to be if necessary.) When a new form is created, the Lasso Studio automatically inserts a few objects into the form for you: objects that let you define the database to be searched, the layout to be used, and an object that identifies the web page that will display the resulting hit list. When you build a page "manually" this way, you must click on each of those objects and supply a parameter; that is, select the response page object and in the Dreamweaver object properties inspector, enter the name of the .lasso page to be used as your format file (Figure 5).
Figure 5. The response page object shown above has been selected inside the Lasso form, and the parameter required by that tag (the name of the response or format file) is entered in the Dreamweaver object properties inspector.
The icon of the clicking arrow shown as the first tag in Figure 5 is the action tag, which specifies the action to be performed when the user clicks on the submit button. For a search form, that action would be "-search." Like the other Lasso objects in this row on the page, the action object represents a hidden input tag in the HTML. Remember, GUI and WYSIWYG are not synonyms! The Lasso Studio for Dreamweaver provides a graphical-user interface for inputting programming tags, but to an even greater extent than Dreamweaver's own page-editing interface, the Lasso Studio GUI is not WYSIWYG. With any luck, when your site is deployed, what you'll get on most of your Lasso pages is data, and that is one thing you never see when you're working in Dreamweaver.
Anyway, once you have all the hidden input tags the form needs, you just throw in a few search fields (using the same page of the objects palette) and add a submit button at the bottom of the page and you're done-without writing a single line of Lasso code and without ever having to open up Dreamweaver's HTML editor!
The Site Builder
But wait, it gets better. Why build individual pages one tag at a time, when the Lasso Studio can automatically generate all the pages for your entire site? Well, maybe not your entire site, but the Site Builder does build sets of related pages.
Figure 6. The Site Builder's two page-set options.
You start by selecting a "site action" in the Site Builder dialog (Figure 6), and then the Site Builder asks you a series of questions: what fields you want on each page; what field to use as the link-to-detail field on the hitlist page; whether to include a "find all" button on the search page; and so on (Figure 7).
Figure 7. The Lasso Site Builder walks you through the choices you need to make before it can build the page set for you. This screen shot shows the options available for the hitlist page, including (at the bottom) whether the linked detail page should be a display or an update page.
When you get to the end of this interview process, the Lasso Studio performs what many older Lasso users will regard as a nothing less than a minor miracle: it creates an entire set of ready-to-run pages for you, in less than a minute. Once again, you did not have to write a single line of code - and this time you did not even have to type parameters in the object properties inspector. The Lasso Studio for Dreamweaver Site Builder is the star attraction in the package and beginning users will love the Lasso Studio for this feature more than anything else.
Lasso Studio for Dreamweaver 1.5 still has the Form Builder that was introduced in version 1.0. The Form Builder creates single pages and is particularly useful for editing the page sets generated by Site Builder. You can, for example, use the Form Builder to add a new page, then simply tweak the sequence of links in the revised page set.
Together, the Site Builder and the Form Builder allow developers to create a working draft of a basic site very quickly. Of course, the Lasso Studio does not make your pages look good for you., but it does not get in your way, either. When you use the Site Builder, you can tell it to use a Dreamweaver template and what editable region of that template to insert the Lasso code into, so elements like site headers and common menus can be placed directly into the Lasso pages by the Site Builder.
Beyond the Basics
Yes, there is a catch. The Site Builder does what it does and that's all that it does. For everything else, you're on your own with the Lasso Reference Manual. Working with Lasso remains a form of programming, and especially if you want to go beyond the basics, you will need to understand Lasso's programming logic, because the GUI requires that you know not just what tags (objects) to insert, but also what parameters to add to tags, and in what order to insert tags. And ironically, when you know enough to do it using the Lasso Studio's GUI, you know enough to do it without, so the advantages of the GUI seem less clear. Advanced developers may even feel that using the GUI is more trouble than working with the code directly.
One of the places where this limitation is most evident is in the way the Lasso Studio handles inline tags. Inline tags are placed within the format file that displays their results and they are processed before the page is displayed. For this reason, they are never seen by end users, either in the browser's location field or in the source code window. So, for example, you might create a page named "list_everything.lasso" which includes this inline:
[inline: datasource='Books.4D', table='books', keyfield='ID', sortfield='author_last', findall]
[field:'author_last'], [field:'author_first']: <i>[field:'title']</i>
This simple code will find all the records in the database "Books.4D," sort them by the author's name, and display a hit list showing two fields, "author" and "title." Best of all, no information about your databases will be revealed in the source code for the page. Most advanced Lasso developers prefer to use inlines as much as possible. Yet Blue World does not promote their use energetically. The Lasso Studio wizards create page sets exclusively using the traditional tag types. If you prefer to use inlines, then the Lasso Studio for Dreamweaver's strongest feature - the Site Builder - will be wasted on you. And creating an inline in the Lasso Studio is, in my opinion, more difficult than it is to type the same code into the HTML editor by hand. Here is the inline inspector used to create the same tag that was shown on the previous page:
Figure 8. The Lasso Tag Editor, being used to create an inline tag.
The down side to inlines is that they are somewhat more complicated conceptually than traditional tags. Processing an add or search form using an inline in the response page rather than hidden input tags in the form page itself requires careful use of the [form_param] tag at a minimum, and in some cases can require the use of tokens to pass data from one page to the next.
In some cases, you simply cannot use the Lasso objects to insert code and must type it in manually. For example, it is common to use form parameters or tokens or cookies in links that conduct searches:
=[token_value:'customer_id']&-search]">Click here to view the items in your shopping cart</a>
That link tells Lasso to go to the layout "web" in the database "items" and find all the items that have been selected for purchase by this customer, based on the value of the token "customer_id." Now there is a Lasso token object in the objects palette. But you cannot insert an object-Lasso object or other kind of object-into the object inspector's link field. And since the link field is so small, you will almost certainly want to type that tag into your HTML editor instead.
Availability and Pricing
The Lasso Studio for Dreamweaver provides you, the developer, with two things: (1) a testing-only version of the Lasso Web Data Engine, with all the data-source modules (4D, FileMaker Pro and ODBC), and (2) the extensions for Dreamweaver. You must supply the databases and your own copy of Dreamweaver 3.01. A thirty-day evaluation version of the Lasso Studio for Dreamweaver can be downloaded from Blue World's web site: http://www.blueworld.com/download/. The Lasso Studio for Dreamweaver can be purchased directly from Blue World Communications. As of mid-summer 2000, the boxed version (with CDs and printed manuals) has a list price of $349; the electronic (downloaded) version is priced at $299.
On balance, version 1.5 of the Lasso Studio for Dreamweaver is a winner. The Lasso Site Builder is a godsend for beginners and a time-saver even for experienced developers. As we have seen, its difficult or impossible to do everything using the Dreamweaver GUI, and Hardhard-boiled Lasso coders may will not want to give up their favorite text editor, . but But I thought of myself as at least a medium-boiled coder, and I have learned that I can use BBEdit and the Lasso Studio for Dreamweaver side-by-side to very good effect.
William Porter, Ph.D., is the owner of Polytrope Solutions, a database development firm in Houston, Texas, specializing in 4D, FileMaker Pro and Lasso projects. You can write him at email@example.com.