Monday, November 08, 2010 at 12:01 AM.


<<build a list of states and their capitals from the database
	<<be sure the database is open before running it

bundle { <<create the outline, open it in a window
	new (outlineType, @scratchpad.stateCapitals);
	target.set (@scratchpad.stateCapitals);
	editMenu.setFont ("Geneva");
	editMenu.setFontSize (9);
	edit (@scratchpad.stateCapitals)};

with FileMaker, ObjectModel {
	local (recordCount, i, stateName, stateCapital, dir);
	show (record [all]); <<select all records
	recordCount = count (layout [1], record);
	op.setLineText ("There are " + recordCount + " state capitals in the database. They are:");
	dir = right; <<first headline inserted to the right
	for i = 1 to recordCount {
		stateName = get (record [i].cell [1]);
		stateCapital = get (record [i].cell [2]);
		op.insert (stateCapital + ", " + stateName, dir);
		dir = down}}; <<subsequent headlines inserted down

op.firstSummit ();
window.zoom (@scratchpad.stateCapitals);
target.clear ()

This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.