Forums / Setup & design / Greater than or equal operator for depth?

Greater than or equal operator for depth?

Author Message

James Packham

Tuesday 27 January 2004 7:59:22 am

Hi, can anyone tell me what the "greater than or equal" ( >= ) operator is? For example what would I have to replace gte with in the following fetch statement:

...
'depth', 3,
'depth_operator', 'gte',
...

Thanks,

James

Alex Jones

Tuesday 27 January 2004 8:20:20 am

I believe it is 'ge'.

Alex

Alex
[ bald_technologist on the IRC channel (irc.freenode.net): #eZpublish ]

<i>When in doubt, clear the cache.</i>

James Packham

Tuesday 27 January 2004 8:47:33 am

No... This doesn't seem to work... Thanks for the quick response though! :)

It seems that when I experiment with different possiblities (ge, gte) they get ignored, showing me the nodes at all depths (even if less than the depth I specify). I would guess that "grater than" and "greater than or equal to" have been not been fully implemented yet, or have a bug in ezp version 3.3-2. Has anyone else had any experiences they could share?

Regards,

James

Paul Forsyth

Tuesday 27 January 2004 8:57:12 am

You may have the context wrong. Look here for how to use 'ge':

http://ez.no/ez_publish/documentation/development/libraries/ez_template/operators/logical_handling

James Packham

Tuesday 27 January 2004 9:40:07 am

Thanks Paul, but I think those examples are all for working in an equation. I'm trying to work with a fetch statement, so I've no variable to compare it with.

According to the documentation this is posisble (depth defaults to le and I'm am currently using eq to fullfil my needs, though this hinders my future development plans) though it doesn't specify the operators which can be used. The docs I'm referring to are:

http://www.ez.no/ez_publish/documentation/customization/ez_publish_api_documentation/module_function_definition_content

<snip>

[depth]
description - The depth of subnodes to recurse in the subnode tree.
type - integer
required - false
default - 1
[depth_operator]
description - An operator that used to work out which noes to display.
type - string
required - false
default - 'le'

</snip>

Thanks for your help :)

Regards.

~James~

Hans Melis

Tuesday 27 January 2004 10:05:31 am

Hi James,

I just had a look at the source code, and the only supported depth operator is actually 'eq' (equals). This one results in "depth = $nodeDepth" in the SQL.

Anything else as depth operator results in "depth <= $nodeDepth" ('le' type comparison) in the SQL.

I don't know why the other operators haven't been implemented, but I can't see any reason why they can't be added either.

--
Hans

Hans
http://blog.hansmelis.be

James Packham

Wednesday 28 January 2004 2:57:00 am

Hmmm looking at the code I could create an extension to replace the existing ezcontentobjecttreenode.php but it isn't really something I have time to do right now and seeing as I already have a workaround I'll probably leave it for another time.

Thanks for your help though!

Regards,

~James~

David Eriksson

Tuesday 19 July 2005 5:28:04 am

Is this still an issue? I'm having the same problem, in that only eq seems to work, and gt behaving like a less than. (3.6.0)

Luckily I only need two depths, so a quick workaround is possible by using two fetches and a merge, but at the very least the new documentation should be fixed.

http://ez.no/doc/ez_publish/technical_manual/3_6/reference/modules/content/fetch_functions/tree

/David