Dynamic Task Selection [message #2017] |
Sat, 25 April 2009 07:29 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Tony, could you suggest how the following scenario might best be tackled within the radicore framework?
I want to have a 'Print' navigation button on a form, that will call a PDF output task. However, the layout of the PDF will depend on a configuration selectable by the user, and stored in a config table. I will therefore have several output PDF tasks and associated report layouts.
I'd like to code such that the same Navigation button runs the appropriate output task based on the configuration stored for that user.
What might be the best way to achieve this?
|
|
|
|
|
Re: Dynamic Task Selection [message #2021 is a reply to message #2019] |
Mon, 27 April 2009 06:08 |
AJM
Messages: 2371 Registered: April 2006 Location: Surrey, UK
|
Senior Member |
|
|
If you only wish to make minor adjustments to the report layout you have the followng options:
- You can modify the contents of $GLOBALS['report_structure'] before it is processed. You can do this in the _cm_initialise() method.
- You can replace the report structure file before it is processed with code similar to the following:
$GLOBALS['report_structure'] = getReportStructure ($filename); You can do this in the _cm_initialise() method.
- If you wish to have a separate task for each different layout, but you wish your users to access a single controlling task which then decides which actual task to use, then you need to create a controlling task which does the following:
- It has no dialog with the user, so there is no screen to display and no need to wait for user input. It does what it does, then terminates.
- After identifying which actual reporting task needs to be executed it needs to switch to that task.
This can be done as follows:
- You can use a pattern such as ADD4 or UPDATE4, but tell it not to insert or update anything by returning an empty array from the _cm_pre_insertMultiple() or _cm_pre_updateMultiple() methods.
- You can switch to another task by using the append2scriptSequence() function.
I hope this helps.
Tony Marston
http://www.tonymarston.net
http://www.radicore.org
|
|
|
Re: Dynamic Task Selection [message #2022 is a reply to message #2017] |
Mon, 27 April 2009 06:27 |
gpatti
Messages: 283 Registered: August 2008
|
Senior Member |
|
|
Thanks Tony,
I've used the ADD4 solution previously for another process so I'm pretty comfortable with that. I'm going to play around with the idea of replacing the report_structure file as that sounds like a nice clean solution for what I need.
Thanks for the advice.
Graham
|
|
|