Home > Contents > Index >
Template Tags TOC | Alpha TOC | Tag Family TOC | Purpose TOC | Annotated TOC | Index
assetset:getmultiplevalues
Scatters attribute values from several attributes (and potentially more than one product) into several specified lists. This tag executes a single SQL query in order to perform its function. (It is therefore much more efficient than using
assetset:getattributevalues
repeatedly for multiple attribute values.)Syntax
<assetset:getmultiplevalues name="assetset name" [list="sort list name"] [byasset="true|false
"] [immediateonly="true|false
"] prefix="prefix"/>Parameters
name
(required)- Input parameter. Name of the assetset object.
list
(optional)- Input parameter (see as output, below). List of attribute names to scatter. This list has three columns:
attributetypename
- The attribute asset type name.attributename
- The attribute name.direction
- Legal values include:none
,ascending
, ordescending
.If this list is not specified, nested
assetset:sortlistentry
tags must be used instead.
byasset
(optional)- Input parameter. Boolean value indicating whether to scatter a different instance of each attribute for each individual asset in the assetset (
true
), or to group all the attribute values for all assets together into one list per attribute (false
). The default isfalse
.
immediateonly
(optional)- Input parameter. Boolean value indicating whether to scatter inherited attribute values or not. A
false
value indicates that inherited values should be scattered (the default).
prefix
(required)- Input parameter. Starting part of the list names that this method creates.
Description
If
byasset
isfalse
, creates a set of lists with the names:prefix:attrname
. Ifbyasset
istrue
, creates a set of lists with the names:prefix:assetid:attrname
.This tag is highly efficient in that it executes a single query to retrieve all values. We therefore recommend using this tag wherever possible instead of multiple instances of
assetset:getattributevalues
.We recommend using
assetset:getmultiplevalues
when the goal is to display a fixed-format table of assets, or to obtain many attributes of a single asset (such as for a product detail page).
assetset:getmultiplevalues
has the following limitations:
- Only non-foreign attributes can be scattered.
- Text-type attributes cannot be scattered.
- No lists will be created or destroyed for any attributes which would return no values.
NOTE: This tag also causes dependencies to be recorded for all assets that contribute to the returned lists, or if this assetset object is not an enumerated one, then the equivalent of
render:unknowndeps
will be performed.
The ordering values Note
ascending
anddescending
operate in the reverse manner from what might be logically expected. Therefore, ifascending
order is specified, the ordinally lowest value will occur last in the result list.Example
This example reads two attribute values from the assetset object
myassetset
, "lumens
" and "bulbsize
". Since thebyasset
attribute is not specified, the result will be two lists, one for each attribute:ValueList:lumens
andValueList:bulbsize
.
<listobject:create name="mylistobject" columns="attributetypename,attributename,direction"/> <listobject:addrow name="mylistobject">
<listobject:argument name="attributetypename" value="PAttributes"/> <listobject:argument name="attributename" value="bulbsize"/> <listobject:argument name="direction" value="descending"/></listobject:addrow> <listobject:addrow name="mylistobject">
<listobject:argument name="attributetypename" value="PAttributes"/> <listobject:argument name="attributename" value="lumens"/> <listobject:argument name="direction" value="ascending"/></listobject:addrow> <listobject:tolist name="mylistobject" listvarname="listout"/> <!-- Make sure the output lists are precreated and are empty, in case there are no values --> <listobject:create name="mylistobject" columns="value"/> <listobject:tolist name="mylistobject" listvarname="ValueList:lumens"/> <listobject:tolist name="mylistobject" listvarname="ValueList:bulbsize"/> <!-- Apply the sort list to an assetset and create output lists, where data exists --> <assetset:getmultiplevalues name="myassetset" prefix="ValueList" list="listout" immediateonly="false" byasset="true"/>Alternately,
if you expect multiple assets to be returned then set byasset=true.<assetset:getmultiplevalues name="myassetset" prefix="ValueList" immediateonly="false" byasset="true"> <assetset:sortlistentry attributetypename="PAttributes" attributename="bulbsize"/> <assetset:sortlistentry attributetypename="PAttributes" attributename="lumens" direction="ascending"/> </assetset:getmultiplevalues>See Also
assetset:getattributevalues
assetset:sortlistentry
listobject:create
listobject:addrow
listobject:tolist
Home > Contents > Index > ![]()
FatWire JSP Tag Reference
Copyright 2005,2006,2007 by FatWire Software
All rights reserved.