Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Suppress dateTime Field 1

Status
Not open for further replies.

LizRCD

Technical User
Feb 1, 2005
5
US
In the "Format Formula Editor" I am trying to suppress a dateTime field. What do I use at the end of this formula instead of the "", which does not work for dates -

if ProperCase ({jomast.fpartno}) >= "a" then
DateValue ({jodrtg.fcomp_date})
else
"" //the error is "a date is required here".

 
if ProperCase ({jomast.fpartno}) >= "a" then
cstr(DateValue ({jodrtg.fcomp_date})) // must be text here as well
else
"" //the error is "a date is required here".

 
You could just leave the else out of the statement, in which case it will return a null which shouldn't be displayed.

-Dell

A computer only does what you actually told it to do - not what you thought you told it to do.
 
You cannot mix data types within a formula (dates with strings, numerics with dates, etc.), hence your problem.

The 2 solutions address it by either converting the date to a string, or by eliminating the error message.

Since you're already using the datevalue function, perhaps it's a string to begin with? If so , just build out the if then without the datevalue function.

I would use something like:

if ProperCase ({jomast.fpartno}) >= "a" then
and
isdate({jodrtg.fcomp_date}) then
totext({jodrtg.fcomp_date})
else
"invalid date: "&{jodrtg.fcomp_date}

Of course this is based on the data type of the field {jodrtg.fcomp_date}, which you didn't share.

-k
 
I did a toText -

if ProperCase ({jomast.fpartno}) >= "a" then
ToText(DateValue({jodrtg.fcomp_date}))
else
""

but now I get "The formula result must be a boolean"

The same messege occurs when I take the else out of the statement.

 
You don't state where in the Format Formula Editor you're using this, nor why you do so in there?

You should be using the code as a standalone formula, not in format editing.

If you'd posted the version of your software I'd have provided the exact menu choices for creating a formula, unfortunately you did not. Hit F1 to learn how to create a formula and use it in lieu of your table.field

-k
 
Thank you for your response - it was because I was using it in format editing not a standalone formula.

I will remember to include more information if I have any additional questions.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top