This question about Using an extension: Answered

How to search form and formfields with dbquery

I'm tring yo search topics that match the following conditions: With %SEARCH{..}% i it like this:
%<nop>SEARCH{
    "form.name~'*FormularioDeOrganizacion' AND fields[name='Tipo' AND value~'*Cliente*']"
    nototal="on" 
    type="query"
 ....
}%

I'm tring to upgrade to DBQUERY for performance reasons, but i can't make it work. Pleanse some help:

Then i tried this like QuerySearch:
%DBQUERY{
    "form.name=~'*FormularioDeOrganizacion' AND fields[name='Tipo' AND value~'*Cliente*']"
and the result: ERROR: can't parse query "form.name=~'*FormularioDeOrganizacion' AND fields[name='Tipo' AND value~'*Cliente*']"

I tried this:
%DBQUERY{
    "form.name=~'*FormularioDeOrganizacion' and Tipo=~'*%URLPARAM{tipo}%']"
and the result is: ERROR: can't parse query "form.name=~'*FormularioDeOrganizacion' and Tipo=~'*']"

Searching only the form name works:
%DBQUERY{
    "form.name=~'*FormularioDeOrganizacion'"
and the result is the list of topics that has the form name "FormularioDeOrganizaciones".

-- JuanPabloGaviria - 03 May 2010

Some of your comments above suggest that you may be confusing QuerySearch with DBCachePlugin. Your first example reflects the QuerySearch syntax but the rest all reflect DBCachePlugin syntax.

That being said, if you want to use DBCachePlugin, this this:
%DBQUERY{"form.name =~ 'FormularioDeOrganizacion' AND Tipo = '%URLPARAM{"tipo" default="null"}%'" ...

I believe the error in your second DBQUERY example was the "*" before the URLPARAM tag. In my example, I also added a default value for the url param so that it would return something even if the url param isn't set.

-- LynnwoodBrown - 03 May 2010

Lynnwood,

Thanks for your immediately answer, it works.

finally, it looks like this:
%DBQUERY{
    "Tipo =~ '%URLPARAM{"tipo" default="null"}%' AND form.name =~ 'FormularioDeOrganizacion'"
....

-- JuanPabloGaviria - 03 May 2010

QuestionForm edit

Subject Using an extension
Extension DBCachePlugin
Version Foswiki 1.0.8
Status Answered
Topic revision: r4 - 05 May 2010, JuanPabloGaviria
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy