[pmwiki-users] Filter and sort data with ZAP

The Editor editor at fast.st
Wed Nov 15 09:38:25 CST 2006


> > -----Message d'origine-----
> > De: pmwiki-users-bounces at pmichaud.com [mailto:pmwiki-users-bounces at pmichaud.com] De la part de The
> > Editor
> > Envoyé: 14 novembre 2006 17:49
> > À: pmwiki-users
> > Objet: Re: [pmwiki-users] Filter and sort data with ZAP
> >
> > 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


On 11/15/06, Pierre Racine <Pierre.Racine at sbf.ulaval.ca> wrote:
> Caveman,
>
> This is really near of what I had in mind. Can't we just store the records in one single page? One page per record seems cumbersome
> to me... There could be a sort of table that we store in a page and that we can filter/sort data from. Most databases we make do not
> have to be relational. A simple table is often sufficient to make most jobs.
>
> Pierre
>



I don't think so.  The reason is each field is a "page" text variable.
So you can only have one instance of "phone" on a page.  Any later
instances overwrite the earlier one.

You could use ZAP's logging feature to store a table of information on
a page, and I suppose you could number each the fields creatively so
that every value on the page has a separate value id1-phone= id2phone=
id3=.  And then you would need a very creative way to retrieve the
data, as pagelist functions also iterate through pages not lines of a
table.  But you could write a markup which reads the page, parses the
data and displays it anyway you want. But that's a lot of custom work.

that's not something I envision for ZAP.  It's really designed to
dovetail as closely as possible with how PmWiki works to maximize the
flexibility of both.  You're talking about developing something very
different from how PmWiki works..

You might be able to hire one of the programmers on the list to do the
work if you wish.  Or, my recommendation is stick with zap and
separate pages.  I think in the long run you will be glad you
did--because there are some incredible things you can do with PmWiki's
pagelists, and text variables.

Cheers
Caveman




More information about the pmwiki-users mailing list