This is a confusing topic.
Let's say your "news" field displays a different newsflash every
few moments. A script puts new text into the field and then counts
how many times each unique word appears in the text. The word
counts are stored as custom properties of the field, with the
custom propertynames following this format:
NEWS-<the seconds>[<word>]
So if word counts were completed a moment ago on the latest
content, some of the custom propertynames might be:
NEWS-956720755[MS]
NEWS-956720755[attorneys]
NEWS-956720755[say]
NEWS-956720755[the]
NEWS-956720755[DOJ]
NEWS-956720755[is]
NEWS-956720755[unjust]
So for a given newflash, the body of each custom propertyname is
the same; only their index values (the part within the [brackets])
vary. Because of this, they constitute a "customPropertySet" as MC
sees them. The name of this customPropertySet is "NEWS-956720755";
the name of the set created 45 seconds prior to this one would be
"NEWS-956720710"; and so on.
Every 15 minutes, another script samples the words being used in
the news. There are several steps to the process:
on sampleTheWords
-- get the names of all sets of word counts
put the customPropertySets of fld "news" into tSets
-- bring the name of the latest set to the top of the list
sort tSets descending
-- get the name of the latest set of word counts
get line 1 of tSets
-- make it into the news field's current "customPropertySet"
set the customPropertySet of fld "news" to it
-- The field knows the real name of its customPropertySet,
-- so the set's values can be accessed without repeating
-- the name - we only need the index name for each value.
-- The customKeys of the field is the list of index names
-- for the current customPropertySet.
put the customKeys of fld "news" into tKeys
-- Now tKeys contains:
-- MS
-- attorneys
-- say
-- the
-- DOJ
-- is
-- unjust
-- ... and so on.
-- add the count of each keyed customPropertySet item
-- to an array of word count totals:
repeat for each line tKey in tKeys
add the tKey of fld "news" to aWordCount[tKey]
end repeat
end sampleTheWords
Every two hours, all but the five latest customPropertySets of the
news field are deleted. Here's the script that does it:
on deleteSets
put the customPropertySets of fld "news" into tSets
-- bring the newest sets to the top of the list
sort tSets descending
-- save only the 5 newest sets from the list
set the customPropertySets of fld "news" to (line 1 to 5 of
tSets)
end deleteSets
I've gone to seed! Somebody stop me next time...
To delete one set and keep all others:
-- it can probably be easier than this, but this works
set the customPropertySet of fld "news" to "NEWS-956720755"
set the customKeys of fld "news" to empty
set the customPropertySet of fld "news" to empty
To delete all sets:
set the customPropertySets of fld "news" to empty
That will get you there.
Phil
Leston Drake wrote:
>
> Hey, can anyone tell me how to delete a customPropertySet of an object?
>
> TIA
>
> Leston Drake
> LetterPress Software, Inc.
> http://www.lpsoftware.com
>
> Archives: http://www.mail-archive.com/metacard%40lists.best.com/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
--
Phil Davis
--------------------
[EMAIL PROTECTED]
days: (503) 986-1215
eves: (503) 557-5656
Archives: http://www.mail-archive.com/metacard%40lists.best.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.