Monday, November 08, 2010 at 12:01 AM.
system.verbs.apps.Filemaker.examples.addStates
<<add 50 states and their capitals to the Test Database <<be sure the State Capitals database is open before running this <<If you do not alread have this database you can create a simple database <<with two fields, the first being "Name" the second "Capitol" <<If a record for a state exists and has the wrong capital, it will still have <<the wrong capital after running this script. Repairing that is left as <<an exercise. on addState (stateName, stateCapital) { with objectModel, FileMaker { if not exists (record[cell["Name"] == stateName]) { create (record, {stateName,stateCapital}); <<Other forms of create: <<create (record, {stateName,stateCapital}, 0, endOf(database["State Capitols"]) msg (stateName)} <<show name in Frontier main window else { msg (stateName + " already exists!")}}; rollBeachball ()}; addState ("Alabama", "Montgomery"); addState ("Alaska", "Juneau"); addState ("Arizona", "Phoenix"); addState ("Arkansas", "Little Rock"); addState ("California", "Sacramento"); addState ("Colorado", "Denver"); addState ("Connecticut", "Hartford"); addState ("Delaware", "Dover"); addState ("Florida", "Tallahassee"); addState ("Georgia", "Atlanta"); addState ("Hawaii", "Honolulu"); addState ("Idaho", "Boise"); addState ("Illinois", "Springfield"); addState ("Indiana", "Indianapolis"); addState ("Iowa", "Des Moines"); addState ("Kansas", "Topeka"); addState ("Kentucky", "Frankfort"); addState ("Louisiana", "Baton Rouge"); addState ("Maine", "Augusta"); addState ("Maryland", "Annapolis"); addState ("Massachusetts", "Boston"); addState ("Michigan", "Lansing"); addState ("Minnesota", "St. Paul"); addState ("Mississippi", "Jackson"); addState ("Missouri", "Jefferson City"); addState ("Montana", "Helena"); addState ("Nebraska", "Lincoln"); addState ("Nevada", "Carson City"); addState ("New Hampshire", "Concord"); addState ("New Jersey", "Trenton"); addState ("New Mexico", "Santa Fe"); addState ("New York", "Albany"); addState ("North Carolina", "Raleigh"); addState ("North Dakota", "Bismarck"); addState ("Ohio", "Columbus"); addState ("Oklahoma", "Oklahoma City"); addState ("Oregon", "Salem"); addState ("Pennsylvania", "Harrisburg"); addState ("Rhode Island", "Providence"); addState ("South Carolina", "Columbia"); addState ("South Dakota", "Pierre"); addState ("Tennessee", "Nashville"); addState ("Texas", "Austin"); addState ("Utah", "Salt Lake City"); addState ("Vermont", "Montpelier"); addState ("Virginia", "Richmond"); addState ("Washington", "Olympia"); addState ("West Virginia", "Charleston"); addState ("Wisconsin", "Madison"); addState ("Wyoming", "Cheyenne")
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.