01166: Ability to Search Advanced Tables by Row

Summary: Ability to Search Advanced Tables by Row
Created: 2010-02-05 17:10
Status: Suspended
Category: Feature
From: Jeff
Assigned:
Priority:
Version: 2.2.0
OS: Windows Server 2003 /IIS/ 5.2.9-1

Description: I'm trying to create a very basic database application without using a database backend via searching a flat text file. So, I'm using TextExtract as my "query engine" and pointing it to a PmWiki page that is my "database". So far so good. However, here's what I'm up against, I'd like to use an advanced table on my "database" page. Because the (:cell:) tag requires a CR/LF at the end of the string, in essence, I'm putting all of by table "rows" actually into one column, with a repeating pattern. So using TextExtract functionality to search my line only returns the one field in the row. Now, I realize tht I probably should bit the bullet and learn some type of SQL, but I'm hoping that someone might point me to a combination of recipes which might give my end users that ability to easily add "rows" to a table, and the ability to search by row. Thanks!!*

I think it would be more convenient to implement this as a cookbook recipe rather than in the PmWiki core. --Petko February 06, 2010, at 02:40 AM

I just have this idea: it could be easier to search/list/edit if you use different pages for each record (line) of the table. Editing is much easier, regular PmWiki searching returns the full page, you can use sorting, categories etc. Something like this.

In each page which is an actual line in the table, or a record of the database, you have PageTextVariables:
Name:Petko
Occupation:PmWiki dev
Salary:100K+
(:desc:Longer multiline
description
:)
Then, in the table listing, use a custom PageList template:
(:pagelist group=MyDataGroup fmt=#mytemplate:)
[[#mytemplate]]
(:template first:)
(:table border=1:)
(:cellnr:)'''Name'''
(:cell:)'''Occupation'''
(:cell:)'''Salary'''
(:cell:)'''Notes'''
(:template each:)
(:cellnr:){=$:Name} ([[{=$FullName}?action=edit|edit record]])
(:cell:){=$:Occupation}
(:cell:){=$:Salary}
(:cell:){=$:desc}
(:template last:)
(:tableend:)
[[#mytemplateend]]

This way, you can include or exclude certain data fields, you can search for a string in the pages like (:pagelist Petko:) will find pages containing "Petko" and (:pagelist $:Occupation=*wiki*:) will find pages where the "Occupation" field contains "wiki". See PageLists and PageTextVariables for more information about all the features. We are using this in the Cookbook listings, see Cookbook:Images for example. --Petko February 06, 2010, at 02:40 AM