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

Home » RADICORE development » Bug Reports » std.update3.inc confusion
std.update3.inc confusion [message #2365] Sat, 14 November 2009 11:30 Go to next message
ljkbrost is currently offline  ljkbrost
Messages: 59
Registered: April 2006

I'm trying to use the std.update3.inc pattern to create a dynamic report generation screen and I've run into a problem that I have not seen before and I'm not sure of the fix.

To give an idea of what I'm trying to do:

I have a rpt_report and rpt_parameter table. The rpt_report table contains the description of the report and the rpt_parameter table contains the description of the parameters (one parameter per row).

1) Display list1 of the reports
2) Select a report from the list1 screen.
3) Click the run_report (an update3 screen)
4) Inside the _cm_changeConfig fuction:
4.1) Grab a list of all the parameters based on the passed in report_id (populated by the list1->update3 selection process)
4.2) Build the fieldspec based on the data pulled in from this report.

So this is all pretty simple/straight forward, but I have a problem the somehow my where clause in the query to get the parameters has an extra '=' operator.

 ON (rpt_report.report_default_version_id =
 USING (version_id)

Notice the WHERE clause has an extra "=" in the front.

I've traced the problem to the std.table.class.inc's initialise() method. Inside this class it there is the following call:
        // convert $where string to an array
        $fieldarray  = where2array($where, false, false);

This function ultimately returns a fieldarray with
    [report_id] => ='060a-7bb8-36e67021fcb81fe-01224c'

Stepping through the where2array function everything works upto the point when the function strips the operators. In this case the function is passed $strip_operators=false, so it leaves the extra '=' in the fieldarray.

Ultimately when I'm in _cm_changeConfig, my $fieldarray is not what I would expect. Changing the initialise() method to strip the operators fixes the problem.

So, should the where2array be change to strip_operators=true?
Or, am I missing something?

Re: std.update3.inc confusion [message #2366 is a reply to message #2365] Sat, 14 November 2009 13:31 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2350
Registered: April 2006
Location: Surrey, UK
Senior Member
The call to where2array() in the initialise() method should NOT be changed to set stripoperators=true as the $where string passed down from the previous object may have operators such as IN, BETWEEN, <, >, etc, so it is important that they are NOT stripped as they could not be reconstituted when the array is converted back into a string.

You will need to call the stripOperators() function in the relevant custom method.

Re: std.update3.inc confusion [message #2367 is a reply to message #2366] Sat, 14 November 2009 14:43 Go to previous message
ljkbrost is currently offline  ljkbrost
Messages: 59
Registered: April 2006
Thank you for your opinion on the matter. I've abandoned this approach as the std.update3.inc is too specific to your implementation of general control settings.

I'm going to look at using a simplified add1 or update1 to achieve my needs.


Kyle Brost
Previous Topic: Database/Table Import Error
Next Topic: replaceScreenColumns does not work in all cases
Goto Forum:

Current Time: Mon Jun 17 18:20:45 EDT 2024

Total time taken to generate the page: 0.00917 seconds