This topic is locked
[SOLVED]

 List Box Filtering

7/12/2010 1:01:25 PM
PHPRunner General questions
P
procheck author

Hi,
I think my problem is a simple one to many of you but everything I've found shows

a more complex solution than I belive I need for my situation.
Currently when I list the TeamName page, only the teams which

belong to that PoolID is displayed. This is correct.
I'm trying to create a List Box for the ADD page which only shows the UserNames of

that PoolID currenlty displayed but my drop down box shows every member from

every PoolID.
For the UserName(TeamName) properties in the Lookup Table (Edit As), I've set the

Table as Member, Link Field as PoolID, Display Field as UserName, Order by as PoolID.
This displays every member from every PoolID. Can someone help with this?

Thanks!
Table Member

****

GroupID

PoolID

UserName

Password
Table TeamName

**

UserName

PoolID

TeamName

lewisgr 7/12/2010

Set the "This drop down is dependent on..."
PoolID

and

PoolID
Here's link that gives you more details:

http://xlinesoft.com/phprunner/docs/lookup_wizard.htm

P
procheck author 7/12/2010

I did find that section which you pointed out and I had previously tried your suggestions.

When I click on "Test it", I get the following message which I have no idea what it means.


I tried building it anyway but all of the members were still displayed. I don't know

if it just ignored my changes.
One thing which I should point out is that I'm trying to change a custom view of table TeamName.
Here are my settings:


Thanks

A
ann 7/13/2010

Hi,
it seems that your settings are wrong.

Check this tutorial ('How to setup dependent dropdown boxes on Edit/Add pages'):

http://xlinesoft.com/phprunner/php-database.htm

If 'Test it' don't work it won't work in generated project.

P
procheck author 7/13/2010



Hi,
it seems that your settings are wrong.

Check this tutorial ('How to setup dependent dropdown boxes on Edit/Add pages'):

http://xlinesoft.com/phprunner/php-database.htm

If 'Test it' don't work it won't work in generated project.


I saw the video before and I understand that one list box is dependent on the other.

What I'm trying to do is only display the users from "Table TeamName" based on the

PoolID of the logged in user. I think I was wrong when I tried to use the "Table Member".
So if UserA logs in with a PoolID of "PoolA", then I only want to display the users from

PoolA.
I think that I may need to use the Where clause but again I'm displaying all of the users

with different PoolID (ie PoolA, PoolB, PoolC are being displayed). I only want to display PoolA.
In the "After Successful Login" event I inserted this:

$_SESSION["PoolID"] = $data["PoolID"];
In the Table Teamname in the "Before record Added" event I inserted this code:

$_SESSION["TeamPoolID"] = $values["PoolID"];
In the WHERE Clause of the Lookup Table(Edit As), I added this:

$_SESSION["TeamPoolID"] == $_SESSION["PoolID"];
The above does not work. Any suggestions?
Thanks
Al

A
ann 7/14/2010

Al,
to display only the users from the current Pool add the following code to the Where clause on the Edit as settings dialog on the Visual Editor tab:

"TeamPoolID=".$_SESSION["PoolID"]



where session variable 'PoolID' is filled in the After successful login event on the Events tab:

$_SESSION["PoolID"] = $data["PoolID"];
P
procheck author 7/14/2010



Al,
to display only the users from the current Pool add the following code to the Where clause on the Edit as settings dialog on the Visual Editor tab:

"TeamPoolID=".$_SESSION["PoolID"]



where session variable 'PoolID' is filled in the After successful login event on the Events tab:

$_SESSION["PoolID"] = $data["PoolID"];



Hi Ann,
I don't know what I'm doing wrong but I did as you suggested and I get the following error:
Unknown column 'TeamPoolID' in 'where clause'

SELECT UserName FROM member WHERE PoolID = 'Chumbley0' and (TeamPoolID=Chumbley)
In my test file. Chumbley0 is the UserName. Other usernames would be Chumbley1, Chumbley2 etc..

The PoolID is Chumbley
I also tried changing "TeamPoolID=".$_SESSION["PoolID"] to "PoolID=".$_SESSION["PoolID"]

in the Where clause and also in - the Table Teamname in the "Before record Added" event.

$_SESSION["PoolID"] = $values["PoolID"];
The result was similar:
Unknown column 'Chumbley' in 'where clause'

SELECT UserName FROM member WHERE PoolID = 'Chumbley0' and (PoolID=Chumbley)
If you need more information, please let me know

Thanks
Al

Sergey Kornilov admin 7/15/2010

Al,
use the following:

"PoolID='".$_SESSION["PoolID"] . "'"
P
procheck author 7/15/2010

Ann/Sergey,
This worked. Now why didn't I think of that.
Thanks very much for your help!
Al