attribute_filter ezselection

Author Message

ruud prein

Thursday 22 April 2004 3:32:55 am

Hi,

I am trying to use a fetch with an attribute_filter on an datatype ezselection with the following commands:
1) children=fetch('content','list',hash(parent_node_id,$node.node_id,'attribute_filter', array(array( 197, '=', 1)))}
2) children=fetch('content','list',hash(parent_node_id,$node.node_id,'attribute_filter', array('or',array( 197, '=', 1)))}
3) children=fetch('content','list',hash(parent_node_id,$node.node_id,'attribute_filter', array(array( 197, '=', 'string')))}
4) children=fetch('content','list',hash(parent_node_id,$node.node_id,'attribute_filter', array('or',array( 197, '=', 'string')))}

None are working at all, what am i missing here?

regards,

Ruud

---
groet,

Ruud

Eirik Alfstad Johansen

Thursday 22 April 2004 4:36:18 am

Hi ruud,

Try using attribute_filter without the surrounding quotes. Then probably alternative 2 or 4 will work.

Sincerely,

Eirik Johansen
http://www.netmaking.no

Sincerely,

Eirik Alfstad Johansen
http://www.netmaking.no/

ruud prein

Thursday 22 April 2004 11:49:31 am

sorry but
2 and 4 are not working either without the quotes
children=fetch('content','list',hash(parent_node_id,$node.node_id,attribute_filter,array('or',array( 197, '=', 1))))}

With the 1 I mean the 1st selection. Even if I replace the 1 with the string content it does not work. I get an empty array back.

any help welkom.

regards,

Ruud

---
groet,

Ruud

Paul Forsyth

Thursday 22 April 2004 11:59:20 am

Ruud,

Are you sure that the node is valid? Can you check $node.node_id has a value?

It might be worth looking at the attributes of your node to see what the value for 197 actually is. If it doesnt match you wont get anything back.

Try

{$node.data_map|attribute(show)}

paul

--
http://www.visionwt.com

ruud prein

Thursday 22 April 2004 12:09:42 pm

197 is an attribute of an ezselection type.
When I do the fetch without the attribute_filter, I get large array of all children. But with the filter the array is empty
the selection is filled with (single selection)
1: Raoul
2: Ruud
3: Wander

Do you have any ideas?

regards,

Ruud
--

---
groet,

Ruud

Paul Forsyth

Thursday 22 April 2004 12:16:39 pm

Im not 100% sure of what the ezselection datatype returns as a value. Can you try that {$node.data_map|attribute(show)} to see what the value is? What does it say? Remember to have debug on...

paul

--
http://www.visionwt.com

ruud prein

Thursday 22 April 2004 12:34:33 pm

The debug does not reveal anything

$node.node_id|attribute(show) just outputs:

Attribute Type Value

does not look good?

Ruud

---
groet,

Ruud

ruud prein

Thursday 22 April 2004 1:07:43 pm

If I use the attribute_filter on a ezstring it does work!! Kan I use * in the string? to catch series of string together??

But when I use the attribute_filter on ezselection I get nothing back?

any help welkom

regards,

Ruud
---

---
groet,

Ruud

Paul Forsyth

Thursday 22 April 2004 1:39:09 pm

When i tried it myself it works:

{let
children=fetch('content','list',hash(parent_node_id,2,'attribute_filter',array(array( 221, '=', 2))))}
{$children|attribute(show)}
{/let}

You have to make sure your attribute id is correct, and that the value you want to check exists.

This is using ez 3.3-4

paul

--
http://www.visionwt.com

ruud prein

Thursday 22 April 2004 1:48:29 pm

Thanx, just to make sure:
is the value 2 a value in the selection array? Or is 2 the 2nd option in the selection?

regards,

Ruud

---
groet,

Ruud

Paul Forsyth

Thursday 22 April 2004 2:06:52 pm

2 is the 2nd option. The ezselection datatype stores the selected option.

I tried this out locally and it works here.

Try again. I notice in your examples you had the wrong number of brackets.

paul

--
http://www.visionwt.com

ruud prein

Thursday 22 April 2004 2:08:27 pm

I have tried it. It works!! But only for selection 2 and 3. NOT for 1?? Is This a BUG?

regards

Ruud

---
groet,

Ruud

Paul Forsyth

Thursday 22 April 2004 2:33:07 pm

Had a quick look at the code and it does appear to be a bug.

For some reason the options start at 0, skip 1, then works as normal for 2, 3 and so on.

The initialisation of the ezselection datatype is wrong. I'll file a bug about it.

Hope you can work around this until the bug is fixed.

paul

--
http://www.visionwt.com

Paul Forsyth

Thursday 22 April 2004 2:37:22 pm

Filed it:

http://ez.no/community/bug_reports/ezselection_xml_is_initialised_with_wrong_id

Phew, that was a weird one!

paul

--
http://www.visionwt.com

ruud prein

Thursday 22 April 2004 3:37:36 pm

Thanx Paul!!

---
groet,

Ruud

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.