Ireport Default Parameter value Expression - jasper-reports

I have a report consisting of two parameters
Start_Date
End_Date
I want to write an expression in Ireport where the parameter Start_Date display first day of the year (2018-01-01) by default as parameter value
Example today's date 2018-10-18 I want the parameter Start_Date to have this default value as 2018-01-01
Is there any expression in Ireport which can display 2018-01-01 as default value. (First Day of Year)

Set the Default Value expression of your Start_Date parameter field to this:
"01.01." + java.util.Calendar.getInstance().get(Calendar.YEAR)
It sucessfully generated a report for me.
The same should work for your other parameter, e.g. with the last day of the year.

Related

Crystal Reports: using date from the datatime field as a parameter

I am working on a report that I need to add a date range parameter. The field that I need to use in the datetime field, and I need to use the date portion from the field. I tried using the following, but the report returns no result.
cast(StartDateTime as date) between {?StartDate} and {?EndDate}
For the time being, I am using the Select Expert to sort the date range, but I have to manually enter the date in 'yyyy-mm-dd' format. Is there a way to set up the parameter, so that I can use the calendar to choose the dates?
I recommend to use one parameter field and set it to range and date instead of two.
With this you can use easily this formula:
{StartDateTime} = {?Parameter}
If you set the Parameter to Date instead of DateTime it will automatically check with the start of the day for the first range and the end of the day for the last range.

crystal reports function for calculating a value based on date range parameter

I need to calculate Sum of certain field value based on the date passed as parameter to the report.
I Need the following Calculations of value based on the date passed as parameter to the report:
Calculate the field value from 1st of the month to the date passed as Parameter.
Calculate the field value for the last month of the date passed as parameter.
Calculate the field value for the Previous day of the Date passed as parameter to the report.
Create a formula following this logic:
IF <Some Condition> Then Value ELSE 0
Then, simply SUM that formula.

How to extract month from a date in SAS

I am trying to extract a month from a date in SAS, but so far all my new month variables are coming up as missing.
I have attempted to use some combinations of the month() function in SAS, but so far it just comes up as missing. The dates are formatted as follows: 01/31/2017 (MMDDYY10.)
I have tried
month = month(end_date)
Month =catx('/',put(month(end_date),z2
I would like the Month to show up as a number (01) or a 3 letter code (JAN), currently it is just missing (.)
Thanks in advance!
For month() to return a missing value the end_date variable must be numeric and missing. If end_date were a character variable the log would show invalid numeric data.
Use the monname3. format to convert a date value to a $3. character value mon
monthname = put (end_date, monname3.);
Other alternatives are:
keep the date value unchanged and change the format, or
map the date value to the first of the month value and also format that
For example:
end_date_copy = end_date;
format end_date_copy monname3.;
end_date_month = intnx('month', end_date, 0);
format end_date_month monname3.;
What you ultimately do depends on how the mon is to be used downstream in reporting or aggregating.

How to add a integer field to date field in maximo?

I need to add a integer field to the date field then output value should be in date format.
For Eg: frequency is integer field and certdate is date field i wrote a Set Value action in which I need to set the summation of both values to the Nextdate field(Date) and i am using db2.
If having a Value of :certdate + :frequency and a Parameter/Attribute of NEXTDATE isn't working for you, you'll need to revert to an automation script or Java class that uses the Date and Calendar classes to do what you want.

date conversion in SSRS

I have startdate and enddate as parameters in my report..
and in query I am checking condition
where (date BETWEEN (#BeginDate) AND (#EndDate))
the date field in database is in '2012-06-18 00:00:00.000' format.
so do i need to do any conversions in the query..
I m getting no results in the report..
I also tried where (CONVERT(varchar, date , 101) BETWEEN (#BeginDate) AND (#EndDate))
still no results.
Please advise.
If the date field only ever contains the date part (time part is always set to zero) then adding 1 day to the end date will return everything for '2012-06-18'.