Re: [NTLK] A question for Newton programmer-types -- last remaining major hitch in iCal sync

From: Paul Guyot (pguyot_at_kallisys.net)
Date: Fri Dec 06 2002 - 14:14:47 EST


À (At) 10:29 -0800 6/12/02, John Anderson écrivait (wrote) :
>I'm trying to search a soup for a record that has a specific unique ID.
>One would think this would be a fairly easy task:
>
>currentSoupName := "Calendar";
>currentQuerySpec := currentQuerySpec := { validTest:func(entry)
>EntryUniqueID(entry) = 216 };

[snip]

This isn't the best way to go. _uniqueID is the integer key.
You'd better do:

local frame theSoup := GetUnionSoupAlways(currentSoupName);
local frame theEntry := theSoup:Query(nil):GotoKey(216);
local boolean isEntry216 := IsFrame(theEntry) and theEntry._uniqueId = 216;

The last line is there because the Newton returns the first entry
with _uniqueId >= 216, nil if there isn't any.

To be perfectly clean, you might want to check that _uniqueID is
indeed the integer index (I think it's more or less required, but one
never knows).
Otherwise, Jim's solution should be fine, although probably slower.

Paul

-- 
NPDS: http://newton.kallisys.net:8080/
Apache: http://www.kallisys.com/

-- This is the NewtonTalk list - http://www.newtontalk.net/ for all inquiries List FAQ/Etiquette/Terms: http://www.newtontalk.net/faq.html Official Newton FAQ: http://www.chuma.org/newton/faq/



This archive was generated by hypermail 2.1.2 : Wed Jan 01 2003 - 10:01:57 EST