Trevor Clowry
|
Wednesday 20 April 2005 8:35:37 am
Hi there, I had a piece of code that worked perfectly.
date=currentdate()
priority_events=fetch('content','list',hash(parent_node_id,140,attribute_filter,array('and',
array('priority_event/expiry_date','<=',$date))
,sort_by,array(array('attribute',false(),257))))
}
I added a ezselection datatype to the priority_event content class and set some of the classes to contian different values. Then i modified the code to fetch the following.
date=currentdate()
priority_events=fetch('content','list',hash(parent_node_id,140,attribute_filter,array('and',
array('priority_event/expiry_date','<=',$date),array('priority_event/event_type','=',"AGM"))
,sort_by,array(array('attribute',false(),257))))
}
However this returns no values. Can anyone see what i am doing wrong?
Thanks in advance trev
|
Craig Hirsch
|
Wednesday 20 April 2005 12:55:07 pm
I believe the ezselection datatype stores just the NUMBER of your selection. In other words, 0 if you select the first option on the admin side, 1 if you select the second, and so on. From some code of mine, in which I used a selection datatype to record the specific image alias I wanted to apply in a given case:
{* Determine user-selected image alias to apply, 300px is default *}
{switch match=$node.data_map.primary_product_image_width.content.0}
{case match=0}{set scope=root product_image_alias='300px'}{/case}
{case match=1}{set scope=root product_image_alias='200px'}{/case}
{case match=2}{set scope=root product_image_alias='400px'}{/case}
{case match=3}{set scope=root product_image_alias='500px'}{/case}
{case match=4}{set scope=root product_image_alias='fullwidth'}{/case}
{case}{set scope=root product_image_alias='300px'}{/case}
{/switch}
As you can see, since it's a SINGLE selection, we access the value by referencing the 0 element in the array. If it were a multiple selection, there might be more elements in the array.
--
chirsch{AT}gmail{d.t}com
|
Trevor Clowry
|
Thursday 21 April 2005 2:24:07 am
Thanks Craig.
I got it working straight away. Here's the fetch code that i used just in case anyone else has the same problem.
date=currentdate()
priority_events=fetch('content','list',hash(parent_node_id,140,attribute_filter,array('and',
array('priority_event/expiry_date','<=',$date)
,array('priority_event/event_type','=','3'))
,sort_by,array(array('attribute',false(),257))))
}
|