CodeCharge Studio
search Register Login  

Visual Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> Archive -> GotoCode Archive

 search between dates

Print topic Send  topic

Author Message
gd
Posted: 09/30/2002, 8:19 AM

CSS how do search between dates? I've seen mention of the tutorial which I've looked at but see the forest for the trees I guess.

thanks
gd
teufel
Posted: 09/30/2002, 5:44 PM

1) Create a search form with the date field you have in your db in it. Suppose this date is named 'my_date'.

2) The search form field name would probably be 's_my_date'

3) Insert a new line in this form and duplicate the date field by choosing 'copy' and 'paste' options with the right mouse button. When pasting the field CCS will probably alert you that you already have a field with that name and prompt you to change the name of the field. Rename it to something else, lets say 's_my_date_FINAL'

4) For the sake of clarity, I would probably also rename the first date field to something like 's_my_date_INITIAL'

--

5) Now in the grid form where the shown data will be filtered according to the search form:

- you should be ok with choosing as 'Source Type' = 'TABLE';
- on 'Data Source' click over the '...' in order to open the 'Data source Window' where you will specify the details of your SQL query. Choose your connection, set 'Data Source Type' also to be 'Table', and on 'Data Source' click the button 'Build Query' in order to build visually your query by selecting the tables' fields you wish in your result set and connecting tables as necessary to compose eventual joins.

6) Now you should compose the WHERE clause of your SQL statement, where you will inform that you want only dates comprised between the first parameter date and the second parameter date:

Click the '+' button and add two restrictions as below:

my_date | greater than or equal (>=) | '{s_my_date_INITIAL}' | And
my_date | less than or equal (<=) | '{s_my_date_FINAL}'

7) In order to check if your composed SQL is really doing what you want, add a BEFORE SHOW event at your *grid form* as below:

global $name_of_your_grid;

echo "sql clause: " . $name_of_your_grid->ds->SQL . "<br>";
echo "where clause: " . $name_of_your_grid->ds->Where . "<br>";
echo "order by clause: " . $name_of_your_grid->ds->Order . "<br>";

gd
Posted: 10/01/2002, 4:31 AM

Thanks teufel!
tim
Posted: 10/22/2002, 12:10 PM

Just wanted to say thanks. I did it in Cold Fusion and your solution works great.

   


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

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


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