Select in (select ...) (select main report based on child records)

I have a Crystal Report XI rel 2 report but I need to narrow the search of the main report based on records in the child table.<br /><br />I have 3-tables and one report w/ a subreport.<br />The tables are locations, crashes, and vehicles.  The main report has the tables locations and crashes and the subreport has vehicles (one crash has 1 to n vehicles)<br /><br />How do I select records in the main report based on the child (see below SQL stmt.)<br />SELECT locations.county, locations.state, crashes.numpeople, crashes.time FROM locations,crashes<br />WHERE crashes.cid IN (SELECT cid FROM vehicles WHERE vehicles.vehicletype = &#39;Trailer&#39;);<br />

Hi,
 You can use common shared variables to share data between a sub report and the main report.
What Kathryn has suggested is correct but you must make sure that the sub report is run first and then the main report is executed.
 Hope this helps
 Cheers
 Sam

Similar Messages

  • Is it possible to suppress the Page Header of the Main Report based on the Section Name?

    Hi,
    I am fairly new to Crystal Reports XI.  Is it possible to suppress the Page Header of the Main Report based on the Section Name?  Thanks.

    In the section expert you can enter a formula on the suppress function.
    You just need something to check against if it is section name you say
    {section name} ="Suppressme"
    I have used it more in drill level to display headers based on how far you have drilled into a report.
    Hope this helps
    Eric
    Via Christi Health System

  • Data Selection for report based upon a 'Prompt Value'

    I want to report information in my report based upon a 'user input prompt value'
    for example:
    'Enter Shareholder Selection - A-Active, I-Inactive, B-Both Active and Inactive'
    if the user enters 'A', the report selects only active shareholders
    if the user enters 'I', the report selects only inactive shareholders
    if the user enters 'B' the report selects all shareholders, active and inactive
    the field in the database that this based upon is their total share value.
    if this field is greater than zero (>0) they are considerd 'active'
    if this field is equal to zero (=0) they are considered 'inactive'.
    I have tried creating some type of filter,  but am not having any luck. 
    I saw a few examples within the forums that I have tried without any luck....unfortunately most of the examples I've seen are base one only two choices.
    I'm sure I need to create some type of 'independant varible' but am not sure how to do that either.
    Any suggestions would be appreciated.
    Thanks.

    Hi Daryl,
    I Tried this unsuccessfully in DESKI . We can't Eliminate Rows having Empty Measure Values or Measure with 0 as values using Table Level Filter as FIlter can't FIlter rows based on Prompt value selection dynamically. Filters filter rows at a time and not based on 3 condition as Active, Inactive and Both. thus filters are of no use.
    I Tried this in WEBI, and it is working perfectly you donu2019t have to create any Object in Universe, you can do it using function UserResponse() at report level.
    Hence if you are comfortable using WEBI for Generating this report then Follow the steps.
    1. Create Report With Name and Shares Object. It will display all Shareholder Names and No.of shares they hold.
    2. Use Status Object in Query filter, use condition as u201CEqual Tou201D and Select prompt. It  contains Active, Inactive and Both as values.
    3. Report will Display all Shareholder names and No. of  shares  like 45, 789, 0, 4562 where 0 is inactive Shareholder and all other are active shareholder.
    4. Create Variable using Formula.
    =If(UserResponse("Enter Status:")="Active" And [Shares]>0;[Shares];If(UserResponse("Enter Status:")="Inactive" And [Shares]<=0;[Shares];If(UserResponse("Enter Status:")="Both";[Shares])))
    5. Remove Shares Object from the report and Put Variable created with Names of Shareholders.
    6. Select Table-> Properties-> Display-> Uncheck the Option u201CShow Rows with Empty Measure Valuesu201D
    7. Report will display Value correctly as per your Prompt value selection.
    I Hope this Helpsu2026
    Thanksu2026
    Pratik

  • Select expert: selecting sibling data based on one record's ID

    Hi All,
    Let's presume that I have two tables, company and contact. Contact carries the company ID.
    On my report, I have all contacts grouped by comapnies. (simple, huh!?)
    What I need to do is add a parameter that will allow a user to select an employee (id/name/ whatever, the condition is irrelevant to the question), and the report will display THAT employee, the company the employee works for, as well as all other employees who work for the same company.
    To rephrase, Given the ID of a child, I need to return all siblings.
    The obvious solution is to create a sub report that traverses the relationship up one level, and just pass that value as the linked value to the sub report filtered by parent records.
    Anyone have any clever ideas that preclude the use of a sub report? (or SQL command, or stored procedure)
    In the mean time, I'm using a sub report.
    Thanks,
    -R

    I've come up with a not-so-great work around, that seems to solve my problem.
    The additional part of my question is that I need to be able to do it from two sides of a bizzarely complecated three table relationship. A single sub report solution doesn't work. I was hoping for a more broadly applicable solution that didn't involve a sub report.
    What I've done is created a sub report to pre-process my parameters. In my situation, the detail records that I am interested in actually have two different unrelated parent records.
    So, if someone passes in a child record (other params would be null) then I get his parent record, and supress the rest.
    If someone passes in either parent, the report uses a shared string variable to create a list of records NOT to supress. ie: a list of all records that the parent IS related to.
    because my dataset is relatively small, and not likely to grow significantly, it doesn't present an issue to pull the whole data-set, and supress rather than filter, and because it's being presented in the HTML viewer, I don't have to worry about passing a bunch of data I don't need into the client cache. (not to mention that savvy hacker types can't get into the cached data that's present, but supressed)
    Yet another ugly Crystal workaround by Ryan! Hoorah!

  • Need to supress main report based on shared value comes from subreport

    Hi,
    I have a database that is used in both main report and subreport. On main report I have column a,b ,c, d,e,f to display in detail section, the subreport (column c, g,h etc) is also displayed on detail section, the link between main report and subreport is column a,b and a formula based on the value of c. So the link is within one database, some records link with other records  and display both matching records on one line(especially column c shows one value in main report and another value in subreport). That's why I need subreport and I can display the report correctly.
    Here is my question: if one record in main report couldn't find a match in subreport (subreport is blank), then I would like to show this record; if one record in main report does find a match in subreport, I don't want it to show(need to be supressed). I can define a shared variable to flag whether the subreport is blank or not, but this shared variable has to be placed under the section of subreport in main report and I don't know how to supress the upper detail section with subreport in it.
    Any help would be appreciated!
    Helen

    Hi
    In this case you need to insert the same sub report twise.
    Example :
    Detail a--Insert the sub report and go in sub report suppress all sections and using shared variables bring the value to main report.
    Detail b -- based on detail a sub report suppress the main report records
    Detail c-- Your actual sub report will display the values.
    Note : use the same links for your detail 'a' sub report which you are using for detail 'c' sub report.
    Thanks,
    Sastry

  • OBIEE 10.1.3.4 - Selection of reports based on prompts

    I have reports (requests) say 1,2,3 under category 'A', Reports (requests) 4,5,6 under category 'B'. Based on the dashboard prompt for Category, I need to display the corresponding reports(requests) in the dashboard. Can someone please help me do this.

    Hi,
    Can do this with guided navigation.
    Take two sections.Place reports 1,2,3 in section1 and reports 4,5,6 in section2.Create two intermediate report(Report1 & Report2)with only one column Category.
    Report1 - Add filter Category is not equal to B and Category is prompted in the report created and save it.
    Report2 - Add filter Category is not equal to A and Category is prompted in the report created and save it.
    Under Section1 Properties->Guided navigation->Select Reference Source Request to Yes->Browse and select the intermediate report Report1->Select Show Section to If request returns rows
    Under Section2 Properties->Guided navigation->Select Reference Source Request to Yes->Browse and select the intermediate report Report2->Select Show Section to If request returns rows
    Save it and run.
    Regarding guided navigation - http://bischool.wordpress.com/category/guided-navigation/
    http://gerardnico.com/wiki/dat/obiee/guided_navigation
    Regards,
    Srikanth

  • Narrative Reports based on multiple records

    Hi experts,
    We are trying to build email template via SOD report (similar to mail merge template, but the SOD report can retrieve data from multiple record types).
    What we are thinking is to use narrative report...but we are not able to create the report that first page only reflects the data from first record, 2nd page reflects the data from 2nd report, and so on. (something look like a letter, each page will merge with the data from corresponding record)
    Can anyone advise how to do the work?
    Thanks,
    Sab.

    Hi experts,
    are we able to create narrative report for multiple records? e.g. 1 single page narrative report, first page reflects the data of first customer record of the report, second page reflects the data of the second record, and so on.
    Please advise..
    Thanks in advance,
    Sab

  • Select where in (select ...) in the main report

    <p>I have 3-tables and one report with one subreport:</p><p> My first table is a lookup table of locations, the second table is the crash information, and the 3rd table is the vehicles involved in the crash.</p><p> In the main part of the report I have the locations and crash tables.  In the subreport I have the vehicle information.  <em>(One crash has many Vehicles)</em></p><p> I would like to select the records on the main report based on the child records (see below SQL stmt.)</p><p>SELECT locations.mp, locations.county, crashes.numberofdrivers, crashes.lane FROM locations,crashes where crashes.id IN (select * from vehicles where vehicle.type = "Trailer")</p><p> How do I create a Report->Selection Formulas->Record to mimic the SQL stmt.?</p><p>&#160;</p>

    Command Object

  • Dynamically select detail report for a master report link item or button?

    I'm still new to APEX, so apologies if this sounds like a stupid question, but so far I can't find anything online about how to do the following.
    I have a simple report, and I want to be able to drill down from here to a detail report via a link item (or a button) in each row. The problem is that the specific detail report to use depends on a combination of values in the parent record.
    So if I have a parent record in the master report with values for columns 1/2/3 of A/B/C, I would drill down to a detail report against table X. If my parent record has values of D/E/F, I might drill down to a different detail report against table Y.
    I can build the individual reports easily enough, and I can set up a link item in the master report to drill down to a hard-coded detail report page. I can even generate the name (alias) of the relevant target report as an extra non-DB item in each row of the parent report. But I can't figure out how to allow each row in the parent report to actually link to a different detail report dynamically, depending on the contents of the parent row.
    Can anybody suggest an easy way to do this, or point me towards an online resource that would explain how to do this (preferably in basic terms that this APEX-newbie can understand)?
    Thanks for your help!

    Hi,
    When you say "Detail report" do you just mean a normal report of the child records for the selected master record or a tabular form style "Details report"?
    Using different reports on a page would, typically, depend on the value in a hidden page item - for example, P1_REPORT_TYPE. Your link could pass an appropriate value into this item and the second page would then use this as a Condition for each of the report regions - each region being conditionally displayed when the hidden item is a specific value.
    Andy

  • How To Suppress Records In Subreport Based on Value in Main Report

    I want to supress records in the Details section of my subreport based on a value in the Details of my Main report (main report could have same record as subreport).
    I created the following formula with a shared variable and placed it in the Details section of my main report:
    WhilePrintingRecords;
    Shared StringVar sCertCode :={ACCPASCERT.CERT_CODE}
    I placed the subeport in the Group Footer of the Main Report.
    In the subreport, in the Section Expert I added the following formula for Supress of the Details section:
    WhilePrintingRecords;
    Shared StringVar sCertCode;
    sCertCode = {ACCJBCERTS.PERS_CODE}
    Unfortunately even though the value in the main report is the same as the value in the subreport, those records are not being suppressed in the subreport.
    Would appreciate any ideas.
    Thanks.

    Thanks Zilla.
    The group is not based on Cert_Code but on another database field.
    I can try linking on the Cert_Code. But, how do you make the link "<" ">" when linking the main report and the subreport. I don't see that as an option?
    Edited by: Giulia Smyth on Feb 27, 2009 4:05 PM

  • How To Pass Data Between A Main Report and a Subreport

    Hello,
      I'm working with Crystal Reports Professional XI. 
      I have a main report with two date parameters: BeginDate of Date type and EndDate of Data type.  The main report has no details being printed instead it's grouped by a formula field and displays a summary count at the group footer.  I have  a subreport that is not linkable to the main report.  The subreport is grouped differently.  It has no detail records being printed and displays a summary count at the group footer as well.  The two reports are using the same tables with the same linking relationship.
       I created the same two date parameters in the subreport but this isn't right because when I run the report then I get four Date prompts: BeginDate and EndDate parameter from the main report and the BeginDate and EndDate parameter from the subreport.
      I'm not dong something right here.  What do I need to change in the reports so that l have the same record selecton being passed from the main report to the subreport record selection based on the BeginDate parameter and the End Date parameter from the main report?  Right now, the subreport is selecting all the records in the tables specified.
      Have a great day.  Any feedback would be greatly appreciated.
    Thanks,
    Ting

    Hi Jason,
       Thanks for replying to my posting.  It's been awhile since I've worked on Crystal Reports so I'm getting reacquainted with sub-reports again.  
        By linking the main report to the subreport by the BeginDate and BeginEnd parameters, will the date parameters be passed from the main report to the record selection for the subreport?  
       Also by doing your approach when the user is prompted to run the report, will it display on the popup window four date parameters: the BeginDate and EndDate from the main report and underneath that the BeginDate and EndDate from the sub report?  If so I'm trying to avoid that because it would be the same date range that I'm wanting to use for the main report and the subreport.  
        I hope that made sense.
    Thanks,
    Ting

  • Crystal Report based on BW query

    We create a Crystal report (CR 2008 ) with the main report based on on Bex Query on an SAP BW Server based on an infocube and a sub report based on an SQL relational table (Table, cluster or SAP Functions) on the same SAP BW Server. The execution is Ok on the Crystal Client but when we deploy on the InfoView portal (and on CMC) we have only one connection defined (it seems it detect that it was the same server name and keep only the first connection).

    We don't use Universe (For Bex Query SAP don't recommande it) . The queries are directly embeded in the crystal report

  • Report based on a reord group - PROBLEM

    Using Reports Server / Forms/Reports 6i
    I am trying to run a report based on a record group on the web. It fails giving the error 'Cannot run report.'
    The report is called from a form and the record group is passed as a data parameter. It works fine in Client/Server.
    I have tried to remove the data parameter and run the report without it but, despite working in the Client/Server environment, it still fails on the Web.
    Does anyone have any suggestions?

    I have found the answer to my problem in the forms forum!
    Apparently, this type of report won't work on the web and I have to use temporary tables!

  • How to show a Page Total in a Main Report that is calculated in a SubReport

    Hi,
    I have a Main Report and a SubReport with the detail.
    The Report has several pages. I want to show a Page Total in each Page, retrieving data that is in the subreport (Detail).
    I tried to use a shared variable, but the problem is that the formula fields are assigned at the end of the subreport, so I can't pass the value back (to the main report) until the last record of the subreport is printed.
    I also can't show the Page Total at the subreport, because I have a particular format that I need to respect and only can be printed from the Main Report.
    Is any way to do this ? At this moment, with the shared variables I'm getting 0 until the last record is printed.
    Also, I can calculate the Page Total from outside Crystal Reports, do to there some fields that can grow, so I can't figure out how many record are going to be printed.
    Thanks in advance!
    Ariel

    hello, this may depend on how the main report was actually paging...
    1) do you have one group per page for example?
    2) is the sub on a group footer level?
    3) does the subreport use a different data set than the main report?
    some suggested workarounds would be to
    a) use a report header cross-tab (identical to the existing crosstab) that creates an array of values that you can access anywhere on the main report
    b) place an identical cross-tab above the existing one, and suppress all of the subreport sections (not the section where the subreport sits) and then bring the value back to the main report
    cheers,
    jamie

  • Can a subreport select records based on values in the main report record?

    Post Author: calvin
    CA Forum: General
    Perhaps my understanding of a subreport is incorrect as this is the first time I've used one, but it seems to me that the subreport should be able to use the values from the main report record in its (the subreport's) operations-but my subreport doesn't seem to be working that way.In my main report, I select a set of records from a 'request' table. I have a subreport in the detail section so the subreport is processed for each of the request records. That works, but I'm simply getting the same data reported multiple times. It's as if the subreport only uses the last request record rather than the current one. Stating it this way I can see that the problem might be evaluation time-it's processing the request records first, then processing the subreport, and only then printing everything. If this is correct then putting WhilePrintingRecords on the subreport should work-but the only way I know of to do that is in a formula. Can I call the subreport from a formula? Or am I totally off-track?Thanks.

    Post Author: foghat
    CA Forum: General
    Have you established a link(s) between your main report and subreport?When viewing the main report, click edit --> subreport links and link the 2 based on whatever values from the main report you want.

Maybe you are looking for

  • Why am I being charged for CC?

    Adobe charged my debit card 49.99 for a monthly CC payment, but I did not enroll in the program. I had enrolled for the one year CC trial at 29.99, but canceled after the trial period. I did, however enroll in the Photoshop Photography, Lightroom, Be

  • Problem with JTable in a JScrollPane

    Hello all, I have a problem using JTable, that the number of columns is very big, and the JScrollPane shows only vertical ScrollBar, isn't there any way to show a horizontal ScrollBar, to show the other columns without being bunched. Thanks in advanc

  • Report by Day/Week/Month/Year

    Hi All, I have the table showing below Empid     name     tikcetno     Completed date 694     anil     10051     23-Jun-09 695     madhu     10052     23-Jun-09 694     anil     10053     23-Jun-09 695     madhu     10054     22-Jun-09 695     madhu 

  • Full package name needed when using FindClass?

    When loading a class for use by the invocation interface, do I need to use the full package name of the class to be loaded, or just the class name? For example, I have a program called MyProg. It is part of package MyProg, and when I run it, I have t

  • Configuring Mac Mini to automatically play QT file on startup

    I'm trying to configure a new Mac Mini 2.3GHz running Lion to function as a very dumbed down media player for a video art piece which is being installed at a client's office. Basically, I'd like to configure it so that from 7:30am-7:30pm it continuou