This topic is locked

Modify Search Query

3/11/2007 7:44:18 PM
PHPRunner General questions
D
douglasbraun author

I would like the List screen to use a different query than the Advanced Search screen. The difference is that the List screen will not show records with a status "closed". The Advanced Seach will behave normally.
I believe the best way to do this is to use the List - OnLoad custom code. I know that: if(@$_REQUEST['a']=="search" - will advise me of which type of search is being used. Now how do I dynamically update the requested search to include: WHERE 'status' <> 'closed'?

J
Jane 3/12/2007

Douglas,
you can do it editing generated files manually.

Open ..._list.php file, find following lines:

if(@$_SESSION[$strTableName."_search"]==1)

// regular search

{



and add this code just after:

$strSQL = AddWhere($strSQL,"`TableName`.`status`!='closed'");



where TableName is your actual table name.

D
douglasbraun author 3/13/2007

Ah, that works. But there's a hitch. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=16224&image=1&table=forumreplies' class='bbc_emoticon' alt=':rolleyes:' /> Everytime I Build I'd need to modify the complied code again. Is there a way to do it with code inserted by Onload from the custom code template? That way it would be automatically rebuilt.

J
Jane 3/14/2007

Douglas,
unfortunately there is no way to do it in the events.