Susan
|
| Posted: 11/20/2004, 9:35 PM |
|
I have a list box set up in the search grid with ListOfValues 1;Pending;2;Finished
In the grid I have {task_finish_date}
I would like the search to display in the grid,
tasks with a NULL {task_finish_date} which would be PENDING.
and tasks which IS NOT NULL{task_finish_date} which would be FINISHED
and no selection would display All tasks.
|
|
|
 |
Martin K
|
| Posted: 11/21/2004, 1:38 AM |
|
Hello.
In the grid you can make the Where like this:
Switsch Table to SQL
SELECT *
FROM YOURTABLE
WHERE task_finish_date {padding}
{padding} = + Parameter
Variable Name = padding
Parameter = CCGetPadding(CCGetFromGet("s_pending", 1))
Type: Expression
s_pending = the 1;Pending;2;Finished from the Search Listbox
A small Function write in the Common:
function CCGetPadding($padding)
{
if($padding == 1) {
$wherepadding = "IS NULL"; }
elseif($padding == 2) {
$wherepadding = "IS NOT NULL"; }
return $wherepadding;
}
Now you can search for an NULL task_finish_date or NOT NULL task_finish_date.
Sorry about my english,
by Martin
|
|
|
 |
Susan
|
| Posted: 11/21/2004, 12:56 PM |
|
MySQL said:
You have an error in your SQL syntax near '{padding} {padding} = + Parameter Variable Name = padding Parameter
|
|
|
 |
mrachow
Posts: 509
|
| Posted: 11/21/2004, 2:38 PM |
|
Hi Susan
I'm not completely sure what you have done.
What Martin had ment by
+ Parameter
use the dialog for Where clause and add a parameter with name padding (I suppose type string), assign it the functioncall CCGetPAdding(CCGet.... and set type to expression.
If you had done it this way I'm sorry .
Kindly regards,
Michael
_________________
Best regards,
Michael |
 |
 |
Susan
|
| Posted: 11/21/2004, 5:33 PM |
|
I haven't done it this way and I am a complete rookie so I am confused.
I was putting this directly into MyPHP
SELECT *
FROM YOURTABLE
WHERE task_finish_date {padding}
{padding} = + Parameter
Variable Name = padding
Parameter = CCGetPadding(CCGetFromGet("s_pending", 1))
Type: Expression
|
|
|
 |
Martin K
|
| Posted: 11/21/2004, 11:56 PM |
|
Hello.
I am thinking that this will be come.
In the Grid, where you select your Where you can switsch Table to SQL in a Listbox
Now you have a Textbox to write your own Select.
YOURTABLE = Your Select Table Name.
Write only this in the SQL:
#######################################
SELECT *
FROM YOURTABLE
WHERE task_finish_date {padding}
##########################################
Then, you can klick on the + Symbol under your write Code.
Hear we will get the s_pending from the URL that means 1;Pending;2;Finished and put it in a little funktion. This funktion is return the IS NULL OR IS NOT NULL Query you need for 1;Pending;2;Finished
Add Parameter: klick on the +
Variable Name = padding
Parameter = CCGetPadding(CCGetFromGet("s_pending", 1))
Type = Expression
Klick OK
Then you need a small Funktion "CCGetPadding" in your Common.php (global Files) that will switsch from IS NOT NULL to IS NULL.
function CCGetPadding($padding)
{
if($padding == 1) {
$wherepadding = "IS NULL"; }
elseif($padding == 2) {
$wherepadding = "IS NOT NULL"; }
return $wherepadding;
}
Now you can search for an NULL task_finish_date or NOT NULL task_finish_date.
Hear you can download a Sample with a Search and a Grid.
You can search for a NULL task_finish_date or NOT NULL task_finish_date. http://myminddesign.de/demo/pending.zip
Sorry about my english,
by Martin
|
|
|
 |
Susan
|
| Posted: 11/22/2004, 2:10 PM |
|
This is great it works now!!
However the display of ALL tasks when not searching isn't happening instead it defaults to only showing pending
|
|
|
 |
mrachow
Posts: 509
|
| Posted: 11/23/2004, 12:04 AM |
|
In Coponent Reference there is a paragraph Hiding Components. It's easy done.
Now when to do it?
The search form add GET parameters to the URL of the current page after pressing submit. So you can check for their values. If they are all empty hide the grid.
(What would be the next level is to check if a parameter is empty or if its not present at all. Not present at all is the state when search has not ever pressed)
Regards,
Michael
_________________
Best regards,
Michael |
 |
 |
Susan
|
| Posted: 11/23/2004, 12:49 PM |
|
Exactly I want not present at all to showin pending and finished.
Can you please be more specific on what I do and/or code that I need to add. With this change I have also lost connections to other tables ie. employees where it gets the information for user_id_assign_to.
|
|
|
 |
Susan
|
| Posted: 11/24/2004, 10:51 PM |
|
I figure I can live with not having the all option but I need help getting the lost connections to other tables ie. employees where it gets the information for user_id_assign_to. and making the search grid work for the other fields.
|
|
|
 |
Martin K
|
| Posted: 11/27/2004, 11:41 PM |
|
Hello.
What do you mean with: getting the lost connections to other tables?
You can get any Value on any time everywhere in the Side from the db eg. with the function CCDLookUP.
I am from Germany and my english is not so good. If you tell me more, i hope i can help you. 
by Martin
|
|
|
 |