This topic is locked

Position to near Current Date in a List

12/3/2006 3:18:42 PM
PHPRunner General questions
S
susoft author

Hello, I'm searching for a solution to possiting the courser on the line that is nearest oon the current date.

What I mean is:

I have a query "select date, event, description" and with this query a generate the list view, it is possible to search in the list for the current date and put this record on the top in the list (scroll to the nearest on current date)?

thanks for any help

Andreas from Switzerland

J
Jane 12/4/2006

Andreas,
to set up order of the records on the LIST page proceed to the Edit SQL query tab, click on the Change... button, add your date field and change order to DESC.

S
susoft author 12/4/2006

Andreas,

to set up order of the records on the LIST page proceed to the Edit SQL query tab, click on the Change... button, add your date field and change order to DESC.


Hello, my question is not to order by date from the newest to the oldes, my question is to order all dates from 1. January 2006 to 31. december 2008 and point the current listrecord an the nearest date from today.

J
Jane 12/5/2006

Andreas,
you can do the following:

  1. check off No records on the first page option on the Edit SQl query tab.
  2. build your pages.
  3. open generated ..._list.php file, find these lines:
    if(!count($_GET) && !count($_POST))

    $strSQL = AddWhere($strSQL,"1=0");



and replace it with this one:

if(!count($_GET) && !count($_POST))

$strSQL = AddWhere($strSQL,"`FieldName`>now()");



where FieldName is your actual field name.

To recieve all records click on the Show all button on the LIST page.