The eccoMAGIC Forums
http://forums.eccoMAGIC.com/forum/YaBB.pl
the SLANG EXTENSION and Guest Programming >> Slang Rules Scripts, Functions, Examples and HOW TO >> The first step...
http://forums.eccoMAGIC.com/forum/YaBB.pl?num=1193871794

Message started by Admin on 10/31/07 at 18:03:13

Title: The first step...
Post by Admin on 10/31/07 at 18:03:13







first step, to describe in ecco terms what data you want from where
to turn into the created folder value... ie:

do you have a "Project" folder that contains the project name ?

will it be in the item itself (where you want to include the folder
value) or in a parent ? Etc.






--- In ecco_pro@yahoogroups.com, "albertschepers" <as@...> wrote:
>
> I have a project check mark folder [Engineering Project] that is
> checked to indicate that the project is an Engineering Project.
>

so one condition will be "[Engineering Project]" which means the
[Engineering Project] folder has some value... also can do it
as "[Engineering Project] == 1" whish is about the same thing...

> The Item Text
> in the note pad Engineering Project List, entered in the form, is
the
> project number which is a five digit number, currently 07XXX where
> the 07 represents the year and the XXX the project number.
>
obviously, if you change the format of your code, you'll need to
update the 'code watcher' ! ;)



a simple way to catch that.. assuming XXX is a NUMBER (different
match rule for text..)

is:

\b\d\d(\d\d\d)\b

which means a border, two numbers (decimil), followed by 3 numbers,
followed by a border.

a border can be a space, an end of line, etc...

what is in the parens is what is captured...




> I use the [Net Location] folder to contain the directory location
on
> the server which is H:\2007\XXX. Currently I complete the net
> location by hand but as I have several persons assigning projects
it
> would be nice to be able to have the [Net Location] filled in
> automatically.


so this is where we put the rule... in the [Net Location] folder...

>
> Perhaps I should back up just a little,


yes!! always make backups!!!!!!


>the project file is contained
> in a Master ECCO file that is shared amongst the office: at least
ten
> persons. There are four persons that have access to add
information
> to the Master File, this has caused some problems as we do add
about
> four projects per day (last year there were over 900 projects
> added in both engineering and instpection); this file is used
> extensively to control the work flow in the office.

it would help to upload a sample file (with 'bogus' data, but in
full format that you use..)

> This added
> feature will make it easier for all persons accessing the ECCO file
> to locate projects and then open the appropriate directory (project
> folder).


nice...




now.. if we look at the "Example.eco" that comes with the RAR
package, we see a rule for the [Net Location] folder:

++:I!-:"http://"+imatch(ITT,'(www\..*\.
(com|net|edu))'):ITT~~='www\..*\.(com|net|edu)'


let's see if we can modify it...

++: this is the start of every rule...

I!-: this is the Trigger setting --> Update on item text change,
and remove the autoset value if match is no longer matching.

"http://"+imatch(ITT,'(www\..*\.(com|net|edu))'): This is the value
being filled in when the rule condition is met.

we don't need the "http.." part... but we can use the imatch part..

i is for ignore case... here are bumbers so we can use regular
match...

match(ITT

ITT means the ITEM TEXT <- that is what we test the match against..

,' .... ' <- that is our regular expression matching term... what
is in parens is the value returned (if any).


so........

match(ITT,'\b\d\d(\d\d\d)\b') is the value we want to put in the
folder


ITT~~='www\..*\.(com|net|edu)' is the condition currently tested...
is the Item text matching the regular expression 'www\..*\.
(com|net|edu)'...

we want something else as our condition,

we want

[Engineering Project] <-- ie. this folder has value.. ie. IT IS
CHECKED.


and thus all together::




++:I!-:"H:\2007\" + match(ITT,'\b07(\d\d\d)\b'):[Engineering Project]



as the rule for your directory (text) folder ie. [Net Location]




ps there are several OTHER ways to do this...

ITT~~="\b(\d\d)(\d\d\d)\b" as the rule (or a rule) CONDITION, than
the value of the rule can use "{1}" and "{2}" as values.. being the
first paren contents, and the second paren contents, respectively...


you can also combine matches, for example::



++:I!-:"H:\20" + match(ITT,'\b(\d\d)\d\d\d\b') + "\" + match
(ITT,'\b\d\d(\d\d\d)\b'):[Engineering Project]


which for the next 93 years will make the folder H:\20XX\YYY (notice
what is in parens in the match).


you can also make the "H" variable...

by using the "iff(cond, true_value, false_value) " statement (which
can be nested.. ie "iff(cond, iff(cond, true_value, false_value) ,
false_value)"


eg. in place of ++:I!-:"H:\20"
you would have ++:I!-: iff(condition, "H","I") + ":\20"




;)



The eccoMAGIC Forums » Powered by YaBB 2.1!
YaBB © 2000-2005. All Rights Reserved.