Focal Point
sample code for Adhoc report

This topic can be found at:

February 03, 2015, 04:41 AM
sample code for Adhoc report
Hello Everyone,

We have a new requirement, Adhoc reports – 120-170 columns and 7-8 million records. which will perform better performance either using master file or sql pass thru?

Can you help me with sample code for below requirement.
The customer login thru web and select list of columns(in 120),either 10,20,…. and filter criteria’s Empid(>,<,<=,>=) and Sal (>,<,<=,>=) etc… and date range and submit.

Ex:Columns(Emp Table)
Country etc..

WebFOCUS 7.7.03 Windows 7, Excel,HTML,PDF
February 03, 2015, 07:46 AM
Look at these videos that explain how to create an Adhoc report:
Adhoc part 1
Adhoc part 2

WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
February 03, 2015, 09:28 AM
Consider the points mage in this post: Need to handle 7-8 million records in excel or pdf!!.
February 03, 2015, 09:50 AM
Technically SQL pass through and focus will will behave the same when they are sent to the database. I'm sure I'll have a lot of people telling me I'm wrong. That's because FOCUS doesn't always optimize the SQL that it passes to the database.

IBI has made a number of improvements to the adapters that have improved the SQL thats generated, but even so, when writing your FOCUS code you should have at least a basic understanding of what will translate to good SQL and what won't. For instance, the FST and LST operators do not translate to SQL and if you have alpha values in your SUM verb without putting a prefix operator on it, the SQL will not be generated properly. In this instances and group bys that you have will not be passed and FOCUS will handle it on the RS.

If you search the forum for tracing, you will find examples of how to trace your queries to identify whether your query is efficiently being translated into SQL. If you want to not worry about that and know exactly what SQL is being passed, then I would use SQL pass through.

In my environment I do not allow SQL pass through, so whenever I create metadata and queries, I try to run traces on what I wrote so that I can ensure that I have the correct SQL translated to the DB.

Eric Woerle
8.1.05M Gen 913- Reporting Server Unix
8.1.05 Client Unix