Is it possible to programmatically replace a Sub Report in a crystal report

We create crystal reports via the crystal report designer (not in any IDE) , and attach the reports directly to the database via stored procedures. Each report contains a page header and a page footer with patient demographic data. We distribute these reports to our customers and they may edit the templates and alter the page header and page footers specific to their needs.
We are looking at using sub reports to build a "model" page header and page footer that would be inserted into each template at design time. What we would like to do is allow the customers to create their own sup reports to contain their custom page header / page footer and then programmatically replace the " model" sub reports with the custom sub reports. Please note that these sub reports would not contain any data access and would not be linked to the main report, rather the main report would assign the data that is displayed in the page header/page footer data to shared variables,  and the sub reports would use the shared variables as their data source to display the data.
Is it possible to programmatically replace 1 sub report with another ? If so are there any code snippets to review -

Yes it is. Submit your post to which ever SDK you are using into the Developer forums. But search the posts first and look in our samples. This is relatively easy to do.
Thank you
Don

Similar Messages

  • Regarding Sub report..

    hi.
    i need small information..
    normally we are putting Line items which are repeating ..
    in Detail Section For
    Line1
    Line2
    Line3
    Line4
    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
    line1
    line2
    line3
    line4
    what i need
    main report
    details section
    line1
    line2
    line3
    line3
    report footer
    line1
    line2
    line3
    line4
    like this is it possible..
    i need your valuable suggestions.
    if you don't understood also plz inform me..
    i will explain again...

    Hi,
    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
    page.
    Next Page:-
    Regards,
    Raghwendra

  • It is possible to programmatically disable the "Executing Code Modules in an External Instance of CVI" feature?

    It is possible to programmatically disable the "Executing Code Modules in an External Instance of CVI" feature within a CVI project?
    I know how to do it manually (Configure > Adapters... > Adapter Configuration).
    Thanks in advance,
    --M

    Yes. TestStand 2.0 added the Engine.CVIAdapter_ExecuteStepsInCVI property.

  • Is it possible to programmatically start the CAN Bus Monitor?

    Is it possible to programmatically start the CAN Bus Monitor?  I was unable to find the executable, so either I'm not looking in the right place or it's built into NI-CAN or MAX.
    Message Edited by FlamingYawn on 05-24-2007 06:19 PM
    Robert C. Mortensen
    Certified LabVIEW Architect
    Certified LabVIEW Embedded Systems Developer
    Endigit

    Indeed it is.  I found the executable at c:\Program Files\National Instruments\NI-CAN\bin.  It won't run by simply clicking on it, you must call it with the can port (e.g. CAN0) as the first paramenter.
    Robert C. Mortensen
    Certified LabVIEW Architect
    Certified LabVIEW Embedded Systems Developer
    Endigit

  • Nested Sub Reports - is it possible?

    Hi, Please could someone tell me if it is possible to have a sub report within a sub report. I have tried without success. If not what is the alternative? Thanks in advance
    Amir

    Before you go and submit to Idea Place think about this...
    Report Design Example:
    Main report returns 100 values which are linked to the first subreport. Query sent to the DB for the first 100 values and passed to the subreport, for each value returned a new query is sent to the DB for each value returned by the main report.
    101 queries processed by the DB server.
    Now say you pass that value into another subreport within the subreport....
    Original query sent from the main report, the first value is then sent to the first subreport and then that value is sent to the third subreport.
    1 -> 1 - > 1, in total you have:
    1 -> 100 -> 100 or 1 * ( 100 * 100 )  = 10001 queries being processed by the DB Server.... And this is simplied, image it your main report returned 100,000 values....
    So no, the whole point of using subreports is to use them for different data sources. You can filter your data and use Groups in the place of subreports, then you are unlimited ( sort of ) as to how many drill downs ( subreports ) you can go....
    Thanks
    Don

  • The glass of my ipad2 was broken but the unit with its touchscreen is still working, it was bought in verizon, is it possible to be replaced?

    My Ipad2 fell and its glass wasbroken.  It was bought in verizon,  Is it possible to be replaced?

    Apple do a replacement (accidental damage isn't covered by the warranty - in the US the price for repair (i.e. replacement) is (from here) :
    iPad model
    Out-of-Warranty Service Fee
    New iPad
    $299
    iPad 2, iPad
    $249

  • Is it possible to pass a formula value from a sub-report to a main report

    Hi there,
    Im trying to pass a formula value from a Sub-report back upto into my Main report but the value doesnt seem to be getting passed up. Ive tried it the other way around, that is, passing a value from the main report to the sub-report and that works fine.
    Below is an example of what I am trying to do but it is not working. In my sub-report Ive declared a formula variable as,
    formula name=main_subIntRatePageCount
    Shared NumberVar subIntRatePageCount := TotalPageCount;
    and in the Main report Ive declared the formula variable as,
    formula name=subIntRatePageCount
    Shared NumberVar subIntRatePageCount;
    subIntRatePageCount;
    I want the value assigned to "subIntRatePageCount" in my Sub-Report to be available to my Main report.
    The problem I am trying to solve is that the sub-report is spilling over onto two pages, and I need a way of updating the page display on the main report to reflect this. The page display is of format, "displaying page 1 of  3", but its not taking into account the extra page produced by the sub-report, so it should say "displaying page 1 of 4".

    Also thanks Raghavendra, Asha,
    I've tried adding the "whileprintingrecords" statement but that doesnt seem to make any difference.
    I notice that the subReport is being called from my the GroupFooter section of the main report, and I am trying to reference the variable in the main repot in the Page Footer section. Could it be that the variable hasnt been calculated in the Page Footer by the time I calculate it in sub-Report? I thought Crystal Reports does at least 5 passes over the report evaluating all the formulas before it prints the report?
    The problem Im trying to solve is I need to know how many pages my report will have before its completed, so that i can print the statement "displaying page 1 of X", and X is currently not being calculated correctly because the sub-report is printing onto 2 pages and not 1 so the report thinks I have 1 of X pages and not X+1.
    Regards
    Robert.

  • Programmatically adding sub report

    Post Author: [email protected]
    CA Forum: General
    hello friends.
    is there a way to programatically or dynamically load sub reports to the main report apart from creating on Demand sub report.
    like i habe 10 sub reports like a.rpt, b.rpt, c.rpt
    now on the basis of some logic or some programming condition , i would like to load one report at a time to the main report. or two report to main report. or all the three reports to the main report depending on various condition.
    is there a way to do it programatically.
    if yes, kindly provide some code.
    Thanks
    Manish

    Post Author: synapsevampire
    CA Forum: General
    Try posting technical information rather than "like I have 10 reports".
    Crystal versionDatabase/connectivityExample dataExpected output
    Try placing the subreports in their own sections, then use the logic (try posting details...) in the suppression for each section.
    If you don't suppress the section the subreport will fire and display.
    -k

  • How to show all view tab (Main Report and all Sub Report) in Visual FoxPro 9

    I use ActiveX from Crystal Report Developer XI for viewer in Visual FoxPro 9 and I already know how to show Main Report by using command:
    oRptRun=createobject("CrystalRuntime.Application")
    oRptView=thisform.oleRptViewer
    oRptOpen=oRptRun.OpenReport('MyReport.rpt')
    oRptView.ReportSource=oRptOpen
    oRptView.ViewReport
    Inside the MyReport.rpt there is two subreport name :
    1. MySubReport1
    2. MySubReport2
    My Question is :
    How to show all view tab (Main Report and all Sub Report) at the 1st time we call ViewReport?
    I try to using command :
    oRptRun=createobject("CrystalRuntime.Application")
    oRptView=thisform.oleRptViewer
    oRptOpen=oRptRun.OpenReport('MyReport.rpt')
    oRptSub=oRptOpen.OpenSubreport("MySubReport1")
    oRptSub=oRptOpen.OpenSubreport("MySubReport2")
    oRptView.ReportSource=oRptOpen
    oRptView.ViewReport
    but only show Main Report (view tab name : Preview)?
    Did I miss any command before I call oRptView.ViewReport?

    Your right, there is only one tab to view the report.
    To open the subreports you will need to click on them in the main report. I don't know of a way to open them programmatically like you are doing here
    http://diamond.businessobjects.com/robhorne</a>

  • Sub Report Performance problem

    Our current software configuration is Microsoft SQL Server 2008 R2 (10.0.2531.0) where our data is housed. Our User Interface is Microsoft Visual Studio 2008 (Visual Basic) and Microsoft .NET 3.5 SP1 platform.  We use Crystal Reports 2008 (12.0.0.683) to do our reporting.
    We upgraded from Crystal Reports XI and our reports are taking a long time to render?... Is there any evidence of other companies experiencing this trouble? Are there any degraded performance issues when moving from XI to 2008?
    In some cases we utilizing a small simple sub report.
    Any help appreciated. Thanks.

    Hi Billy,
    Subreports in detail sections are never a good idea. Example, you have 100 records returned int he main report and if that field is your subreport link it causes the subreport to run 100 times. Your database is being queried 101 times.
    Also, the default time out for database is typically 1 minute, could be you need to verify your report and database so CR can "clean up" any wrong pointers.
    It's always better to do the data collection server side if and when possible, after all that's what they do best.
    Not much detail to go on so I can't say if it's a report design problem other than the above or not. It could be also that .NET takes time to load all of the CR assemblies so depending on how you have your app configured depends on the delay. If you load a dummy report when your starts up to pre-load CR runtime then subsequent reports will be much faster.
    Also check off all of the Verify Database options, you may be telling CR to verify each time which on big databases can cause a delay also.
    Thank you
    Don

  • Open an on demand sub report in a new window

    Hi There!
    While reading the forum threads, there is an thread that have the same issue that i want to find out, but the thread is not yet answered. Could you guys help me. Thanks!
    Thread by: Kylie Edwards  
    Hi I am wondering if it is possible to open an on demand sub report in a new window.
    I have a report that has 6 level drill and I want to be able to close the information in the sub report to give the end user the ability to keep drilling.
    I have tried inserting a text box with a hyper link back to the main report but hyper links do not seem to work the subreport. "
    Thanks and Regards,
    Joni

    Hi all,
    Sorry for the late reply, and thank you guys for the helped. I manage to solve the problem myself
    To Falk:
    Ya you are right, for what i know,  Inforview is not possible to open a subreport from a RPT file in a new windows as well.
    To Wallie Cheng :
    When i posted the question for help, i just want to know if i could display a crystal report on a new window.
    My situation is that i have a page that is size 3in x 3in ( Just a small static graph ) and i wanna attached a A4 report. In order to have a nicer view at inforview ( 3in x 3in border box ), i will need to reduced the size of the crystal report. The size of the main report is now properly change, but it affects the view for the sub report ( As subreport is A4 size, the system display the A4 size document in a serveral 3in x 3in page. -_-"' ).
    To Abhishek:
    I wanna try out your solution, but i can't find the hyperlink tab in perference option ( in inforview ).
    I manage to solved my problem (suitation that i have explain to Wallie Cheng ). That is to created a hyperlink to the report. Rather than a subreport link.
    Thanks and Regards,
    Joni

  • Can i inactivate a sub report?

    Hi,
    I'm using sub reports in a principal report.
    When the final user see's the report, he can clic on the sub report witch will show in a second page.
    I would like to disalbe this action, is it possible?
    If not do you know a trick to prevent it?
    For know, i place a label on top of the sub report. like that, if the user click on the sub report, the clic will fall on the label and not on the sub report. the limit of this issue is that many of my sub report grow depending on it's containt. In this case, the label doesn't protect any more the sub report.
    I'm using Crystal Report (Basic, version 10) that works with Microsoft Visual Studio.

    Hello, Helen;
    The method to stop drilldown has a wide scope. It will stop the drilldown on the subreport but it will also stop any other drilldown you may have designed. Groups for example.
    In code, use the Crystal Reports Viewer object:
    CrystalReportViewer1.EnableDrilldown = False
    'Set the viewer to the report to be previewed
    CrystalReportViewer1.ReportSource = crReportDocument
    Elaine

  • Crystal report input prompt..for sub report

    Hi All,
    I developed crystal report and retreived the fields from the exsiting Query.Now for  enhancing the report i must creat a sub report for th eexisting one.In this case iam getting 2 input prompts one for the old report and the other one is for the enhanced sub report .But the requirement is tha t, the report must get only one input prompt for both the reports. Is this can be possible from the Query end or the crystal report end?
    YVL

    Hi Vijayalakshmi
    You can apply just one input parameter for the main report and then link your subreport with this parameter.
    Once you link the subreport, you would get only one prompt for inputting parameter values.
    This way you can optimize the performance of the report as well.
    For more information about linking subreports you can refer to the user guide for the respective crystal reports version you are using.
    Hope this helps!!!
    Regards
    Sourashree

  • How can I replace an existing report?

    The way our Enterprise server is setup, we have a folder that we publish all reports to. This folder is proteced from view from anyone but admins.
    In order for our users to "see" a report we create a shortcut of the report in their User folder.
    This works well, with one exception. When we need to put a new revision of a report out there, we have to recreate all of the existing user shortcuts. There is no way to "replace" an existing report (and inherit its underlying "ID" in the sql database) and have all of the shortcuts use the new report. This is especially painfull when the reports are scheduled to run. All the the scheduling/parameters/etc ahas to be recreated after the new report is publised to the server.
    I assuem there is some way to accomplish this with the SDK. I was wondering if someone can point me in the right direction. I am rather new to DOT Net development (about a year), but I have been writing "C" and "C++" code for 20 years, hopefully I can figure this out..
    Thanks in advance for any input!
    Shayne

    Don't have a C# version, but here's a VB.NET version:
    Private Sub Page_Load(ByVal sender as System.Object, ByVal e As System.EventArgs)
        Dim boUsername As String = "Administrator"
        Dim boPassword As String = ""
        Dim boCmsName  As String = "TUEDA-BEXIR2S2"
        Dim boAuthType As String = "secEnterprise"
        Dim rptPath As String = "C:\ASP_NET\update_doc\302810928JDBC.rpt"
        Dim query As String = "Select Top 1 * From CI_INFOOBJECTS " _
                              & " Where SI_KIND='CrystalReport' " _
                              & " And SI_INSTANCE = 0 " _
                              & " And SI_NAME='302810928ODBC'"
        Dim boSession As EnterpriseSession
        Dim infoStore As InfoStore
        Dim reports   As InfoObjects
        Dim report    As Report
        Try
            boSession = (New SessionMgr()).Logon(boUsername, boPassword, boCmsName, boAuthType)
            infoStore = New InfoStore(boSession.GetService("", "InfoStore"))
            reports = infoStore.Query(query)
            report = reports.Item(1)
            report.Files.Item(1).Overwrite(rptPath)
            report.RefreshProperties()
            infoStore.Commit(reports)
        Finally
            If Not IsNothing(boSession) Then
                boSession.Logoff()
            End If
        End Try         
    End Sub
    Sincerely,
    Ted Ueda

  • Struggling with a one to many relationship in a sub-report

    Post Author: Scott_tansley
    CA Forum: General
    I have a database schema as per below: tblENQUIRY                 tblDatasheets                  tblReportParasIRSID (PK)       1 --> &  IRSID (FK)                       UID (PK)Attribute1                     SHEETID (PK)     1 > &  SHEETID (FK)Attribute2                     Attribute1                         LIST_ORDER                         tblStandardParasAttribute3                     Attribute2                         PARA_CODE (FK)    & < 1   CODE     (PK)etc...                            Attribute3                                                                     TEXT                                   etc...
    The PROBLEM I am a Crystal Reports Newbie, and having to work through things bit by bitu2026  I've managed to achieve quite a lot, but I'm totally stuck with this and would appreciate some help. I need to create a report (essentially a letter and some datasheets) around a one-to-many relationship, which I have managed to compile using a main report (for the one &#91;tblENQUIRY&#93;) and sub report (for the many &#91;tblDatasheets&#93;).  Essentially I need a covering letter, then the u2018manyu2019 datasheets, and then a number of other pages (which are largely static text). I have created a main report which includes the covering letter, holds a subreport for the datasheets, and then contains the text for the additional pages.  This all works fine, and I get the correct number of datasheets for each main report. My problem stems from the use of this sub report.  This sub-report needs to hold some attribute values for each datasheet, which is fine.  However, on each datasheet page I need to have some paragraphs, which are held in another one to many relationship.  Each datasheet may have up to six paragraphs held as a code in tblReportParas, with a relationship to the text as held in tblStandardParas. My original thought would have been to embed another sub report, containing the values from tblStandardParas!TEXT, into the first sub report.  However, I have found that it is not possible to have a sub-report inside another sub-report.  I had seperated the first sub-report out from the main report, and then embedded another sub-report into it.  This worked fine until I tried to stitch the sub-report back into the main report (at which point the sub-sub-report dissapeared from view). I have therefore reworked my sub-report a little, and the attribution is now stored in a pageheader, with the tblStandardParas!TEXT in a detail section below it.  This almost works! The only problem is that there is no relationship between the pageheader and detail sections.  To clarify, I would expect to have one datasheet, with the attribution at the top, and then the six paras below.  Then, the same on the next page (assuming there is a second datasheet) for that report.  Instead, I get the correct attribution, but the detail section actually gives every paragraph in the database, no matter which datasheet/or report it related to!  I therefore need to limit the detail section to only show those paragraphs where the SHEETID in tblReportParas is the same as the tblDatasheets SHEETID. Any offers of advice would be appreciated.

    Post Author: Scott_tansley
    CA Forum: General
    I managed to resolve this myself in the end.  I moves the tblEnquiry data into report header/footer sections, this allowed me to add the tblDatasheets information into the details section, which gave me multiple pages - and then finally, the Paragraphs were added through the use of a sub report. 
    There's probably an even better way, but for now it works, it's quick - and so I'm going to go with it!
    Thanks for your interest.

Maybe you are looking for