Original documentation, lifted from Eccoext.eco
(Todo: return cleaned version to eccoext distribution)
Enhanced auto assign rules
- The new auto assign rules support column values and simple Boolean expressions
- The new auto assign rules have the following format
- ++:flag:value:expr
- The first '++:' is the invariable prefix that introduces one of the new rules
- The flag determines how and when the rule will be applied. It may be one or more of the following characters.
- T the rule applies to TLI items
- D the rule applies for dependency checks
- P the rule applies for parent changes
- C the rule applies for sub item changes
- I the rule applies when an item's text or an item's level changes
- F the rule applies when an item's folder changes
- S the rule applies when file first Load for Date change
- L the rule is a LUA script
- when this flag is set, the '+-!' flag will not be checked
- and the script follows right after the ':'
- + the folder will be set if the expr is true and the folder value has not set
- - the folder will be cleared if the expr is false
- ! the folder will be set if the expr is true; if the folder already has a value, the new value will overwrite the old one
- If the folder type is date, the folder will be set to the present time if the value is empty and expr is true, otherwise use the value
- If the type of folder is not date, it will use value as set
- If the +-! flag is not set, the default is + (the folder will be set if the expr is true and the folder has no existing value)
- if the flag 'F' and flag 'I' are not set, the default is 'FI'
- 'value' is the folder value which will be set if the expr is true
- for checkmark type folders, the value can be empty
- for date type folders, an empty value means Today
- for other types of folder, an empty value means remove folder
- value have the same syntax as expr: see below.
- 'expr' uses the following syntax
- expression tokens
- () are used to group an expression
- ITT means Item Text
- PTT means Parent Item Text
- ITP means Item Type
- SBF means if there is child or sub child folder set
- [folder name] means the folder value of the item
- if the folder name has prefix '@', that means the dependent items' folder values. If the folder name has the prefix '^', that means the parent item's folder value. Otherwise, it refers to the current item folder value
- for example value [Done] means use Done folder value as folder value
- and value [@Done] means the Done folder values of the dependent items
- and value [^Done] means the Done folder value of the parent item
- { } means the first Regex subexp
- value {0} means use the whole match string
- value {1} means the first subexp string
- = equals
- == equals
- != does not equal
- <> does not equal
- ! not
- > greater than
- >= greater or equal to
- < less than
- <= less than or equal to
- ?= equal ignore case
- ~= Matches a string against a regular expression
- ~~= Matches a string against a regular expression, ignoring case
- + add two numbers or strings, or add integer to date
- - subtract two numbers or dates, or sub interger from date
- / divide two numbers
- NOW The current date and time
- TODAY The current date
- && and
- || or
- AND and
- OR or
- NOT not
- TRUE true
- FALSE false
- number any number
- 'string' string
- "string" string
- expression functions
- len(str) length of string
- match(str, pat) return the matched part of a string: 'pat' is a regular expression
- imatch(str, pat) like match, but ignore case
- replace(str, pat, rep) replace all the parts of 'str' that match the regex 'pat' with 'rep'
- ireplace(str, pat, rep) like replace, but ignoring case
- iff(cond, true_value, false_value) if cond is true, return true_value else return false_value
- expression examples
- Test whether an item's text includes the string 'hello'
- Test whether an item's text includes 'hello' and that it has a value in the folder Done.
- Test whether an item's type is text and it's value in the Done folder is '20070101'
- ITP==1 && <Done>=='20070101'
- expr supports regex expressions for the operators '~=' and '~~='. Regexes are also supported by match, imatch, replace, ireplace function
- The regex langage supports the following special characters:
- \ Quote the next metacharacter
- ^ Match the beginning of the string
- . Match any character
- $ Match the end of the string
- | Alternation
- () Grouping (creates a capture)
- (?:) Non capture group
- [] Character class
- Greedy closure (match the longest possible string)
*\* Match 0 or more times
- + Match 1 or more times
- ? Match 1 or 0 times
- {n} Match exactly n times
- {n,} Match at least n times
- {n,m} Match at least n but not more than m times
- Non-Greedy closure (match the shortest possible string)
- Add "?" after the greedy closure
- Escape character
- \t tab (HT, TAB)
- \n newline (LF, NL)
- \r return (CR)
- \f form feed (FF)
- Predefined classes
- \w alphanumeric [0-9a-zA-Z]
- \W non alphanumeric
- \s space
- \S non space
- \d digits
- \D non digits
- \b word boundary
- \B non word boundary
- New auto assign rule example
- Timestamp the TLI item with its creation time (Date folder)
- Timestamp the TLI item modification time (Only on Date folder)
- Check a checkmark folder if any of its subfolders contain any item
- Check a checkmark folder if any of its subfolders contain any item; if none do, uncheck it.
- If an item contains the text 'hello' check the folder; if not, uncheck the folder
- Set folder value to <Done> value if the item text contains the string 'hello' (This can be used as conditional Merge Column Value)
- ++:+:[Done]:[Done] && ITT ~~= 'hello'
- Examples of assignment rules using Regular Expressions:
- Find a web address to place in [Net Location]
- ++:!-:'http://'+{0}:ITT~~='www\..* \.(com|net|edu)'
- Find a mail address to place in <E-Mail>
- ++:!-:{0}:ITT~='\w+@\w+\.\S+'
- Find the post message number of the form 'Message #1111'
- ++:!-:{1}:ITT~='Message #(\d+)'
- When the item text changes or folder value changes or is set or cleared, the rule will be checked automatically, but when you change the rule, you need to reapply the rule. There are two ways to do this.
- To check the new auto assign rule for one Folder over all item
- Open the folder window
- Select the folder you want to operate on
- Click the right mouse button
- Select the menu item <Check Folder Rules>
- To check the auto assign rule for all Folders over all items
- Open the folder window
- Click the folder button to see the folder menu or
- Click the right mouse button on any folder
- Select the menu item <Check All Folder rules>