[ic] [query] in a [loop]
Ton Verhagen
interchange-users@icdevgroup.org
Tue May 6 08:46:01 2003
Quoting Xavier GILLET <xavier.gillet.perso@wanadoo.fr>
> > > > > Hello,
> > > > >
> > > > > Did someone tried something like this ?
> > > > >
> > > > [loop prefix=fichiers arg="a01b02c01 a01b02c02 a01b02c03"]
> > > > [set foo][fichiers-code][/set]
> > > > [query
> > > > type=list
> > > > ml=1000
> > > > sql="select actual_status from [scratch foo] where
> > > > posted_by = '[data session username]'
> > > > and
> > > > initial_status = 'confirmee'
> > > > "]
> > > >
> > > > > It seems not possible to execute a [query] in a [loop].
> > > > > Any idea ??
> > > >
> > > > Try with a scratch...
> > > >
> > > > Rene
> > >
> > >
> > > It seems the problem come from the [query] inside the [loop].
> > > I tried to set a [scratch] value, but it's the same.
> >
> > Firstly, I think it should be:
> >
> > [loop prefix=fichiers list="a01b02c01 a01b02c02 a01b02c03"]
> >
> > Secondly, [set] does not interpolate. Since you are only using the scratch
> > in the page, I suggest you use [tmp]:
> >
> > [loop prefix=fichiers list="a01b02c01 a01b02c02 a01b02c03"]
> > [tmp foo][fichiers-code][/tmp]
> > [query
> > type=list
> > ml=1000
> > sql="select actual_status from [scratch foo] where
> > posted_by = '[data session username]'
> > and
> > initial_status = 'confirmee'
> > "]
> >
>
>Still not working.
>
>[loop prefix=fichiers list="a01b02c01 a01b02c02 a01b02c03"]
> [seti foo][fichiers-code][/seti]
>[scratch foo]<br>
> [query
> type=list
> ml=1000
> sql="select actual_status from [scratch foo] where
> posted_by = '[data session username]'
> and
> initial_status = 'confirmee'
> "]
> [list]
>
> [/list]
>[/query]
>[/loop]
>
>This loop return just this :
>[fichiers-code]
>
>The code is supposed to return :
>a01b02c01
>a01b02c02
>a01b02c03
Xavier, I think that you should try the following construct (worked for me):
[loop prefix=fichiers list=""a01b02c01 a01b02c02 a01b02c03""]
[fichiers-code]<br>
[query
prefix=sql
type=list
ml=1000
sql="select actual_status from [fichiers-code] where
posted_by = '[data session username]'
and
initial_status = 'confirmee'
"]
[sql-list]
line: [sql-increment] -- [sql-param actual_status]
[/sql-list]
[/query]
[/loop]
I assume that a01b02c01 a01b02c02 a01b02c03 are valid tables.
Please note the 'prefix' in the query tag.
Good luck!
Best regards,
Ton
--
Alamerce Nederland --- Cornerstone of eBusiness
Phone +31-40-2374381 info@alamerce.nl http://www.alamerce.nl
eCommerce Solutions -- Consulting -- Website & Interchange Hosting