Ezselection problems.

Author Message

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))))
}

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

eZ debug

Timing: Jan 18 2025 22:33:14
Script start
Timing: Jan 18 2025 22:33:14
Module start 'layout'
Timing: Jan 18 2025 22:33:14
Module start 'content'
Timing: Jan 18 2025 22:33:16
Module end 'content'
Timing: Jan 18 2025 22:33:16
Script end

Main resources:

Total runtime1.5479 sec
Peak memory usage4,096.0000 KB
Database Queries57

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0059 588.9453152.6094
Module start 'layout' 0.00590.0033 741.554739.4141
Module start 'content' 0.00921.5369 780.9688539.0781
Module end 'content' 1.54610.0017 1,320.046912.1875
Script end 1.5479  1,332.2344 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00320.2053160.0002
Check MTime0.00130.0857160.0001
Mysql Total
Database connection0.00060.040410.0006
Mysqli_queries1.492996.4443570.0262
Looping result0.00060.0408550.0000
Template Total1.512397.720.7561
Template load0.00210.133820.0010
Template processing1.510297.563720.7551
Template load and register function0.00010.009610.0001
states
state_id_array0.00180.118710.0018
state_identifier_array0.00210.136020.0011
Override
Cache load0.00170.1084240.0001
Sytem overhead
Fetch class attribute can translate value0.00070.042320.0003
Fetch class attribute name0.00120.078640.0003
XML
Image XML parsing0.00070.043220.0003
class_abstraction
Instantiating content class attribute0.00000.000640.0000
General
dbfile0.00090.0570160.0001
String conversion0.00000.000640.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
3content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
4content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
8content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
4content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 22
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs