Radicore Forum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » RADICORE » How To » List with pre-defined search active
List with pre-defined search active [message #506] Wed, 27 December 2006 18:28 Go to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
What is the best way to list a table (list1, from menu) with a search condition active, defined as the default search condition in the class for that table?

Is it easy to have buttons that display that table with different search conditions active?

I expect there are multiple ways in which these can be achieved, and that various applications would require such functionality!

Thanks
David Lee
Re: List with pre-defined search active [message #508 is a reply to message #506] Thu, 28 December 2006 05:53 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
If you look at http://www.tonymarston.net/php-mysql/menuguide/mnu_task(upd) .html you will see are two ways of defining search criteria for a transaction using either 'Selection (fixed)' or 'Selection (temporary)'.

It is also possible to invoke pre-defined selection criteria using navigation buttons. In the 'Miscellaneous Tasks' subsystem there are 3 examples of tasks which change the selection criteria regarding start_date and end_date. If you go into the Product prototype and in the 'List Product' screen press the 'Feature Applicability' button you will see two navigation buttons labelled 'Current' and 'Historic'. These will filter the current display based on active dates. You can use this mechanism to set whatever selection criteria you want.


Re: List with pre-defined search active [message #512 is a reply to message #508] Thu, 28 December 2006 15:03 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
I have updated the FAQ with a description of the mechanisms which are available to manipulate selection criteria. Please take a look at the following:


Re: List with pre-defined search active [message #513 is a reply to message #512] Fri, 29 December 2006 07:04 Go to previous messageGo to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
Thanks Tony

However, could you add a little more to FAQ72. I have no problem creating the PHP file, but it appears that to add it to the system, that file must first be added as a procedure (with fields Task, Description, Button Text, Pattern, Subsystem, Script ID), before it can then be added as a button function. Is this correct, and, if so, what Pattern should be selected?

I am also currently not getting the selection criteria within 'Selection (temporary)' field of the Update Task screen to affect my display, but am still working on that. So far, I have only looked at the SQL dump, and noted that it is not generating a "Where" clause. Probably something else I have done somewhere!

Regards

David Lee
Re: List with pre-defined search active [message #514 is a reply to message #513] Fri, 29 December 2006 07:23 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Yes, you have to create it as a task on the MNU_TASK table, but as there is no pattern for it you will have to do it manually. A pattern is for tasks which have a model, view and controller, and this little task has none of those.

If the value you have input into 'Selection (temporary)' is being ignored perhaps you can step through with your debugger to see what is happening to it.


Re: List with pre-defined search active [message #515 is a reply to message #506] Mon, 01 January 2007 04:16 Go to previous messageGo to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
Is there therefore a case for an extra pattern "User_Code" the template of which contains no functional code?
Re: List with pre-defined search active [message #519 is a reply to message #515] Mon, 01 January 2007 05:41 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
Possibly. I'll look into it.

Re: List with pre-defined search active [message #528 is a reply to message #519] Wed, 10 January 2007 12:33 Go to previous messageGo to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
I solved my problem with getting the selection criteria within 'Selection (temporary)' field of the Update Task screen to affect my display, - I was putting the field name in single quotes, which resulted in Radicore not recognising the field name, and therefore rejecting the whole criteria without an error message. As this would only be a problem during system building, it probably does not warrant trying to have an error message for such mistakes. It is just a lurking "gotu"!

The pre-defined selection code is still not working for me. My code is
<?php
// filter physical keys to display only the ones currently in circulation
require_once 'include.general.inc';

initSession(); // initialise session

// send search criteria back to the previous script
$prev_script = getPreviousScript();
$prev_task = getPreviousTask($prev_script);
$_SESSION[$prev_script][$prev_task]['search'] = "start_date IS NOT NULL AND end_date IS NULL";
scriptPrevious(null, 'OK');
?>


which all appears to step through correctly, but results in an empty screen, the address bar still displaying the file name of the above script. How do I debug from this state?

Regards
David Lee
Re: List with pre-defined search active [message #529 is a reply to message #528] Wed, 10 January 2007 13:09 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
When the previous screen is reactivated the search criteria are passed to the object in the line
if (isset($search)) {
    $dbobject->setSqlSearch($search);
} // if

The contents of $this->sql_search are then processed by the _sqlAssembleWhere() method which is called in $object->getData() just before the database is accessed. You will need to step through this with your debugger to see what is happening to the string that you loaded.


Re: List with pre-defined search active [message #533 is a reply to message #506] Wed, 10 January 2007 16:48 Go to previous messageGo to next message
David Lee is currently offline  David Lee
Messages: 44
Registered: June 2006
Member
Sorted.

There was a blank line at the top of my file. This stopped the PHP function header(Location: URL) from going to that URL, so the system just hung.

Opps!

David Lee
Re: List with pre-defined search active [message #535 is a reply to message #533] Wed, 10 January 2007 18:06 Go to previous message
AJM is currently offline  AJM
Messages: 2363
Registered: April 2006
Location: Surrey, UK
Senior Member
It happens. Crying or Very Sad Glad you got it sorted.

Previous Topic: many to many and field names
Next Topic: Search when some columns are dropdown lists
Goto Forum:
  


Current Time: Sun Nov 03 11:27:39 EST 2024

Total time taken to generate the page: 0.01266 seconds