dodaniel
Posts: 43
|
| Posted: 07/07/2006, 1:23 PM |
|
I have a search criteria box for EndDate and have it initially set to display the current date. I would like my grid to only show me records that are equal to or greater than the EndDate in the criteria box when the page first loads. Right now, I have to click the Search button after the page first loads for the criteria to filter the records.
|
 |
 |
peterr
Posts: 5971
|
| Posted: 07/09/2006, 4:33 PM |
|
I think that you only need to specify the defaul value for your WHERE parameter in the data source of the grid (in Visual Query Builder).
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
dodaniel
Posts: 43
|
| Posted: 07/10/2006, 6:15 AM |
|
The EndDate is already included in the WHERE parameter but when the page first loads it shows all records (not the ones specified by the WHERE parameters). I have to click the Search button after the page first loads to filter the records with the default parameters.
|
 |
 |
WKempees
|
| Posted: 07/10/2006, 7:44 AM |
|
In your VQB's Where clause you state you have ten EndDate already filtered.
Check the type of parameter if it is URL, taking the EndDate from the search
form (default), then your Grid
on initial opening does not find the EndDate on the URL, that only appears
after Submit, and therefore displays ALL.
To obtain the required result set the Parameters default to an "illegal"
value like -1.
This will cater for the Grid initialy showing no records at all.
Also expand your Where clause (and I am only guessing now) to include the
Form parameter as well
Walter
|
|
|
 |
dodaniel
Posts: 43
|
| Posted: 07/10/2006, 8:20 AM |
|
The type of the parameter is URL. I tried changing it to something else like Form and it still shows all records.
When I changed the default value to -1 the page would not load, I got an error message that it was an invalid value.
????
|
 |
 |
WKempees
|
| Posted: 07/10/2006, 3:13 PM |
|
So my answer was a bit off.
Here's a better one:
Open VQB, open your Where, the one you described.
EndDate greater equal s_EndDate, type URL
The "Use Default Value if parameter is empty, should be checked
in the textbox enter : time()
click OK, publich and test.
Grid now display default as from today and will react to dates entered in
the Search.
You have set s_EndDate to display todays date as default, probably by
entering CurrentDate in the Default Value Property.
That will also trigger the grid to display correctly but only after Search
button is pressed.
The method above will set the default SQL.
Walter
|
|
|
 |
WKempees
|
| Posted: 07/10/2006, 5:14 PM |
|
I just realized you use ASP as your language.
time() is a PhP thing, so I think you need Date
How you can check? Open your Search/Grid press Code and find you search
forms date field being assigned it's default value
If Not FormSubmitted Then
If IsEmpty(s_date_from.Value) Then _
s_date_from.Value = Date
|
|
|
 |
peterr
Posts: 5971
|
| Posted: 07/10/2006, 9:16 PM |
|
Quote :The EndDate is already included in the WHERE parameter...
Fine, though I was referring to the Default value of that parameter. Simply enter the default value that you want to use, like #07/10/2006#, or a date function of your database, like Date().
_________________
Peter R.
YesSoftware Forums Moderator
For product support please visit http://support.yessoftware.com |
 |
 |
WKempees
|
| Posted: 07/11/2006, 3:15 AM |
|
Peterr,
As I did some testing to post a reasonably good answer, I found that
Database commands (MySQL in my case NOW() or CURRENT_DATE()) were not
accepted, language specifi (PhP) time() would give the desirable result.
Can you confirm this?
Quote :
Simply
enter the default value that you want to use, like #07/10/2006#, or a
date function of your database, like Date().
Walter
|
|
|
 |
dodaniel
Posts: 43
|
| Posted: 07/12/2006, 8:19 AM |
|
Adding the default date of Date() worked. Thanks for your help!!!
|
 |
 |
Shrirang
|
| Posted: 07/18/2006, 5:38 AM |
|
|
|
|
 |