Exemplo 13 – Busca ordenada na Base de Dados com seleção de campos

Formulário HTML

[codesyntax lang="html4strict" container="pre"]
<html>
<head><title>Busca ordenada na Base de Dados</title></head>
<body>
Permitir buscas ordenadas na base de dados
<form action="/cgi-bin/wxis.exe" method="post">
 <input type="Hidden" name="IsisScript" value="curso/script13.xis">
 <input type="text" name="expressao">
 No campo:
<select name="campo">
 <option value="AUT">AUTOR
 <option value="TIT">TITULO
 <option value="DATA">DATA
</select>
  No formato:
 <select name="formato">
 <option value="form1.pft">SIMPLES
 <option value="form2.pft">DETALHADO
 </select>
 <input type="submit" value="pesquisar">
</form>
</body>
</html>
[/codesyntax]


Script

[codesyntax lang="html4strict" container="pre"]

<IsisScript>
<section>
<display><pft>'Content-type: text/html'/#</pft></display>
 <field action="cgi" tag="2000">expressao</field>
 <field action="cgi" tag="2001">campo</field>
 <field action="cgi" tag="2002">formato</field>
<parm name="cipar">
<pft>
 'LIVRO.*=C:\bases\livro\livro.*'/
 'GIZMO.*=C:\bases\gizmo\asc2ans.*'/
 'FORM1.PFT=C:\bases\livro\form1.pft'/
 'FORM2.PFT=C:\bases\livro\form2.pft'/
</pft>
</parm>
<do task="search">
 <parm name="db">LIVRO</parm>
 <parm name="gizmo">GIZMO</parm>
 <parm name="expression"><pft>v2000</pft></parm>
<loop>
<field action="import" tag="2001">2001</field>
 <list action="load" type="list">
<pft>
'^k'
if v2001='AUT' then v100^a,v110^a, else
if v2001='TIT' then v245^a, else
 v260^c, fi, fi
 '^m'mfn,
</pft>
</list>
</loop>
</do>
<do task="list">
<field action="define" tag="199">Isis_Item</field>
<parm name="sort"><pft>v199^k</pft></parm>
<loop>
<field action="import" tag="2002">2002</field>
<do task="mfnrange">
 <parm name="db">LIVRO</parm>
 <parm name="from"><pft>v199^m</pft></parm>
 <parm name="count">1</parm>
<loop>
 <field action="import" tag="2002">2002</field>
<display>
<pft>
if v2002='form1.pft' then
 newline('<br>')@FORM1.PFT, else
 newline('<br>')@FORM2.PFT fi
 '<hr>'
</pft>
</display>
</loop>
</do>
</loop>
</do>
</section>
</IsisScript>
[/codesyntax]

Was this helpful?

0 / 0

Deixe uma resposta 0

Your email address will not be published. Required fields are marked *