Solved

Need to print null if the query doesn't return any value

Posted on 2008-06-12
10
395 Views
Last Modified: 2011-09-20
Hi,

I have crystal report with sub report (sum of open balance). the query associated with sub query return result. But the query associated with main report doesn't return any result. So the sub report also doesn't show up in the report even though the query returned the results.

Is there a way to print the subreport even if the main report query doesn't return any values.

Note: sub report query just get the parameter from main report query, that is the reason why it brings results.

Ravi
0
Comment
Question by:Ravi_Jaganathan
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
10 Comments
 
LVL 13

Expert Comment

by:crgary_tx
ID: 21769847
Always get a dummy value from the main query even when the query results is zero though you dont have to display on the report. Modify your main query to something like this:

select* from
                (select acct_id, 'dummy' as dummy from
                ci_acct
                where acct_id = '13434'
                ) main_query,
                (select 'dummy' as dummy from dual) b
            where main_query.dummy(+) = b.dummy
     
hth..
Gary
0
 
LVL 42

Expert Comment

by:frodoman
ID: 21770686
Does the main report sometimes return results or does it never return results and is only a holder for the subreport(s)?  If it never returns results then just simplify the main query:

   select 'dummy' as dummy from dual

frodoman
0
 

Author Comment

by:Ravi_Jaganathan
ID: 21770701
most of the time main report retrun the result
0
On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

 
LVL 13

Expert Comment

by:crgary_tx
ID: 21770948
You should be trying the query I have suggested.

select* from
                (
                 <your main report query>
                ) main_query,
                (select 'dummy' as dummy from dual) b
            where main_query.dummy(+) = b.dummy
     

Incase your main query is blanck the modified query brings just one record something like below which is suffiecient to print the subreport. You can always supress the record using detail supression formula

Field1 Field 2 Field3....Dummy  Dummy
Null     Null     Null        Null        Dummy

hth..
Gary
0
 
LVL 42

Expert Comment

by:frodoman
ID: 21772276
Gary is correct - I was pointing out a simpler approach *IF* your main report was intentionally blank.  If there is supossed to be data sometimes then use the approach that he suggested.
0
 

Accepted Solution

by:
Ravi_Jaganathan earned 0 total points
ID: 21804398
Actually I created a union which bring a null row if the main query doesn't return any rows.
0
 

Author Comment

by:Ravi_Jaganathan
ID: 21804424
Thank you for your help
0

Featured Post

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question