Forum Stats

  • 3,853,804 Users
  • 2,264,276 Discussions
  • 7,905,450 Comments

Discussions

executing a custom function in discoverer reports

user59402
user59402 Member Posts: 11
edited Aug 29, 2008 5:59AM in Discoverer
Hello,

I have a registered p/l function in discoverer that I created. It populates a temporary table, based on the user-entered parameters for the worksheet, and displays the output based on what it put in that table. The problem is, when you execute the report, the function gets called, but the report output is displayed based on what was entered in the table previously, not what was just entered by this function. therefore, I have to execute this report twice to get the right output. Is there anyway to call this function after the parameters are entered, but before the report is executed?

Rae
Tagged:

Answers

  • Hi Rae
    This is all down to the way the system is caching your results.

    After you have called the function try clicking the refresh button on the top of the screen. At that point the data in the report will change. I think this is what you are suggesting you are already doing but just in case I thought I would mention it.

    Another way to do this is as follows:

    1. Create 2 worksheets
    2. Worksheet 1 has the parameters and calls the function. When done the function simply returns the word Done
    3. Worksheet 2 runs against the data that was inserted into the temporary table by the function
    4. Therefore you run worksheet 1 and then run worksheet 2. There has to be a certain lapse between you calling the function and the table being populated. Until the table is populated then you cannot or should not run the main report because you will end up with wrong data.

    Does this help?

    Michael
  • user59402
    user59402 Member Posts: 11
    Hi Michael,

    yes, the first option is what am doing. If this was just a report for me personally, I would be fine leaving it like this. But, most likely, our customers aren't going to like having to remember to run a report twice every time. I think, though, I can make something presentable using your second suggestion where I will call the the sheet something like 'reset parameters', or something to that effect. I was hoping there'd somehow be a way to do it behind the scenes.

    thanks,

    Rae
  • Rod West
    Rod West Member Posts: 4,025 Gold Trophy
    Hi,

    Another option is to create a table function which first calls your PL/SQL function to populate the temporary table then the table function returns the rows in the temporary table.

    You can map the table funtion into your EUL by creating a view that includes the table function. You can pass parameters to the table by joining a table to the table function or by using database contexts.

    Rod West
This discussion has been closed.