Technical Questions
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Technical Questions
Message Icon Topic: Displaying the values in a Report Post Reply Post New Topic
Author Message
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Topic: Displaying the values in a Report
     Posted: 25 Jul 2008 at 4:31am
Hi,
I'm using a number column(id) in my report which can fetch the value from the oracle data base. I would like to format the report such a way that if the value of the id is null then it has to disply "no data found for the given input".
I tried if statement.
 
 if length(cstr(id)) >0 then
  actual value from the database
else
"please enter correct values"
 
Its not giving me correct result as expected. could you please adivce.
 
Thanks
 
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 25 Jul 2008 at 4:36am
try something like this

if isnull({table.IDfield}) then
"no data found for the given input" else

{table.IDfield}


Hope this helps.

Sarah
IP IP Logged
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Posted: 25 Jul 2008 at 6:02am
Hi,
Thanks for writing to me. I tried the following

If IsNull({table.ID})  Then
   "Nodata found for the given input"
Else
  totext({table.ID},0) 
 
' totext used else its showing error like it should be a string.
 
 
if i enter the prompt values which DON'T produce the result from my oracle stored procedure then I'm seening the the report as blank. But I wish to see   "Nodata found for the given input".
 
case(ii) : Once I execute the report with new prompts and provided values which are having the data then its showing the value in my report.
 
Please advice.
 
Could you please advice.
IP IP Logged
saoco77
Senior Member
Senior Member


Joined: 26 Jun 2007
Online Status: Offline
Posts: 104
Quote saoco77 Replybullet Posted: 25 Jul 2008 at 6:24am
I misunderstood the question - I believe this should work.

if recordnumber>1 then "" else "No data found for the given input"

Sarah
IP IP Logged
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Posted: 25 Jul 2008 at 7:07am
Hi,
Thanks for the quick reply. we are close to the solution and need to put a small fix.
I tired the following
 
if recordnumber>1 then totext({table.ID},0) else "No data found for the given input"
 
Even if I enter the Parameter values which fetch the data from the datase and give the result for these also the report showing ""No data found for the given input"
meaning even the ID have value its giong to else block.
 
Let me know if you want me describle the problem again.
 
Thanks for looking into...
 
 
IP IP Logged
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Posted: 28 Jul 2008 at 12:28pm

Could some one advice any thoughts on the above situation.

Thanks

IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 29 Jul 2008 at 12:55am
Hi
 
What I think is you are checking the parameter value of ID entered buy user with ID field in your database ?
 
do the following
 
Right click on  Details Section and Select Insert Section below which will create Detailsb Section.
 
Now Create a formula
 
frm1
if isnull(count({Table.ID})) or {Table.ID} <> {?My Parameter} then
'No Data Found'
Now go to Detailsa section right click select Section Expert then in Common Tab Select X+2 for Suppress(No Drill-Down) and enter the code below.
 
isnull(count({Customer.Customer ID})) or {Customer.Customer ID} <> {?My Parameter}
 
Now Place the formula Frm1 in your Detailsb section.
 
Don't forget to check in your record selection formula for
{Table.Customer ID} = {?My Parameter}
 
Cheers
Rahul
IP IP Logged
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Posted: 29 Jul 2008 at 6:02am

Rahul,
Thanks for writing to me. we no need to think about parameter in this case.
Assume that in the report  we have fileds as ID , msg , date
I have the parameters as p_id,P_date. User may or may not enter the values to the parameter.
my report calls a oracle stored procedure which build the sql st dynamically during runtime and execute.
incase user didn't enter value don't worry. My procedure prepare the SQL based on the SYSDATE as default for p_date.

case(i) : user enter date as 07/10/08
ID     msg  date
---------------------------------
50     dataerror  07/10/08

No issue -- looking good.
 
case(ii) user didn't value for any parameter.
in this case SQL treate the data as sysdate and execute the query.
assume that no results for the today in the database.
ID     msg  date
---------------------------------


in this case report is showing as blank.Insted of showing the report as blank. I would like to put a message saying "no data found" in the report.

To do this just we can check the value of ID in the report. if its displaying any value fine else "no data found"
we no need to check the rest of the field values to say "no data found"

Note : Id is a not null field in the database (PKey).


Thanks.

IP IP Logged
rahulwalawalkar
Senior Member
Senior Member
Avatar

Joined: 08 Jun 2007
Location: United Kingdom
Online Status: Offline
Posts: 731
Quote rahulwalawalkar Replybullet Posted: 29 Jul 2008 at 7:55am
Ok
 
What happens to ID field what value is passed in case(ii)
 
for date -sysdate
for ID - it is null or spaces ....
 
try checking for spaces and you will need parameter checking  let me know
 
also try checking if count(id) < 1 then 'No Data Found'
Cheers
Rahul
IP IP Logged
Ashok
Newbie
Newbie


Joined: 23 Jul 2008
Online Status: Offline
Posts: 16
Quote Ashok Replybullet Posted: 29 Jul 2008 at 8:00am

in case(ii) ID is null. user will didnt touch that parameter at all.

Thanks
IP IP Logged
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum