Wednesday, November 3, 2010

Apex Two Interactive Reports on one Page

Two Interactive Reports on one Page

Within APEX you normally can't define two Interactive Reports on the same page. But sometimes you do need that kind of solution. You can use Ajax to get the data into your form, but using an IFrame seems a more elegant way. There are some drawbacks using IFrame but (as Johan Cruijff used to say) "every advantage has it's disadvantage".

But this is how it works using an IFrame:
1. Create a page (ex. 24) with an Interactive Report on DEMO_ORDER_ITEMS - set the Page Template to 'Printer Friendly' to get rid of the regular header and footer stuff.
2. Create a page (ex. 23) with an Interactive Report on DEMO_ORDERS
3. On page 23 create an HTML Region with as Region Source:
  1. <IFRAME src="f?p=&APP_ID.:24:&SESSION."  
  2. style="width:600px;height:600px"  
  3. name="details"  
  4. scrolling="no" marginwidth="0" marginheight="0"  
  5. frameborder="0" vspace="0" hspace="0"  />   
4. Set the Link Column attributes of the Interactive Report on DEMO_ORDERS to:
- Link Column : Custom Target
- Link Attributes : target="details" (that's the name of the IFRAME)
- Target Page : 24
- Clear Cache : 24,RIR (will clear the IR cache on Page 24)
- Item 1 : IR_ORDER_ID as the Name, #ORDER_ID# as the Value (will set ORDER_ID as Search Item.
Now if you click on the Column Link on the left IR, the right IR gets synchronized. Isn't that cool?
See the live example on apex.oracle.com
 

No comments:

Post a Comment