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

Home » RADICORE » How To » Provide a dynamic custom title for a report
Provide a dynamic custom title for a report [message #2158] Wed, 24 June 2009 13:22 Go to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I've spent most of the day struggling to find a way to achieve the following:

I have a simple output2 task that prints a list of the rows selected from a LIST2 screen. I want to be able to add a custom title to the report (probably using _cm_ListView_header). The intention is for the user to be able to type the title they want for the report in a dialog.

I've created an input task for the title (using various transaction patterns).

From here I've tried calling the output2 task directly from the input task using scriptNext, and I've tried calling the output2 task whilst using the input screen as a passthru. The application flow works in both cases, but I always get ALL transactions printed on the report. The problem is how to get the selection parameters through to the output2 task intact.

Can you suggest what would be the most appropriate patterns and method to use? What other custom code would I need to apply?

Thanks,

Graham
Re: Provide a dynamic custom title for a report [message #2161 is a reply to message #2158] Wed, 24 June 2009 17:17 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
You need to step through with your debugger to see what is appearing in $where and $selection when the output2 task is fired up. If the right values are there you need to step hrough even further to see where they are being filtered out.

Re: Provide a dynamic custom title for a report [message #2162 is a reply to message #2158] Wed, 24 June 2009 17:47 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Well my favoured approach is to run a task for the input screen from the navigation button and then call the output2 task using scriptnext. But I'm struggling with the right pattern to use for this. The easiest from a coding point of view is an ADD2, but I'm sure the selections are ignored in this case. If I use an UPD1 then I get multiple screens (one for each record selected). I'm trying with MULTI1 at the moment but not getting to grips with the scrolling code.
Re: Provide a dynamic custom title for a report [message #2163 is a reply to message #2162] Wed, 24 June 2009 18:10 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
You can use an ADD1 pattern to input the required details, then call scriptNext() in the _cm_pre_insertRecord() method. This is called after the SUBMIT button is pressed, but before the database is updated.

Re: Provide a dynamic custom title for a report [message #2164 is a reply to message #2158] Wed, 24 June 2009 18:14 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
OK. That was my original plan - but I can't see where I track the items selected from the LIST transaction for passing through to the output2 task (as I only want the selected items to be printed). How do I do that?
Re: Provide a dynamic custom title for a report [message #2165 is a reply to message #2164] Wed, 24 June 2009 19:00 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
If you use an UPDATE1 task instead of an ADD1 task then you can trap the contents of $selection in the _cm_initialise() method. If you save it in a class variable then you can use it in the _cm_pre_updateRecord() method where you should use scriptNext() to pass this selection to the OUTPUT2 task.

Re: Provide a dynamic custom title for a report [message #2168 is a reply to message #2158] Thu, 25 June 2009 05:32 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Thanks for the pointers Tony. Having looked at the documentation closely for the _cm_initialise method I discovered what appear to be some discrepancies. Part of the documentation says that $selection is only available for ADD2 whilst another part says it is available for more (including UPD1).

Using the debugger I wasn't seeing anything for an UPD1 transaction so I tried using ADD2 instead. This worked perfectly - so my problem is now solved.
Re: Provide a dynamic custom title for a report [message #2169 is a reply to message #2168] Thu, 25 June 2009 06:45 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
That's strange, as my version of 'std.update1.inc' has the following at line 67:
$where = $dbobject->initialise($where, $selection);

This means that the contents of $selection SHOULD be available in the _cm_initialise() method.


Re: Provide a dynamic custom title for a report [message #2172 is a reply to message #2158] Thu, 25 June 2009 13:18 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
If I get chance I might try another test with an UPD1 transaction. I can check whether the call at line 67 is working correctly. For now I'm happy with the ADD2 as it does exactly what I need.
Re: Provide a dynamic custom title for a report [message #2176 is a reply to message #2158] Thu, 25 June 2009 15:52 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
I think the reason may be at lines 24 - 28 in std_update1.inc:

if (!empty($selection) AND !isset($return_from)) {
    // $selection takes precedence over $where
    $where     = $selection;
    $selection = null;
} // if


This explains what I was seeing in the debugger rather than what is described in some of the documentation.

Graham
Re: Provide a dynamic custom title for a report [message #2177 is a reply to message #2176] Thu, 25 June 2009 16:15 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
There are two ways of going through that code:

  • When going forwards from a task (such as a LIST1) to the UPDATE1 task.
  • When returning to the UPDATE1 task from a popup screen.

The contents of $selection is treated differently depending on the circumstances.


Re: Provide a dynamic custom title for a report [message #2178 is a reply to message #2158] Thu, 25 June 2009 16:33 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
Understood. So you would only expect to see something in $selection if returning from a popup which was not the case for me.
Re: Provide a dynamic custom title for a report [message #2179 is a reply to message #2178] Thu, 25 June 2009 17:10 Go to previous message
AJM is currently offline  AJM
Messages: 2347
Registered: April 2006
Location: Surrey, UK
Senior Member
That is correct. But in the case of an ADD2 it is possible, when being called from a LIST2, that there are values in both $where and $selection, so both are passed to the _cm_initialise() method.

Previous Topic: Document Management like workflow
Next Topic: Suddenly 'Not Logged On'
Goto Forum:
  


Current Time: Thu Mar 28 15:23:16 EDT 2024

Total time taken to generate the page: 0.07159 seconds