[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erw-devel] Trying to understand how to incorporate relations into filte
From: |
erw-devel |
Subject: |
[Erw-devel] Trying to understand how to incorporate relations into filters |
Date: |
Wed, 6 Jul 2005 23:27:33 -0400 |
User-agent: |
Mutt/1.5.9i |
I have a table from a non-profit I'm working with that looks like this:
FirstName LastName Question1 Question2 Question3 Question4 (ad nauseum)
They are only interested in the 'Yes' responses so I had the idea of storing it
as follows:
yes.xml:
<?xml version="1.0"?>
<!DOCTYPE erl PUBLIC "-//DSI//DTD ERL V1.2//EN" "file://erl.dtd">
<erl id="yes" title="Yes - a relation test">
<ent id="members" label="MEMBERS" owner="true">
<attr id="FirstName" label="First Name" type="varchar" mand="false"/>
<attr id="LastName" label="Last Name" type="varchar" mand="false"/>
</ent>
<ent id="questions">
<attr id="question"/>
</ent>
<rel id="responses" label="Answers to questions">
<leg entref="members" upper="N" label="Said Yes to ..."/>
<leg entref="questions" upper="N" label="member"/>
</rel>
</erl>
I was attempting to use the existence of the relation as a filter. By looking
in the defs
file that gets generated I see a reference to 'responses_questions' that gets
created. I
thought perhaps this might do something (after not quite getting the
documentation on the
subject):
custom/members.php:
<?php
$D["members"]["display"]["fmtString"] = " %s, %s";
$D["members"]["display"]["field"] = array( "LastName", "FirstName" );
$D["members"]["filter"] = array();
$D["members"]["filter"]["LastName"]["type"] = t;
$D["members"]["filter"]["LastName"]["operator"] = "=";
$D["members"]["filter"]["LastName"]["label"] = "Last Name";
$D["members"]["filter"]["responses_questions"]["type"] = rN;
$D["members"]["filter"]["responses_questions"]["label"] = "Responses to
Questions";
?>
This does put 'Responses to questions' in the filter area, with the ability to
select
questions that are in the d/b, but it doesn't filter them. I saw a reference to
a
'trick' with IDs and nulls that seemed like it might apply, but I'm a bit lost
where
to try next. I'm certain the 'responses_questions' is not right, it should be
something
more like responses_0->questions_1.question or some such thing.
Should this work? Any suggestions how to grok the syntax? Do i look at the
table definitions
or the defs files to get the names to build up the path to the right level?
Thanks,
Alfred Werner
P.S. - table schemas here:
mysql> show tables;
+---------------+
| Tables_in_yes |
+---------------+
| members |
| questions |
| responses |
+---------------+
3 rows in set (0.00 sec)
mysql> desc members;
+--------------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------------+--------------+------+-----+---------+-------+
| id | int(11) | | PRI | 0 | |
| id_owner_usr | int(11) | YES | | NULL | |
| id_share_grp | int(11) | YES | | NULL | |
| FirstName | varchar(255) | YES | | NULL | |
| LastName | varchar(255) | YES | | NULL | |
+--------------+--------------+------+-----+---------+-------+
5 rows in set (0.00 sec)
mysql> desc questions;
+----------+--------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+----------+--------------+------+-----+---------+-------+
| id | int(11) | | PRI | 0 | |
| question | varchar(255) | YES | | NULL | |
+----------+--------------+------+-----+---------+-------+
2 rows in set (0.00 sec)
mysql> desc responses;
+---------------+---------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+---------------+---------+------+-----+---------+-------+
| id | int(11) | | PRI | 0 | |
| id0_members | int(11) | | MUL | 0 | |
| id1_questions | int(11) | | | 0 | |
+---------------+---------+------+-----+---------+-------+
- [Erw-devel] Trying to understand how to incorporate relations into filters,
erw-devel <=