This topic is locked

phprunner grouping

1/18/2009 3:37:25 PM
PHPRunner General questions
N
nickditrolio author

I need two tables on the same page with the following sql statments:

Table 1: Select name, pts, wins,losses from standings where div=1, order by pts, wins

Table 2: select name, pts, wins,losses from standings where div=2, order by pts, wins
How do you set this up?

Also, in another table, I want to search by a pull down box called week_list. This is the sql statement for the table:

Select name, pick1, pick2, pick3 from Picks where week= Session(week)

The Session (week) variable is set using a pulldown box from the top of the table.
Thanks.

hichem 1/19/2009

I need two tables on the same page with the following sql statments:

Table 1: Select name, pts, wins,losses from standings where div=1, order by pts, wins

Table 2: select name, pts, wins,losses from standings where div=2, order by pts, wins
How do you set this up?

Also, in another table, I want to search by a pull down box called week_list. This is the sql statement for the table:

Select name, pick1, pick2, pick3 from Picks where week= Session(week)

The Session (week) variable is set using a pulldown box from the top of the table.
Thanks.


I am not sure about a better way to get 2 tables on one page other than creating the 2 views in PHPR then create another page where you copy/paste the 2 reports inside it from the first 2 tables in the visual editor. I have done this with 2 charts and it's the closest you can get to a dashboard type of page.

Not sure if the search would apply to the 2 tables though or if you can restrict it to only 1 table.

Hope this helps

N
nickditrolio author 1/19/2009

I need two tables on the same page with the following sql statments:

Table 1: Select name, pts, wins,losses from standings where div=1, order by pts, wins

Table 2: select name, pts, wins,losses from standings where div=2, order by pts, wins
Hitch, If I forgot about separating the two tables and just put them in one, I need to at least group them by divisions. Is this how groups work? Can you direct me to how I would set it up? If I click on 'Group by', it only gives me MIN, MAX, etc..I just want to simply group them by division(div).DIV is a name in my table that is an integer. div=1 or div=2
The search question was for another table. Here's the sql statement:

Select name, pick1, pick2, pick3 from Picks where week= Session(week)
The Session (week) variable is set using a pulldown box from the top of the table.

If I use a search, it gives me a search for any field. I just want a pull down of the week(in table named week_list) for the user to pick from. Doesn't seem like it's easy to do.

I know the sql statements I need to get my project going. Can't I just insert the sql statements somewhere using session variables?
Thanks.[/quote]
I am not sure about a better way to get 2 tables on one page other than creating the 2 views in PHPR then create another page where you copy/paste the 2 reports inside it from the first 2 tables in the visual editor. I have done this with 2 charts and it's the closest you can get to a dashboard type of page.

Not sure if the search would apply to the 2 tables though or if you can restrict it to only 1 table.

Hope this helps

[/quote]

hichem 1/19/2009

[quote name='Nick D' date='Jan 19 2009, 09:00 PM' post='36933']

I need two tables on the same page with the following sql statments:

Table 1: Select name, pts, wins,losses from standings where div=1, order by pts, wins

Table 2: select name, pts, wins,losses from standings where div=2, order by pts, wins
Hitch, If I forgot about separating the two tables and just put them in one, I need to at least group them by divisions. Is this how groups work? Can you direct me to how I would set it up? If I click on 'Group by', it only gives me MIN, MAX, etc..I just want to simply group them by division(div).DIV is a name in my table that is an integer. div=1 or div=2
The search question was for another table. Here's the sql statement:

Select name, pick1, pick2, pick3 from Picks where week= Session(week)
The Session (week) variable is set using a pulldown box from the top of the table.

If I use a search, it gives me a search for any field. I just want a pull down of the week(in table named week_list) for the user to pick from. Doesn't seem like it's easy to do.

I know the sql statements I need to get my project going. Can't I just insert the sql statements somewhere using session variables?
You mention you have 2 tables, this is how you could get all the records in one table

select

t1.name, t1.pts, t1.wins, t1.losses, t2.name, t2.pts, t2.wins, t2.losses from standings t1, standings t1, standings2 t2

where

t1.div=1

and

t2.div=2

order by t1.pts, t1.wins[/color]
However I notice that you seem to have in fact only 1 table (you cannot have 2 tables with same name in one schema), so the grouping should be easy.
select

name, div, pts, wins, losses

from standings

group by div

order by pts, wins
(no need to specify where div =1 or div =2, the group function does that for you)
As for your second question:

If I use a search, it gives me a search for any field. I just want a pull down of the week(in table named week_list) for the user to pick from. Doesn't seem like it's easy to do.

Well I am new to PHPRunner and this is rather an easy one <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36937&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />

Simply go to the visual editor, click on properties of the search field you would like to display the weeks, (on the search page). When you open the properties window, select table lookup and sepect your table then your week field and select drop down list (you will find this in the table lookup on properties window). After that just build your project and it shoudl allow you to select the weeks from a drop down menu, easy <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=36937&image=2&table=forumreplies' class='bbc_emoticon' alt=':)' />
Hope this helps (well at least helps Jane and Sergey not to have to answer everything themselves)

PHPR rocks!

hichem 1/19/2009

.

J
Jane 1/20/2009

Hi,
please check following thread:

http://www.asprunner.com/forums/index.php?showtopic=6221
To add dropdown use custom event (Insert PHP code snippet option on the Visual Editor tab).

Select values from database and form simple dropdown with links to the list page with search parameters.

N
nickditrolio author 1/25/2009

I'm sorry, but I still don't get it and it should be simple..can I explain it again? my table name is picks:

fields include: name, week, pick1, pick2, pick3, totalpts

To show all picks from all users, I made a custom view from picks and the sql statement should be:

select name, week, pick1, pick2, pick3, totalpts from picks where week = session["week"]

I want session["week"] to be a drop down box that includes a table lookup from a table called week_list
To Enter picks, I made a custom view called Enter Picks and the sql statement should be:

Select name, week, pick1, pick2, pick3 from picks where name=session["name"] and the week should come from a drop down box that includes the week_list table. The one caveat is that I only want one entry per week and only the user can change the user's entries only. I can't get it to work properly. thanks for the help.

Nick

J
Jane 1/26/2009

Nick,
have you created dropdown in the custom event?

Also you can publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with

detailed description of what you're doing.