[pmwiki-users] DataQuery and DataPlates

Ben Stallings ben at interdependentweb.com
Sun Feb 17 13:27:06 CST 2008


This conversation is more appropriate for the pmwiki-devel list, but 
since Hans posted to pmwiki-users I'll reply in kind.  Newbies please 
disregard.  :-)

Hans wrote:
> I was encouraged by your answer in thread "MySQL and Notify?"
> to see how Fox can be used with DataQuery.
> 
> I ended up starting a modified DataPlates script for Fox, lets call it
> FoxDataPlates.

This will complicate your efforts... if I were you I would see if you 
can get all the functionality of DataQuery working with Fox first, 
before trying to adapt DataPlates.  More on that below.  I'll rearrange 
your questions so that the answers make more sense:

 > 4. On page DataQuery.DataQuery what shall the first form do exactly?
 >    (Checking queries to be used)
 > 5. On the same page I can now create a new query 'New' (opening a new
 >    page DataQuery.New), but after clicking Save I seem to have it
 >    saved, but then trying to create a new page in the New query group
 >    results in a normal page edit, and the page is not in the database
 >    pagestore, but in wiki.d.
 > 6. I used phpMyAdmin to create the test db. But it shows only one
 >    record if I browse the one table in the db. So perhaps I missed out
 >    something in the setup?

New queries are disabled by default, and must be manually enabled by 
listing them in a page-text variable on the DataQuery.QueriesToUse page.
  http://workscited.net/dataquery/Main/SpecifyTheQueriesToUse
Until you enable a query, that page group will behave like ordinary wiki 
pages, and records you add will not get added to the database.

DataPlates creates a ZAP form on the DataQuery.DataQuery page that 
allows you to set that variable with checkboxes rather than editing it 
manually.
  http://workscited.net/dataplates/Main/StatusScreen

> 1. I can create  new pages in the "query" group, and edit existing ones.
>    But when I first save a new page, the fields and contents are shown,
>    but also an error message at the bottom, like:
> 
>        The page "Address.2" doesn't exist. (Create Address.2)
> 
>    Clearly the page was created, and reloading the page will show it just
>    fine. So why this error?

I'm not sure I understand, but it sounds like there's something wrong 
with the DataStore::exists() function.  If you can send me a link to the 
site where I can try it out, I might have a better suggestion.

> 2. It is also peculiar how the first field in the table behaves:
>    If I fail to enter anything in this first field when creating a
>    page, then the page shows blank. If I enter something the page
>    shows fine, but if I go to the query HomePage and look at the list,
>    the first column is shown empty (even though there are values).
>    What is going on here?

Is the first field the key field of the table?  If so, that's your 
problem!  And if you don't specify a key, DataQuery uses the first one 
by default.

> 3. I am having a tough time figuring out the code for the (group)
>    EditForm. With code like
> 
>           "(:input text $name '{*\$:$name}' :) "
> 
>    the {*\$:$name} does not get resolved to the value of the ptv field.
> 
>    I had to add an array to get the ptvs :
> 
>       $ptv = DQReadPageTextVars('$DQgroup.$DQname');
> 
>    and then to get the values into the input fields use
> 
>        "(:input text $name '{$ptv[$name]}' :) "
> 
>    I don't know if this will lead to other problem, or will work with all
>    input controls.

Hm, that's an awkward solution, and it will be problematic when you edit 
the EditForm page in the wiki and save it, because blank values ('') 
will get saved in place of the PTVs.  I don't know what's wrong with the 
code... does it look OK -- '{*$:name}' -- when you edit the EditForm?

Thanks for taking this on, Hans!!  --Ben S.




More information about the pmwiki-users mailing list