dynamo
Posts: 3
|
| Posted: 12/30/2009, 7:47 AM |
|
Hello everyone,
I'm new to codecharge and PHP in general, so I'm sorry if I have stupid questions...
I have 3 tables from which I obtain a grid, using a sql query.
I.e.
tableA (ID_tableA, data_1A, data_2A) // people
tableB (ID_tableB, data_1B,data_2B) // events
tableC (ID_tableC,ID_tableA_C,ID_tableB_C, dayofmonth) // month
Now I have build this query :
SELECT data_1A, data_2A, data_1B,data_2B, dayofmonth
FROM (tableC INNER JOIN tableB ON
ID_tableB = ID_tableB_C) INNER JOIN tableA ON
ID_tableA= ID_tableA_C
It works fine, showing all the events assigned to the people on tableA, during the day of the month as in tableC. The grid resulting from the query has about 310 records (10 people times 31 days). I've also a serach box, to filter out results. All works fine, except grid shows data starting from day1, while I would like to have it shows data of current day, by default. I have assigned condition WHERE with parameter value "dayofmonth=data('j')", and it does show current day, but it also cut off all the other days from the datasource, so that if you type any other day in the search box, it does not return any result (guess because the data from the query does not inclued the other days, being they filtered by the condition "where").
My questions are:
-How can I assign a default value to the field "dayofmonth", keeping other values too?
-About search box: if I search for a day, in "dayofmonth" search box, I have that day's events on the grid.Now I can search for another day, and I have those events.But how can I "reset" the grid to have all the days shown (which is the initial condition, before I search for a day). I mean like doing a " * " search.
- Why if I set "group" with "dayofmonth", it does not group all the results from the query by dayofmonth but by data1A ?
I.E.
I would explect in the grid:
Dayofmonth -- data1A(which is person's name)
1 --------------- Fred
1 --------------- Albert
1 --------------- Linda
.....................
2 --------------- Fred
2 --------------- Albert
2 --------------- Linda
while it actually displays this:
Dayofmonth -- data1A(which is person's name)
1 --------------- Fred
2 --------------- Fred
3 --------------- Fred
.....................
1 --------------- Albert
2 --------------- Albert
3 --------------- Albert
....................
Sorry about my bad english.
Thank you!
|
 |
 |
damian
Posts: 838
|
| Posted: 12/31/2009, 5:39 AM |
|
1. in your visual query builder look at properties of your where conditions... set the default value if parameter empty field... this is ignored if there is a value passed to it...
2. create a link or button that links back to the page itself but has Preserve Paramaters: None set
3. try the report builder - it has better sort, group options...
_________________
if you found this post useful take the time to help someone else.... :)
|
 |
 |
dynamo
Posts: 3
|
| Posted: 12/31/2009, 7:52 AM |
|
Quote damian:
1. in your visual query builder look at properties of your where conditions... set the default value if parameter empty field... this is ignored if there is a value passed to it...
Damian, thank you very much for your answer.
Happy New Year!
|
 |
 |
|