Print Page | Close Window

Resenting date to null in a shared date variable

Printed From: Crystal Reports Book
Category: General Information
Forum Name: Announcements
Forum Discription: Please check this section for the latest announcements from Crystal Reports Forum
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=18271
Printed Date: 29 Apr 2024 at 12:44am


Topic: Resenting date to null in a shared date variable
Posted By: brent21090
Subject: Resenting date to null in a shared date variable
Date 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



Replies:
Posted By: hilfy
Date 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


-------------
Proviti, Data & Analytics Practice
http://www.protiviti.com/US-en/data-management-advanced-analytics - www.protiviti.com/US-en/data-management-advanced-analytics


Posted By: brent21090
Date Posted: 19 Dec 2012 at 5:43am
Thanks for your help. It worked. :)



Print Page | Close Window