Home RAP
New Blog Posts: Merging Reports - Part 1 and Part 2

RAP Context

edited April 2003 in RAP
Hi,

I'm using RB7 Ent with D6 Ent

I have a service which instantiates worker threads that contain TppReport
objects. The report templates which are executed by the threads refer to
pass-through functions.

When the extended pass-through rap functions get called, I have no way to
figure out in which context (thread) they are running.

For example:
The thread running the report contains, as a private variable, the UserID of
the user that is requesting the report.

The report template contains " GetUserName " and results in a call to
GetUserName.ExecuteFunction

But now in my implementation of GetUserName.ExecuteFunction I have no idea
which thread called me - at this point I would have liked to refer to the
DB with the UserID and return the UserName.

The execution of the pass-through function is completely isolated from the
instance that called it. A reference to the calling TppReport would be
useful.

QUESTION:

In the current framework, is there anyway I could trace back to determine
who called the pass-through function?

Regards,

Ben Van Rensburg

Comments

  • edited April 2003
    Yes, pass the Report object in the pass through function as a parameter.
    There is a TraParamList parameter that you need to use. There is an example
    of this used in the demo below. It does have a pass through function that
    receives the Report object from RAP, then it is referenced from the params
    list to get information about the Report.Engine object which is not surfaced
    in RAP.

    http://www.digital-metaphors.com/tips/RAPDrawCommands.zip

    --
    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited April 2003
    Hi Jim,

    Thanks for the prompt reply.

    I could follow that route, but it would require modification of existing
    reports in the field. Also, for end users creating reports, having to
    include the report as a parameter is not as intuitive as just calling
    GetUserName.

    Some more questions:

    Does the Pass-Through function run in the same thread as the report that
    called it??

    If so, I could maybe use some ThreadVars to expose data specific to the
    thread of execution. That way, I could just refer to the threadvar from the
    pass-through execution without having to worry about the context?

    Cheers,
    Ben





  • edited April 2003
    The pass through function will execute inside the same thread as the report.
    If you access any global singleton objects in the pass through function
    inside this thread, then you'll need to add a critical section to make the
    singleton object threadsafe.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.