Question

I have a record with several child records on a page. I have a button on the page that triggers a report through XML Publisher via rowset. The problem I am having is the rowset I am passing to the report contains everything in the buffer -- I want only the current context to show on the report. What I have right now:

&rs_resp = CreateRowset(Record.AVZ_JD_RESP_TBL);
&rs_expr = CreateRowset(Record.AVZ_JD_EXPR_TBL);
&rs_skls = CreateRowset(Record.AVZ_JD_SKLS_TBL);
&rs_dtl = CreateRowset(Record.AVZ_JD_DTL_TBL, &rs_resp, &rs_expr, &rs_skls   

&RS0 = GetLevel0().GetRow(1).GetRowset(Scroll.AVZ_JD_DTL_TBL);
&RS0.CopyTo(&rs_dtl);

Then I kick off the report:

&oReportDefn.SetRuntimeDataRowset(&rs_dtl);   
&oReportDefn.ProcessReport(&MyTemplate, &LanguageCd, &AsOfDate, &OutFormat);

I was previously using a Rowset.Fill on each of the rowsets (parent and child), but I the copyto method somehow seemed "cleaner" (certainly less code :-) ). Is there a way to copy the current context only?

Thanks

Was it helpful?

Solution

I think all the rows would have got copied when you perform the rowset copy -
    &RS0.CopyTo(&rs_dtl);

You can control creating new pages for each row on the report, by using page-break in the for-each loop (that you would be using to traverse through the rowset in the template):
   <?split-by-page-break:?>

In case you want to print only the latest effdt rows, copy only the latest effdt rows to the &rs_dtl rowset. You could do this by first sorting the &RS0 rowset based on the keys using
    &RS0.sort(keyfield1,keyfield2,"A");

and then loop through the sorted rowset checking for max effdt for a given set of keys.

Use the insert row function to insert the row into &rs_dtl.
    &rs_dtl.Insertrow(&rownumber);

Do tell me if this works.

OTHER TIPS

If i understand the question, you could do something like this:

Getrow().Copyto(&rs_dtl(1));
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top