Announcements
 Crystal Reports Forum : General Information : Announcements
Message Icon Topic: Resenting date to null in a shared date variable Post Reply Post New Topic
Author Message
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Topic: Resenting date to null in a shared date variable
    Posted: 14 Dec 2012 at 10:03am

Hi Team,

I need help with below.
 
How do  you resent the date in a shared date variable? I had created the formula below  in the subreport.
 
WhileprintingRecords;
shared DateVar myDate := date({Schedule.App_DtTm});
 
I need to know how to resent the value and also test for dates that do not exisit and if a date does not exisit in my subreport to print 0
 
Thanks for  your help


Edited by brent21090 - 17 Dec 2012 at 10:12am
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3702
Quote hilfy Replybullet Posted: 18 Dec 2012 at 8:21am

You may or may not be able to set a Date type to null.  I think you'll probably have to convert to string if you want to do that.

So, in your main report, you'll have a formula like this that will initialize the date:
 
Shared StringVar myDate := ""
 
Place this formula in a a section above where the subreport is located.
 
Change the formula in the subreport to something like this:
 
WhilePrintingRecords;
Shared StringVar myDate := ToText({Schedule.App_DtTm}, "MM/dd/yyyy")
 
Note that I left the semi-colon off the end of this - in order to get the value out, you should do that on the last line of any formula that returns a variable.
 
Then, back in the main report you'll use something like this to display the value:
 
WhilePrintingRecords;
Shared StringVar myDate
 
-Dell
IP IP Logged
brent21090
Newbie
Newbie


Joined: 20 Apr 2009
Online Status: Offline
Posts: 31
Quote brent21090 Replybullet Posted: 19 Dec 2012 at 5:43am
Thanks for your help. It worked. :)
IP IP Logged
Post Reply Post New Topic
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



This page was generated in 0.032 seconds.