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

Home » RADICORE » How To » Dynamic Task Selection
Dynamic Task Selection [message #2017] Sat, 25 April 2009 07:29 Go to next message
gpatti is currently offline  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 #2018 is a reply to message #2017] Sun, 26 April 2009 05:43 Go to previous messageGo to next message
AJM is currently offline  AJM
Messages: 2371
Registered: April 2006
Location: Surrey, UK
Senior Member
It is just the layout which is different in each of these print tasks, or are there differences in the code which extracts the data?

Re: Dynamic Task Selection [message #2019 is a reply to message #2017] Sun, 26 April 2009 07:47 Go to previous messageGo to next message
gpatti is currently offline  gpatti
Messages: 283
Registered: August 2008
Senior Member
It is just the layout that will be different in this case. Different users may have different versions of pre printed stationery. I want the user to be able to configure the stationery version they have so the print task works seamlessly for them.
Re: Dynamic Task Selection [message #2021 is a reply to message #2019] Mon, 27 April 2009 06:08 Go to previous messageGo to next message
AJM is currently offline  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.


Re: Dynamic Task Selection [message #2022 is a reply to message #2017] Mon, 27 April 2009 06:27 Go to previous message
gpatti is currently offline  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
Previous Topic: override auto rdcaccount_id clause in a manually extended SQL
Next Topic: Format data in a message
Goto Forum:
  


Current Time: Thu Nov 28 16:32:21 EST 2024

Total time taken to generate the page: 0.01094 seconds