Overriding sub-report queries in CF8 with function calls

There is not enough information in the documentation about
overriding sub-report queries using functions. I can not figure out
how the function call is to be passed.
Here is the page and quote from the livedocs:
"Note: You cannot specify a subreport query that depends on
arguments from the master report. Instead, you can define a CFML
function or CFC method that returns the subreport query given the
arguments from the master report. ColdFusion calls this code when
it executes the subreport."
If I send over just the function call as a string it throws
an error that it must be a query. If I evaluate it with # then it
appears to make the call once before creating the report and uses
the same query for the sub-report for every single master report
My example report is simple. Retrieve a query of contacts
records. The contact records have a state field which is the
parameter for the sub-report. The sub-report performs a query and
presents related information.
I am trying to optimize this by pre-processing the queries
for each state into memory, then pass a function that is to be used
to get the correct sub-report query from memory.
I have tried all variations that I can think of with no
success. If I try to pass variables to the function that exist in
the report, such as query and param, errors are thrown. I can only
access variables already created earlier in my code which makes me
think that the function is being evaluated once in the cfqueryparam
tag. I can not find a way to delay evaluation so that it is
evaluated for each call to the sub-report instead.

I'm following the instructions laid out in the livedocs for
advanced queries with CFML :
However the Report Builder won't save the CFML I enter.
Everytime I go back to the Advanced query there are just blank
query tags. Most of the time it doesn't even show that any changes
were made to the report at all. The little asterisks does not
appear next to the report name tab which indicates if there are
unsaved changes. At some point I got it to save some code but it
had a mistake and I couldn't get it to save the corrected code.
This is very frustrating. I'm putting in a bug report for at
least the saving of CFML in the advanced query section.

Similar Messages

  • On Click Open a Sub report in Drill down with SSRS 2008

    Please give a example in SSRS 2008 In which On Click a DrillDown Report , A sub report will be open with other details, and the Export to Excel and PDF is in the correct format.Thanks Santosh

    Hi Santoshsp,
    There is no too much difference in SSRS2008 comparing to SSRS2005, for detail steps, please refer to below:
    1. Right-click the detail row on the Main report, and then select Insert Row->Inside Group-Below
    2. Merge the new row, and the drap your subreport into this merged textbox.
    3. Right-click the whole subreport row, then select Tablix Properties.
    4. Move to Visibiblity tab, click the Hide option and the Checkbox of
    Display can be toggled by this report Item
    5. Select one toggle item based on your requirement. Such as we could select the datafield on the detail row.
    6. Right-click the subreport control and then select Subreport Properties.
    7. Select the subreport name in the drop-down list.
    8. If the subreport contain parameters, you should move to the Parameter tab on the Subreport Properties dialog box, for this point you could refer to this link
    If you have any question, please feel free to ask.
    Challen  Fu
    Challen Fu [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

  • Personal recruitment How to do new measure with function call Update IT4000

    Hi out there and happy new year to forum,
    i want to update to implement a recruitment measure (Transaction PB40). I did it already with batch input, but i guess it's much more comfortable to do with funtion module, bapi or calsses.
    After choosing the measure, the infogroup will be processed. So i guess, i just have to use the corresponding function modules to update the infotypes in a given sequence. is this suggestion right?
    What are these function modules? How to update f.e. IT4000? Does anyone has a coding snippet?
    In our Infogroup there are also customer specific infotypes f.e. 9***. Can I use the sap standard function modules for "own implemented" infotypes?
    I also appreciate an abap oo pattern or any similar....
    Best regards,

    Andy Goris wrote:
    But I don't think that it's possible to hire an application completly with function modules (there is no PERNR in the beginning so I would keep the BIM).
    The applicants already exists in system, i just want to implement a measure with exact one click!
    Otherwise there is a BAPI for applicant_create.
    I'm not very expierienced focussing the implementation in pa-recruiting. I'm really looking for a good documentation or anything like that f.e. sap press.
    Andy Goris wrote:
    ... but why would you use the old recruiting database? This is hardly used anymore.
    What are the alternatives to it. (I'm not looking forward to upgrade releases or using wd4a or webgui). we are on ecc 6.0 There is already a lot of z-coding in recruitment. We are also using an self implemented e-recruiting approach
    Edited by: Timo Ehl on Jan 3, 2012 2:30 PM

  • UnsatisfiedLinkError with function call

    I am using JNI to make native function calls from Java.
    I use
    to load my library, and that works without a problem.
    I can use this library without any problems from a simple test app I wrote. However, I get an UnsatisfiedLinkError when I try and integrate with the rest of my applicaton. I am 100% certain that function is defined correctly in both Java and C++.
    The only difference I can think of between my real application (which does not work) and my test application (which does work) is that in my real application, the object that makes use of the class that contains all my native methods is cloned before it makes any calls to my native code.
    What can cause an UnsatisfiedLinkError if my System.loadLibrary() is correct, and my function definitions are also correct?
    Edited by: EliottH on Mar 1, 2010 12:17 PM

    In case my post needs any clarification, here is some sample code that demonstrates what I am doing:
    //An instance of this class gets cloned before any native function calls are made!
    public class SomeClass implements Cloneable {
        JniClass jniclass;
        SomeClass() {
               jniclass = new JniClass();
        //This returns an UnsatisfiedLinkError when called
        public void func() {
        public void clone() {
    public class JniClass {
        public native void nativeFunc1();
        static {
    }Edited by: EliottH on Mar 1, 2010 1:00 PM

  • Problem with function call from sql when using distinct

    I have the following problem.
    SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
    This statement will return a handfull of results from a table with 70k + records. The function takes about 0.5 secs to execute.
    How do i force the optimizer to do the select distinct first then execute the function on the results rather than execute the function for every single line first?
    Thanks in advance

    Let's compare some of those methods:
    michaels>  CREATE OR REPLACE FUNCTION my_function (tr VARCHAR2)
       DBMS_APPLICATION_INFO.set_client_info (SYS_CONTEXT ('userenv','client_info') + 1);
       IF LOWER (tr) LIKE '%name%'
          RETURN 'TRUE';
          RETURN 'FALSE';
       END IF;
    END my_function;
    Function created.
    michaels>  CREATE TABLE taba AS SELECT object_id cola ,object_name colb FROM all_arguments
    Table created.
    michaels>  SELECT COUNT(*) FROM taba
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  SELECT DISTINCT colA from tabA where my_function(colB) = 'TRUE'
    167 rows selected.
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  SELECT DISTINCT cola FROM (SELECT ROWNUM r, t.* FROM (SELECT DISTINCT cola, colb FROM taba) t)
              WHERE my_function (colb) = 'TRUE'
    167 rows selected.
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  SELECT DISTINCT cola FROM taba WHERE (SELECT my_function (colb) FROM DUAL) = 'TRUE'
    167 rows selected.
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  SELECT DISTINCT cola FROM taba WHERE EXISTS (SELECT ROWNUM FROM dual WHERE my_function (colb) = 'TRUE')
    167 rows selected.
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  WITH temp AS
      (SELECT DISTINCT colA, colB FROM tabA)
    SELECT DISTINCT colA FROM temp WHERE  my_function(colB) = 'TRUE'
    167 rows selected.
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    michaels>  EXEC dbms_application_info.set_client_info(0)
    michaels>  WITH temp AS
      (SELECT colB, my_function(colB) func FROM (SELECT DISTINCT colB FROM   tabA))
    SELECT DISTINCT colA FROM tabA a, temp t WHERE  a.colB = t.colB AND t.func = 'TRUE'
    michaels>  SELECT SYS_CONTEXT ('userenv','client_info') ci FROM dual
    78786 The combination with exists, rownum and dual gives the least calls to the function.

  • Sqlldr WHEN clause with function call ?

    I have a requirement to load data from a file with each row being checked for good data.
    But that check is wrapped inside a function, as it is somewhat complex.
    So I woul like to load the data with a WHEN clause like this
    WHEN ( "CHECK_IF_GOOD(:field1, :field2,.. )" = '1' )
    But sqlldr compains that column CHECK_IF_GOOD(:field1, :field2,.. ) is not present in tableA
    Obviously sqlldr thought CHECK_IF_GOOD(:field1, :field2, ) to be a column name.
    Is there any work around for this problem

    The quotes and colons are not shown in the documentation for the when clause.
    I do not know if you can invoke your own function in the Loader operation.

  • Decode null with function call

    Is it possible to use decode in select for the below scenario, if so what is the correct syntax
    IF function one returns null I want to call display the value from function 2 in decode statement.

    Hi, Anna,
    I would use COALESCE for that:
    COALESCE (a1, a2, a3, ...)returns the first of its arguments (there can be as few as 2, and probably at least 100) that is not NULL.
    If you need help, post some sample data (CREATE TABLE and INSERT statements), function code, and the results that you want from that data.

  • Java.util.regex and replacing patterns with function calls

    Hi everyone,
    I'm in terrible need for help.
    Any advice is much appreciated.
    I have the following sentence in a file. The sequence of numbers is actually a
    date in seconds since 1970. I need to identify the 9 or 10 sequence of numbers
    send that to a method that will transate the numbers into a date in a string format.
    Then replace it in the file.
    Here is an example:
    "My name is Peter. Please 1020421277 help me figure this out 108062327. "
    using the following block I can convert it to this
    "My name is Peter. Please | help me figure this out |. "
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    String aLine = null;
    while((aLine = in.readLine()) != null) {
    String result = m.replaceAll("|");
    [end block]
    So I need to change the above block so that my sentence looks like this.
    "My name is Peter. Please 05/03/2002 10:21:17 help me figure this out 06/04/1973 17:18:47. "
    The method that converts the numbers into a date is not of a concern because I already have
    the code to do that.
    If anyone has suggestion, please let me know.
    Thanks in advance.
    [email protected]

    Never mind, I was able to figure it out....
    Common2 cm = new Common2();
    Pattern p = Pattern.compile("[0-9]{9,10}+");
    Matcher m = p.matcher("");
    m = p.matcher(s1);
    while ((found = m.find())) {
    String replaceStr = m.group();
    System.out.print("\tReplaceString is: " + replaceStr);
    replaceStr = cm.get_date(replaceStr);
    System.out.println("\t\tConverted to: " + replaceStr);
    ----------------- The get_date method in Common2 looked like this ------------------------------
    public String get_date(String myString)
    String s;
    long lsecs = Long.parseLong(myString);
    lsecs = lsecs * 1000; // its now milliseconds.
    // Determine default calendar and then the offset to GMT.
    Calendar localCalendar = Calendar.getInstance();
    int offset = localCalendar.get(Calendar.DST_OFFSET) + localCalendar.get
    // Take the number of milliseconds subtract the gmtoffset
    Date GMTdate = new Date(lsecs - offset);
    // Format date
    Format myformat;
    myformat = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss a z ");
    s = myformat.format(GMTdate);
    return s;

  • Converting a Crystal Report with Many Sub-Reports into CF Report Builder

    I am trying to rewrite a Crystal Reports report which has 11
    subreports in CF Report Builder. In the CR report, each subreport
    has it's own report footer seciton. I have not been able to find
    anything in CF Report Builder that allows me to do the same. Is CF
    Report Builder capable of producing a report with multiple

    Having successfully created a report with 5 or 6 subreports
    (with each sub-report containing a multiple sub-sub reports) I can
    say with confidence, "Yes you can." However the real question you
    should ask is, "
    Should I create a report with multiple sub-reports in CF
    ReportBuilder?" And the answer to that is.... NO, WHAT ARE YOU
    If you have something that works in Crystal Reports I would
    suggest you stick with that. Otherwise you're setting yourself up
    for a lot of headaches. Now maybe it was because I started using
    the report builder that came with MX7, but it seems there are still
    quite of few bugs that will leave you shaking your fist at your
    computer. If however you do continue and do the CF Report Builder
    route, be prepared for your application to crash unexpectedly, and
    for many things to not work they way you expect them to. And if you
    ever need help good luck. Take the fact that you had difficulty
    finding good documentation as a sign of how little Adobe supports
    this product.
    CF Report Builder is fine for very simple reports, but don't
    get fancy with it, you'll only regret your decision in the

  • Main/Sub Report Passing Parameter

    This is a twist on the general passing parameter question:
    1. The main report is a detail report based on a stored procedure.
    2. The sub report is also based on a stored procedure. This SP calculates the values that will be introduced into a 'table' drawn on the report canvas. The SP consists of a CTE which is a 'reduced' version of the Detail SP used in the main report - to ensure that all the same records are being retrieved between the main and sub reports. Another select, following the CTE, sums the values and makes them available to the Sub Report.
    The client has requested the availability to view records where an Activity Date falls within the last full week, the last month, this month, and YTD. The report is available both through Infoview as well as a scheduled version. The client wants to make a selection as to time period through Infoview.
    Most other users will be using a printed copy of the 'general' report.
    I thought to use the SAVED DATA in SELECTION REPORTS and use Crystal functions to handle this. The SAVED DATA and an optional parameter allowed the user (in Infoview) to change the parameters. This works fine in the main report.
    HOWEVER, the sub report needs to update the totals for the groups of properties that are aggregated in the sub report's summary Stored Procedure. Since the time range will, on changing in the Main Report, reflect different counts,  I need to be able to tell the sub report what the main report is doing.
    The Main report has an Optional Parm ({?Account Open}) which allows the selection of a data range
    The SAVED DATA selection uses the values from the parm:
    if not hasvalue({?Account Open}) then 1=1
        else if hasvalue({?Account Open}) and {?Account Open}=0 then 1=1
        else if hasvalue({?Account Open}) and {?Account Open}=1 then {Account_open_date_newest}in LastFullWeek
        else if hasvalue({?Account Open}) and {?Account Open}=2 then {Account_open_date_newest}in LastFullMonth
        else if hasvalue({?Account Open}) and {?Account Open}=3 then {Account_open_date_newest}in Yeartodate
        else if hasvalue({?Account Open}) and {?Account Open}=4 then {Account_open_date_newest}in CDateTime (CurrentDate-(DayOfWeek(CurrentDate)+1),CTime(00,00,00)) to CDateTime (CurrentDate+(7-(DayOfWeek(CurrentDate))),CTime(23,59,59))
        else 1=0;
    My problem in passing the optional param selection made by the user down to the sub report in order to update the counts.
    Any help would be gratefully appreciated! I have included a snap of the Table from tyhe subreport and a snap of the optional parm from the Main Report

    Jamie -
    Thank you for your reply. I've spent the morning working on the two directions you had provided me with.
    Cross tabs: I took one report, created a cross tab for it, and, as expected, it worked as desired. The issue I'm having is where to place it on the report canvas. If I'm correct, the only place where it can be placed is in a header or footer - the sub report is currently residing in Page Header D (there's a lot of suppression and reveals in these reports). The cross tab does not want to be placed there. It's currently living in the Report Header... further, the cross tab occupies page 1; the remainder of the report starts on page two. Not what needs to happen. The current business specification for the report is: Page 1 includes a page header which includes (through iterations a-e) logo, print date info, the sub report showing the summary a series of group headers which in effect creates an index into the various business units. By clicking on a business unit, any groups under it are exposed. By clicking on the sub group, customer data is exposed. As you go to the 'next page', the Summary sub-report is eliminated and the groups under the Business Unit are shown. All of these dynamics are based on section suppression and unhiding based on the user's interaction, which why the placement of the Summary data is important. If you have any hints on managing the cross tab and its placement, I would be eager to hear them.... (btw - the number of rows in the cross-tab can range from 0 to 12. That dynamism is not a problem with the sub report - would it be for the cross tab?)
    Parameter Passing: I took one of the reports and (1) ensured that the sub report had the exact  same parameter (called Account Open) as the Main Report. (2) ensured that the Saved Data filters in both reports were the same. (In order to do that I had to update the stored proc for the sub report to include an account date field). (3) I then went to link the two reports selecting the Account Open parameter in both the containing and the Fields to Link To list boxes (see the graphic LINK.JOG. This produced no useful result - the Summary showed ALL records- the container report properly showed the count for last full month (see SUMMARY.JPG) (4) I then tried to link a field from the sub report to the Parameter, but only 4 of the six fields from the stored proc's select were displayed. (Prior to this Select there is a CTE which collects the data with a ROW OVER.. PARTITION function):
    sum (CASE WHEN currentrisk =1 THEN 1 Else 0 End) lowcount ,
    sum (CASE WHEN currentrisk =2  THEN 1 Else 0 End) midcount ,
    sum (CASE WHEN currentrisk =3 THEN 1 Else 0 End) highcount,
    sum (CASE WHEN currentrisk =0 THEN 1 Else 0 End) unknown
    FROM    records
    WHERE   rn = 1
    group by customer_business_unit_name,account_open_date_newest
    Only the COUNT fields show up in the Fields box (see the graphic LINKS CHECKED.JPG).
    Where have I gone wrong??
    Again, thank you for your earlier reply.

  • Regarding Sub report..

    i need small information..
    normally we are putting Line items which are repeating ..
    in Detail Section For
    I need this type of Functionality AT report Footer is it possible..
    I put sub report at Report footer..
    If i click only  then new Preview will be open and showing like
    what i need
    main report
    details section
    report footer
    like this is it possible..
    i need your valuable suggestions.
    if you don't understood also plz inform me..
    i will explain again...

    I have just checked your report and let me say
    here i am getting the data in main report but on
    the next page.
    It is happening because your Sub-Report is not fitted with
    available remaining space. so,it will automatically moving to next
    Next Page:-

  • Crystal Report Hyperlink to Sub-report or other report

    I would like to create a report on which the first part will show project summary page. The second part will have all project detail pages and third part with all project financial informations.
    The report should work in such a way whenever user clicks on any project at first summary page this has to jump to corresponding detail page of projects.
    I have the following question regarding design of this report.
    1. Do I need to create a saparate report as a sub report and then merge with main report in a footer section? Or is it ok to create sub-report within main report through sub-report wizard option?
    2. How can I establish hyperlink between the pages i.e. summary to detail pages?
    3. back hyperlink to first pages.
    I am expecting more information about hyperlink options within Crystal report.
    -Sunil Prasad

    Hi Sunil
    - For your first question: . Do I need to create a saparate report as a sub report and then merge with main report in a footer section? Or is it ok to create sub-report within main report through sub-report wizard option?
    You can create a separate report and then insert it as a subreport in the main report or create it with sub report wizard.
    Once you click on Insert -> Subreport, you can see there are two options, one is to point to an existing report and another is to create it through wizard.
    - 2. How can I establish hyperlink between the pages i.e. summary to detail pages?
    You can use the hyperlink between report objects.  Also you can apply a customized formula for this.
    Check the below SAP Notes:
    [1. 1207011 - How to create an OpenDocument link in Crystal Reports XI/XIR2 |http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes]
    [2. 1212849 - How to pass a parameter value through a hyperlink from one report to another |http://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes_boj/sdn_oss_boj_erq/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/scn_bosap/notes.do]
    For detailed information on Hyperlink Click on Crystal Reports Help Help -> Search for the keyword Hyperlink.
    You can also refer to the Crystal Reports User guide for the respective version that you are using.
    Hope this helps!!

  • Problem using function call in WHERE part of a Report's SQL query

    I tried doing some searches on this, but couldn't find anything. I'm trying to run something similar to the following query in my report, but keep getting a "Query cannot be parsed within the Builder" error:
    SELECT function1(TABLE2.ID) A
               TABLE1.NAME = 'BLAH' AND
               (function2(TABLE2.ID) = 'YES' OR
                function3(:USER_ID) = 'YES')
    ORDER BY TABLE1.NAMEWhy won't this work? I can take out the 2 lines with function calls from the WHERE clause, and it works, so I'm assuming that APEX doesn't like something about my function calls. I know the functions are valid and work properly, because I tested them independently. Can anyone see what the problem is? Thanks!

    Here's the actual query:
    ORDER BY EXT_FILE.FILE_NAMEAnd here's the actual error message:
    1 error has occurred
    Query cannot be parsed within the Builder. If you believe your query is syntactically correct, check the ''generic columns'' checkbox below the region source to proceed without parsing. ORA-00904: "SER_IS_ADMINYESNO": invalid identifier

  • Need to create 6 sub reports in Crystal Reports 2008 - Advise Required

    Hello All,
    I am trying to create a report with 6 sub reports in Crystal Reports 2008.Each sub-report is filtered by a filed called Error Status.Finally i need to parameterize the report based on Rec Date ( This is also i field in table from where i am puling data). I tried to link sub reports but was not able to. Please guide me.
    Thanks !

    I linked the fields but no data appears in the main report. Any advise would be greatly appreciated?

  • Sub report using Stored Procedure returns incorrect data

    Post Author: rikleo2001
    CA Forum: Data Connectivity and SQL
    I am using CR 9 in ASP.net application.
    One simple report and one Sub report, sub report is basically linked with Stored procedure accepting one parameter and returns a select query.
    Main report is linked with that sub report using that parameter field.
    Sub report is on demand sub report.
    Now when I execute that main report and click on on demand sub report I am getting Wrong order information.
    Here is out put on main report
    Order 1                                          on demandDetail
    Order 2                                          on demandDetail
    Order 3                                          on demandDetail  
         NOW If I click on Order 3 (On demanddetail link, it displays rondom order details, some time correct on too), I am really stuck and don't know where I am going wrong.
    Please help me to solve this issues.
    Many Thanks

    Post Author: rikleo2001
    CA Forum: Data Connectivity and SQL
    Hi Yangster,
    Thank you so much for your reply.
    On DEMAND Sub report is located in main report, IN DETAIL SECTION
    I am passing Order ID from main report linked to  {?morderid} in subreport under command object, and if I run it in design mode, it works perfectly alright, so problem is isolated to ASP.NET and Crystal report post back method on Crystal report.
    The example I give to you this is a simple example to identify issues in my real application and report.
    My main report contains summary of data base on unique identifier. that summary have 4 differant types of details which has to be on the same report (as Crystal report doesn't provide Nested subreport), so I decided to use 4 subreports on main report and all subreport using Stored procedure command object.(Sub report has it own complex processing requirement to fulfill).
    Please help me with any further ideas? for the sample which I presented to you this is only using one SP on main report with a simple processing.
    Many Thanks

Maybe you are looking for