Bark Dark
Bob Sneidar
bobs at twft.com
Fri Apr 1 12:38:35 EDT 2011
Hey pretty clever. You could even trap for newCard and deleteCard to add and delete entries in the custom Property. That way you wouldn't have to repeat through all the cards again except for maintenance.
It looks like the repeat loop is getting the value of a shared field on each of the cards. Couldn't you just set the property array element to empty for each card to initialize it, then have a custom function markme(theMark) which would simply set the array element to whatever you passed in theMark?
Bob
On Mar 31, 2011, at 5:23 PM, Jim Ault wrote:
> On Mar 31, 2011, at 3:29 PM, Bob Sneidar wrote:
>
>> I don't think the property thing will work because I don't think you can find a card with a property or enumerate them as such. (This AIN'T Applescript man!"
>>
> The 'property thing' does not refer to the CARD properties,
> but the customProperties of the STACK
>
> ---- tested in a working stack ------------------
> --note fld statusCode is NOT shared
> -- flds desiredCodeString notnowCodeString
> -- ARE SHARED
> -- fld output is NOT shared
> -- all fields are in a group that behaves as backgound
>
>
> on doCustomPropertyRun
> -- I use 'cps' to mean 'cust prop set'
> set the customPropertySet of this stack to "cpsStatusCodes"
> --make this set empty
> set the customkeys of this stack to empty
>
> --you only need to do the repeat when changes are made
> -- or when the stack closes
> repeat with k = 1 to the number of cards
> put word -1 of the short id of card k into thisCdId
> get k & "^" & word 1 to -1 of fld "statusCode" of card k
> replace cr with space in IT
> set the cpsStatusCodes[ thisCdId ] of this stack to IT
> end repeat
> save this stack --if it is run in the IDE, but not if an app
>
> --To get the list of 'marked cards' you would do the following type of operation
> set the customPropertySet of this stack to "cpsStatusCodes"
> put the customProperties of this stack into statusCodeList
> -- now make a regular list
> combine statusCodeList using cr and "^"
> set the itemdel to "^"
> if field "desiredCodeString" is not empty then
> filter statusCodeList with "*" & field "desiredCodeString" & "*"
> --and now you have a list of cd id's
> end if
>
> if field "notnowCodeString" is not empty then
> filter statusCodeList without "*" & field "notnowCodeString" & "*"
> -- and you have a shorter list if any have been removed
> end if
> -- if you want the card order, use the following
> sort statusCodeList numeric by item 2 of each
> put statusCodeList into fld "output"
>
> --this allows showing a list of hits and changing the final list in many ways
> end doCustomPropertyRun
>
> ----------------------------------------
> Jim Ault
> Las Vegas
>
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
More information about the use-livecode
mailing list