[pmwiki-users] Filter and sort data with ZAP

The Editor editor at fast.st
Tue Nov 14 16:48:52 CST 2006


On 11/14/06, Pierre Racine <Pierre.Racine at sbf.ulaval.ca> wrote:
> Actually I want to simulate a database without a database (databases suck and this is the main reason I use PmWiki: no database). I
> want to store a bunch of records (users profiles), display all of them (sorted) in one page and display some of them (using filter
> and sort) in another page.
>
> I think I'm ready for an example...
>
> Pierre


No problem Pierre.  That's exactly what ZAP was created for and for
the same reasons. You will need the latest version of PmWiki (the
beta).

Here's what you do.  1) save each record to a different page in the
same group:  Profiles.Name1, Profiles.Name2, Profiles.Name3, etc.  You
can use any fields you want for these records.  Look at the Register
Snippet for a sample you could modify to your need. Leave off the
nextpage field to enter multiple records.

(Currently there's no way to import a bunch of records automatically).

2) to retrieve the data, do a pagelist.  Let's say you wanted a list
of all the phone numbers of members in Texas you might do something
like (not tested):

(:pagelist group=Profiles state=Texas fmt=#phonebystate:)

[[#phonebystate]]
(:if equal {{=$FullName}$:State} $$state:) {{=$FullName}$:Phone}
(:ifend:)
[[#phonebystateend]]

I should note, you can make this even more dynamic using some of the
tricks in the ZAP snippet Pagelist Fun.  Hope this helps.

Cheers,
Caveman




More information about the pmwiki-users mailing list