Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

combining conditions problem

the documentation at this pont: http://www.fogcreek.com/CityDesk/help/Scripting_With_CityScript/fog0000000057.html does detail how to set up conditions.  sounds easy but i keep getting error messages telling me things like this: "expected ´(´" or this "unexpected ´)´. I´ll write you what i want to do, and i hope someone might put this straight for me:

All articles after a certain date, with the exeption of one article: ((after publishdate-3) not (filename "suchandsuch"))

well, i tried different variations of setting the "(" and ")"  as well as using "and" and "not"...

alex
Thursday, October 30, 2003

Show us the script, someone will help you figure it out.

It just drives me nuts; I've never been a good parentheses counter. It works best for me if I build the condition from from the inside out. one little chunk at a time: I start with one condition and see if that works, then I add another condition, and see if it works and so on.

Of course, I also imitate sombody elses condition that works, this is one from John C that I use every day. It has a "not," a couple of "ands," an "after" and a "before." it publishes all the "nonblog" articles for November, 2003.

{$ foreach x in (and(not (keyword_contains "(nonblogentry)"))(and(after 2003/10/31)(before 2003/12/01))) SortAscendBy .fileddate $}

tk
Thursday, October 30, 2003

Try
(and (after publishdate-3) (not (filename "suchandsuch")))

Ken McKinney
Thursday, October 30, 2003

It confuses me too.

Ken McKinney
Thursday, October 30, 2003

thank you for the suggestions!
let´s look at it step by step:

the top folder is "tasks".
it contains three subfolders:
- "open"
- "new"
- "closed"

In the top folder "tasks" is the article "index" that contains the condition i am working on here.  I want articles to be displayed that are in "open" AND "new". But i do not want the "index" itsself to be displayed:

So what i require is:
- articles in tasks/open
- and articles in tasks/new
- but not index.html in the folder tasks

i tried this, step by step:
- (all)
--> works fine.


- (folder "tasks/open")
--> works fine.


- (and(folder "tasks/open") (folder "tasks/new")) 
--> yields nothing! but no error either.


- (or(folder "tasks/open") (folder "tasks/new")) 
--> works fine.


now i actually need to exclude three files, because in each subfolder i have an article named "index.html"...

..also i want to exclude the subfolder "closed":


- (or (folder "tasks/open") (folder "tasks/new") not(filename "index.html")) 
--> yield articles of the entire site, does not work therefore.


- (or (folder "tasks/open") (folder "tasks/new")) (not(filename "index.html"))
--> yields Syntax Error: unexpected "("


-(not (filename "index.html"))
-->yield articles of the entire site, does not work therefore.

-(not (folder "tasks/closed"))
--> works fine

- (or (folder "tasks/open") (folder "tasks/new"))
(not (folder "tasks/closed"))
--> error: expected condition (\tasks\index:468)

-(and(not (folder "tasks/closed"))
(and(or (folder "tasks/open") (folder "tasks/new"))
--> error: expected condition (\tasks\index:468)

-(not (folder "tasks/closed")) (and(or (folder "tasks/open") (folder "tasks/new"))
--> error: expected condition (\tasks\index:468)

-(not (folder "aufgaben/closed") (folder "aufgaben/open"))
--> error: expected condition (\tasks\index:468)



...well i keep on, but as you see i could rather sit in front of a slot machine and might get more return on my time invested, rather than running through all possibilities. where is the logic here?

alex
Thursday, October 30, 2003

ok, i work around the problem in this way:

(and(folder "aufgaben/open")(after today))

what i then did to exclude all index articles in the subfolders is: i simply set the filed date before today, and so will never have to bother about them again.

I thus compromise on looking at each folder seperately and writing a condition for each seperately. Than i do not have to combine so much.

alex
Thursday, October 30, 2003

Hi Alex - I think you're looking for:

{$foreach x in (and (or (folder "tasks/open")(folder "tasks/new"))(not (filename "index"))) $}

Davy
Thursday, October 30, 2003

Davy has it right.  Didn't you ever use one of those reverse polish notation calculators in high school?  Isn't that how everyone does math :)

Michael H. Pryor
Thursday, October 30, 2003

I had an hp35.  I was going to say something about post-fix or reverse polish notation, but I thought it would date me.  Maybe Michael is over 40!

Its easier to do math with post fix, but its not easy to convince anyone it is until they 'get it!'

Joel Goldstick
Thursday, October 30, 2003

Hey! I'm under 40 and I do RPN, thank you very much! :-)

David Watts
Tuesday, November 11, 2003

*  Recent Topics

*  Fog Creek Home