{{indexmenu_n>1}}
====== Example for filtering a contents from fields of a collection ======
\\
We are going to see how we can filter with some fields of a collection, another collection placed in contents mode (subform), to see the results of the query on the go.\\
\\
Also, we will se how we can manage everything with buttons, in this case graph type, without using the buttons by default, even to get out from the collection.\\
\\
Following is the image about what it is intended:\\
\\
{{ :b.-programacion:filtrar-contents-orenes.png?direct&300 |}}
\\
===== Steps to follow =====
\\
=== 1.- We define the Clients collection: ===
Codigo:Ruta:Codigo:Nombre:
\\
For the createFilter function, we can define it in a .vbs external file.\\
\\
function addCriteria(sOut,sField,sData)
if len(cstr(sData))>0 then
if len(sOut)>0 then
sOut=sOut+" AND "
end if
addCriteria=sOut+sField+" LIKE '%"+sData+"%'"
else
addCriteria=sOut
end if
end function
function createFilter()
dim sSearch
sSearch=""
sSearch=addCriteria(sSearch,"IDRUTA",this("MAP_IDRUTA"))
sSearch=addCriteria(sSearch,"MAP_CODCLI",this("MAP_CODCLIBUS"))
sSearch=addCriteria(sSearch,"MAP_NOMCLI",this("MAP_DESCCLIBUS"))
this.contents("ClientesRutas").filter=sSearch
end function
\\
=== 2.- We define the collections of paths and the contents of results: ===
\\
CodigoMatriculaBajaCod Cli:Nomb Cli:Pobl Cli:Dir Cli:Tfno Cli:Cod Ruta:Desc Ruta: