Jump to content

Need to leave a blank when a specific date appears in a field.


jonathan2260

Recommended Posts

I have a field that is a timestamp. I switch it to a date field so that I only get the date portion.

Most returns on the field have a real date and for a reason I don't know, when the customer has never used the services, there is a date in the field of 1899-01-30 (or something close to that, I don't have it in front of me) instead of being empty. I think it has to do with how this database handles the info.

Now in Crystal report, it seems that it was smart enough to figure out that this was not a valid date and therefore would not display that date without any special tricks.

I'm using iReport 3.5.1 and would like help on a way to keep it from appearing. Leave it blank when that date shows up and display all other dates that appear in the field so that I replicate the report as it was in Crystal format.

Thanks for the help.

 

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Ok. I ended up able to get help.

Here was the results. I had to convert it to string using toString then use a substring to get rid of anything beyond the date (because it is a timestamp) and end up doing a compareTo the unwanted date to tell it to leave a blank if it is the same and display if anything else.

($F{DATE}.toString().substring(0,10).compareTo("1899-12-30") == 0) ? "" : $F{DATE}.toString().substring(0,10)

I can say this was well over my head but hopefully I learned a few things out of this today. I'm posting it here in case it might be useful to others.

Also, a correction on what I had said before about Crystal Reports. It`s not able to automatically avoid display a date. There was a formula telling it to not display it. I just didn`t know where to look.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...