There was a problem loading the comments.

Date Expressions Are Not Displaying For My Date-Based Parameters And A DateTime Expression Example

Support Portal  »  Knowledgebase  »  Viewing Article

  Print

Problem:

The date expressions are not displaying for my date-based parameters.

Answer:

Make sure your parameters are actually a date datatype and not a string. Also make sure they are not date-time instead of date or modify the date expressions to be date-time.

Under Tools, Expressions, you'll find various date-based expressions. 

These expressions get added to the left-side parameter drop-down list in the Parameter window. They are added to the list based on the datatype of the parameter.

Examples:
"today" is always equal to today's date
"firstdaymo" is first day of this month

You may have to tweak the datatype to get it to match your parameter (date vs datetime).

You can even create your own expressions if you don't see the one you need listed. There is a lot of power there, even creating SQL-based expressions that fetch a value from a SQL table and apply it to a parameter.

If you need any help creating an expression, just describe the value you need or are wanting to do, and send it to us in a ticket. We will gladly create the expression for you.

---

Here's an example of creating a two date-time expressions. One for very beginning of month and one for very end of month (including the time). 

Create two new expressions (under Tools, Expressions):

1) FirstDayMoDT (and set the datatype for date/time):

formatdatetime(now() - day(now()) + 1,2) & " 00:00:00"

2) LastDayMoDT (and set the datatype to date/time):

FormatDateTime(DateSerial(Year(Now), 1 + Month(Now), 0),2) & " 23:59:59"

By setting the expressions to a datatype of date/time, that means they will only be displayed in the expressions drop-downs in the parameter edit windows when the parameter itself is a date/time datatype.

 


Share via

Related Articles

© Support @ Jeff-Net