CodeCharge Studio
search Register Login  

Visual PHP Web Development

Visually Create Internationalized Web Applications, Web Reports, Calendars, and more.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 How To Modify Search Criteria Before Execute Select

Print topic Send  topic

Author Message
afrausto

Posts: 66
Posted: 11/21/2005, 5:13 PM

Hello,

I have a search form and grid on a single page. One of the options is s_Year which is a drop-menu displaying the following options: Show All Years, Year1, Year2, Year3,... By default, if s_Year is empty then it's set to the current year, which occurs when a user first visits the page.

I would like to be able to modify s_Year when it's equal to "Show All Years" before the select statement is executed, but I'm not sure what the proper coding is to accomplish this. My thought was to remove s_Year from the WHERE statement but still preserve the other search criteria.

Does anyone know how to accomplish this?

Thanks,
Albert
View profile  Send private message
Edd


Posts: 547
Posted: 11/21/2005, 5:35 PM

Albert,
You could try this

Go to the s_Year select right click it and change select properties default from empty to zero.

Go to the grid and get the s_Year paramater and change it's default to zero.
Change the select mode of the Grid from Table to SQL.
In the Selelct statement where it says
XXX.year like {s_Year}
change it to
( XXX.year = {s_Year} or {s_Year} = 0)

Edd

_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message
afrausto

Posts: 66
Posted: 11/23/2005, 3:27 PM

Edd,

Thanks for the suggestion, but it doesn't seem to work as I would like.

By default, when someone first comes to the page I want it to only pull up the records where Year is equal to Year(Date) or the current year. So if parameter s_Year is Empty it's set to Year(Date).

I would like to remove s_Year from WHERE of the SELECT statement if s_Year is equal to "Show All Years". That way all records will display, regardless of Year.

Thanks for your help.

Albert

View profile  Send private message
Edd


Posts: 547
Posted: 11/23/2005, 5:29 PM

Albert,
Set the default value s_Year in the grid and the search criteria to DatePart("yyyy",Date()) .

This means the first time they come in they get the search criteria saying the current year and the grid retrieving the current year.

When they change the search criteria to ALL (sends a zero) then the SQL as stated above will fire correctly.

Edd
_________________
Accepting and instigating change are life's challenges.

http://www.syntech.com.au
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

MS Access to Web

Convert MS Access to Web.
Join thousands of Web developers who build Web applications with minimal coding.

CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.