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 for the latest date

Print topic Send  topic

Author Message
Peter Brezansky
Posted: 04/02/2003, 10:10 AM

hello, a have a problem, which I can't work out. (CCS 2.0, php4, mysql)

I have a search form and a grid for the result to display.

By selecting a check-box in the search form, I would like to get those data in the grid which has the latest date from a field "latest_date" in my database with the format yyyy-mm-dd .

how can I manage this? who can help me?

greetings
peter
B
Posted: 04/03/2003, 3:35 AM

I am trying to do something similar...I have a field startdate and I want to list all records that are for the last 45 days from that date...I can't seem to get the query correct and can only get all records to display...would be great to get this to work correctly...thanks!
Peter Brezansky
Posted: 04/04/2003, 2:02 PM

no ideas around? can nobody help?

peter
DaveRexel
Posted: 04/04/2003, 3:02 PM

The BETWEEN ... AND operator selects a range of data between two values. These values can be numbers, text, or dates.

SELECT column_name FROM table_name
WHERE column_name
BETWEEN value1 AND value2

more info at
http://www.w3schools.com/sql/sql_between.asp

Dave
Peter Brezansky
Posted: 04/06/2003, 4:06 PM

Thanks Dave for your reply,

I understand how to get a range of data bewtween two values with BETWEEN ... AND if I know the values, but how can I get a certain value (the latest date) from a variable (just the right one from many values) in a database-field?

and how can I search for it in a search-form to get the right data in a grid-form?

thanks for further help
peter
RonB
Posted: 04/07/2003, 5:55 AM

Peter:

select max(date_field) from table?

B:

SELECT * FROM table WHERE date_field > date_sub( date_field, INTERVAL 45 DAY )

Ron
RonB
Posted: 04/07/2003, 6:22 AM

Sorry if you meant to set the startdate from a parameter it should look like this:

SELECT * FROM table WHERE date_field > date_sub( {startdate}, INTERVAL 45 DAY )
in the querywizzard set the parameter startdate.

if you meant to use now() as startdate it should look like:
SELECT * FROM table WHERE date_field > date_sub( now(), INTERVAL 45 DAY )
Ron
DaveRexel
Posted: 04/07/2003, 3:37 PM

::
Consider the following output from a CCS search component containing s_keyword [textbox] and s_Check [checkbox] :

http://localhost/Forum/NewPage1.php?s_keyword=solve&s_Check=1

here's how to use it in Custom Code assuming a grid named Tasks :

function Tasks_ds_BeforeBuildSelect() {
global $Tasks;
$s_Check = CCGetParam("s_Check", 0);
If ($s_Check != 0) {
$Tasks->ds->Order = "latest_date DESC";
}
}

the *ds* can be altered in other ways but the above seemed to match your issue.

Dave
Peter Breansky
Posted: 04/10/2003, 3:11 PM

RonB

Thankyou Ron, that works.

peter

   


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

PHP Reports

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

Home   |    Search   |    Members   |    Register   |    Login


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