Examples

Changing an Entry in an Existing Soup

Here is an example of changing an entry in the Names soup. A QuickTime movie of this example is available. First we get a union soup for Names, create a cursor, placing it on an entry and printing it out in the Inspector.

namesSoup := GetUnionSoup ("Names");
namesCursor := namesSoup:Query(nil);
anEntry := namesCursor:Entry();
Print(anEntry);
#440E875  {class: person, 
           version: 2, 
           sorton: "Christie Agatha", 
           address2: NIL, 
           addresses: [], 
           pagers: [], 
           address: NIL, 
           postal_code: "", 
           cardType: 1, 
           anniversary: NIL, 
           region: NIL, 
           _modTime: 48616547, 
           city: NIL, 
           email: NIL, 
           bdayEvent: NIL, 
           title: NIL, 
           country: "England", 
           name: {honorific: NIL, first: "Agatha",
            last: "Christie", title: NIL, 
            class: person}, 
           company: "", 
           emailAddrs: [], 
           companies: [], 
           notes: NIL, 
           anniversaryEvent: NIL, 
           names: [], 
           phones: [NIL], 
           _uniqueID: 362, 
           bday: NIL, 
           emailPassword: NIL
}
Now, open the Names application and scroll to that entry. In the following code, we change some of the values in the entry and then send the EntryChangeXMit message:

anEntry.city := "London";
anEntry.country := "England";
EntryChangeXmit(anEntry, '|ProgNewton:Calliope|);
You should see your entry updated on screen as well.


An online version of Programming for the Newton using Macintosh, 2nd ed. ©1996, 1994, Julie McKeehan and Neil Rhodes.

Last modified: 1 DEC 1996