Welcome, Guest. Please Login or Register.
eccoMAGIC Forums
03/28/24 at 13:28:53
News: "Breathtaking" (Check out the new MagicView release at EccoTools.com)
Home Help Search Login Register


Pages: 1
Send Topic Print
  Rating
Rate:
Rating:
Rating: 6.00
Votes: 1

5
4
3
2
1






1





5
4
3
2
1


1


2


3


4


5


6


7


8


9


10

Who triggered my rule? (Popularity: 7245 )
JohnSmith
EccoMagic Apprentice
*


I Love Ecco!

Posts: 6
Show the link to this post Who triggered my rule?
11/23/07 at 04:06:42
 
Each change in Ecco is evaluated by auto-assign rules, and currently we can  even know which item has triggerd the rule. Internal variable item_id represents the current item and that is the item that triggerd the rule.
     For example the following rule puts a copy of any changed item into "Log" folder
           ++:L:          
           local vItemText=get_item_text(item_id)      
           local vNewItemID=create_item(vItemText)    
           set_folder_value("Log", vNewItemID,1)
 
I am just curious if it is possible to get additional info about the item which has triggered autoassign rules?  
May be  
     folder_id - to know in wich folder the change has been made?
     notepad_name - to know in which view the change has been made?
     item value (folder value) before the change?
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Who triggered my rule?
Reply #1 - 11/24/07 at 11:57:15
 

John,
 
 
Ecco does not natively give up any of this information.  It is possible in some, perhaps many situations to cache all active item's folder values and provide an array with prior values... but... that quickly gets to be a complex task when one folder value change triggers a sequence of rules,  each changing other folder values, or mass change from group change (apply form, drag group to folder, etc.).   Ie. a lot of coding effort with maybe little actual worthwhile value.
 
If you want this info you can set up a second cache level for each folder,   thus you can compare and see the prior values.  (after doing so,  likely you'll want to update the cache).
 
 
eg:
 
Folder1  has  Folder1_C
Folder2 has  Folder2_C
 
etc.
 
or you can cache all in a single text folder,
 
cache looks like maybe {Folder1} ... data... {Folder2} ...data....
 
 
upon activation your L script,  can loop and compare the values (to see which has changed, and from what),  and then UPDATE the cached values with the current.
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
JohnSmith
EccoMagic Apprentice
*


I Love Ecco!

Posts: 6
Show the link to this post Re: Who triggered my rule?
Reply #2 - 11/29/07 at 08:52:19
 
A prior value (cache) is not so important. For me more interesting is to get and info about current folder, if this does not require special effort.  
 
Something as current_folder_id will allow, for example, to resolve a circular reference when A=B and B=A;  
or perform certain actions when an item is marked Done and do not repeat that actions when some other folder is changed.  
 
There always is a way around of course, but current_folder_id can make it more clear.
 
Best regards,
JS
Back to top
 
 
  IP Logged
Admin
Administrator
*****


I love Ecco!

Posts: 134
Show the link to this post Re: Who triggered my rule?
Reply #3 - 11/29/07 at 22:46:24
 
Yes,  see your point!
 
 
in the LUA context,
 
 
folder_name
 
 
will give you the folder which TRIGGERED the LUA .... ie, where the LUA is located.
 
 
but this does not tell you what folder has changed!!
 
 
to do that,  just set up the cache as suggested,  loop to compare,  and you have your answer (answers).
 
 
note: more than one folder might have been changed.....
 
 
 
 
 
Back to top
 
 

The Administrator.
WWW   IP Logged
Pages: 1
Send Topic Print