Forum OpenACS Development: Re: sorting with listbuilder when you need a URL variable

Collapse
Posted by Dave Bauer on
This looks OK
-filters {
position_id{}
}

You need to add an empty filter to get the variable passed in the URL. It might be that you need a space between position_id and the curly braces. It might be naming the filter "position_id{}"

Hi Dave I had this script and I don´t know how keep the variale value for each pagination or somethig like that, I´m new in tcl and any help is useful to me, by the way I´m sorry for my English.

request create -params {
sql1 -datatype text -optional
page -optional
}

#sql1 is a param that come from another tcl
#sql1 have the value of a simple sql query

if { ! [request is_valid] } { return }

list::create -name users \
-multirow users \
-key num_sec \
-page_size 10 \
-page_query { select num_sec from procadm.t_normas } \
-elements {
num_sec {
display_template {<table width="700" border="0"><tr><td width="96%" valign="top" align="justify">@users.desc_norma@&nbsp;@users.num_norma@&nbsp;de&nbsp;@users.anio_gac@
Número de Gaceta:&nbsp;@users.num_gaceta@
Autoridad:&nbsp;@users.desc_autoridad@
ítulo:&nbsp;@users.titulo@</td></tr></table> }
}
}

set query "select a.num_sec num_sec, num_gaceta,to_char(fecha_gaceta,'yyyy') anio_gac, norma, desc_norma, num_norma, titulo, cod_autoridad,desc_autoridad \
from procadm.t_normas a, procadm.t_tipo_norma b,procadm.t_autoridad c where \
a.norma=b.num_sec and \
a.cod_autoridad=c.num_sec"

append query " and " $sql1
append query " and "
append query "a.num_sec in ([template::list::page_get_ids -name users])"

db_multirow users users_query $query

on the page=1 show the result fine, but when I past to the another page for example page=2 display this error:

nsoracle.c:3904:ora_tcl_command: error in `OCIStmtExecute ()': ORA-00936: missing expression

SQL: select a.num_sec num_sec, num_gaceta,to_char(fecha_gaceta,'yyyy') anio_gac, norma, desc_norma, num_norma, titulo, cod_autoridad,desc_autoridad from procadm.t_normas a, procadm.t_tipo_norma b,procadm.t_autoridad c where a.norma=b.num_sec and a.cod_autoridad=c.num_sec and !>>>!and a.num_sec in ('916','917','918','919','921','922','925','926','927','928')

It´s looks like the value of sql1 not past to the next page