Welcome, Guest. Please Login
Tinderbox
  News:
IMPORTANT MESSAGE! This forum has now been replaced by a new forum at http://forum.eastgate.com and no further posting or member registration is allowed. The forum is still accessible via read-only access for reference purposes. If you wish to discuss content here, please use the new forum. N.B. - posting in the new forum requires a fresh registration in the new forum (sorry - member data can't be ported).
  HomeHelpSearchLogin  
 
Pages: 1
Send Topic Print
Prototype naming & queries (Read 577 times)
Mark Anderson
YaBB Administrator
*
Offline

User - not staff!

Posts: 5689
Southsea, UK
Prototype naming & queries
Jan 27th, 2016, 6:48am
 
If you use prototypes it is often the case that derivative prototypes spur off. You start with 'pNote' and soon have 'pOldNote', 'pReferenceNote', etc. Then you realise you need to query for all the notes based on 'Note'-type prototypes. so you have to write a long query like:

Query:  $Prototype=="pNote" | $Prototype=="pOldNote" |$Prototype=="pReferenceNote"

But, don't overlook the (v6.4.0+) String operators .beginsWith() and .endsWith(). Thus the simpler query:

Query:  $Prototype.endsWith("Note")

..can save writing a much longer query were there a number of similar-named prototypes to which you need a match. Indeed, before posting this I forgot endsWith() and renamed my prototypes so the common ('Note') part was at the beginning ('pNote...') rather than the end as originally created. Duh!

You can re-name prototypes but do bear in mind that whilst notes using that prototype automatically update their $Prototype but any action that explicitly use the old prototype name will not be updated. So, if using similar/derivative sets of prototypes it pays to put the common part of the name consistently at the beginning or end of the $Name so you can easily use .beginsWith() and .endsWith().
Back to top
 
 

--
Mark Anderson
TB user and Wiki Gardener
aTbRef v6
(TB consulting - email me)
WWW shoantel   IP Logged
Pages: 1
Send Topic Print