Page 1 of 1

Events in Report

PostPosted: Mon Oct 03, 2011 7:03 am
by Kalpana
Hi Team,

There is some data that is assiged in the PM_BeginReport of the Report and the rest of the data comes from Datatable(TESTTBL) of my Own in the SAM_ReportFetchNext. I have constructed TESTTBL table based on some business conditions. I have inserted all the required in this TESTTBL and in SAM_ReportFetchNext event.

I need to display records that are only in this table.I tried to assign the REport variables in the SAM_ReportNotify Event by checking if the lParam=RPT_OutputDetail , but this could not solve the purpose. I also notice that SAM_ReportNotify event is triggered many times for each row in the data table. Can you please let me know the best way and the best evet to display the records in the TESTTBLcreated in the FetchNext Event.

Thanks in Advance for the Reply.

Let me know if anything is not clear.

Thanks & Regards,
Kalpana

Re: Events in Report

PostPosted: Mon Oct 31, 2011 2:02 pm
by Jeff Luther
Bit late replying, but maybe I can help...

There is some data that is assiged in the PM_BeginReport of the Report

PM designates a user-defined Programmer's Message. It is not a TD/SAM msg. so we don't know what or how anything is being assigned there.

I need to display records that are only in this table

Well, typically a 'report' is a QRP template + DB Table(s) data. if the SQL query for this report is one DB table, and population of a row of DB data happens at SAM_ReportFetchNext, then that's what will display. (Of course, based on which DB columns you have input items for, etc.)

I tried to assign the REport variables in the SAM_ReportNotify Event

It should be easier than this. Here's a simplified template of what TD code is called in the usual SAM_Report msgs, and is a reply to your question:
Can you please let me know the best way and the best evet to display the records in the TESTTBLcreated in the FetchNext Event.

Code: Select all
SAM_ReportStart
    Return SqlPrepare( ... )
SAM_ReportFetchInit
    Return SqlExecute( ... )
SAM_ReportFetchNext
    ! assuming 1-to-1 correspondence between a DB Table column & an input item in your QRP
    Return SqlFetchNext( ... )
SAM_ReportFinish
    ! optionally any 'cleanup' after report is done

SAM_ReportNotify event is triggered many times for each row in the data table

Yes. As you showed earlier, use lParam to 'filter' which notify you are interested in, though for getting some DB data into a Report -- depending on how complex the report -- you usually don't need to use the Notify msg.

My BIG suggestion is that you write a small TD test app + QRP (if you haven't already) to test this basic model:

DB Table --> TD app --> RB QRP report