Fog Creek Software
Discussion Board




Knowledge Base
Documentation
Terry's Tips
Darren's Tips

Parenthesis mess

Every time I try to write any relatively complicated condition CD reports syntax errors. It looks like any time i add new condition, number of required parenthesis grows at least twice.

So my question begins: can you share some complicated condition strigns you wrote? It can be pretty helpful not to write new conditions from scrath, but to copy and edit.

Vlad V. Golovach
Monday, December 22, 2003

More complicated than this from the Help text?

{$ foreach x in (and (thisFolder) (not (thisArticle))) $}

Beware copying straight from Help into CD in Normal View. Formatting gets carried over and screws your script.

Mike Osborne
Tuesday, December 30, 2003

If you copy a script from help, paste without formatting (Alt-E-W).

The parenthesis drive me nuts too. I don't do it often enough to get in a groove. I try to start with one that works. If I can't find one, I try to build the conditions one piece at a time. Once I get the simplest one to work, I add another, test, and so on.

tk
Tuesday, December 30, 2003

TK's suggestion to build conditions iteratively is a good one.

Another trick I use is to build the condition in HTML mode, putting each condition on a new line and using indenting to format it so I can see what's going on. Once I've got the condition working how I want, I go back and remove the whitespace to get the CityScript all back to one line.

Darren Collins
Wednesday, December 31, 2003

*  Recent Topics

*  Fog Creek Home