SQL Reporting Services 2005 - Date field based on a user entered date? - sql

I have a report in report services 2005 that has two date fields. The problem is that if users run this for a large section of time it uses too much resources on our server.
It is possible to only allow the end user to enter the start date and then the end date be auto populated/derived from this field (for example they enter the 1st of a month and this automatically change the end date to the last of a month.)

Yes you can do this. Hide your end date parameter, edit the expression for the default value and do a dateadd function using the startdate parameter.

Related

In Oracle BIEE - Trying to Subtract Number from a Prompt Variable on a Filter

I have created a query in SQL that has date filters. I want to move this to Oracle BIEE so that a user can be prompted to enter a date and then the query runs to give the desired output.
Within Oracle BIEE I have created a dashboard and a dashboard prompt which connects to the report. In the Dashboard prompt I have created a presentation variable called "VAR1_EFFDATE" and I want to filter on dates equal to the "VAR1_EFFDATE" or equal to "VAR1_EFFDATE" - 1 day. The following is what I have at the moment:
WHERE b.EFFDATE between #{VAR1_EFFDATE-1}{'01-OCT-20'} and #{VAR1_EFFDATE}{'31-OCT-20'}
The second part "#{VAR1_EFFDATE}{'31-OCT-20'}" seems to be working at it picks the "VAR1_EFFDATE" that the user has entered and not the default ({'31-OCT-20'}). However, on the first part, it always selects the default ({'01-OCT-20'}) and the "{VAR1_EFFDATE-1}" just gets ignored. I have tried using #{TIMSTAMPADD(SQL_TSI_DAY, -1, VAR1_EFFDATE)}{'01-OCT-20'} and it doesn't seem to want to pick the prompted value minus one day either.
I was able to figure this out for those that are interested:
trunc(b.EFFDATE) in ((#{var_effdate}{trunc(sysdate)-1})-1 , (#{var_effdate}{trunc(sysdate)-1}))
Instead of having a static date of 01-OCT-20 and 31-OCT-20 I used the current date (sysdate).

Problem using java.time.LocalDate as process-variable in jBPM - Business Central

I'd like to use a process-variable to retrieve and store only date, no time information. Therefore I've defined a java.time.LocalDate variable in my process. Then in a taskform, where user should be able to enter a date, I entered a form-control of type DatePicker and unchecked its "show time" property. My problem: the entered date isn't stored in the process-variable. If I check the "show time" property, then the user is being asked for a daytime too and the Date (without time information) is stored in the variable. How can I ask only for a Date and store only a Date?
Another question: I'm using the jBPM-server-distribution 7.36.0.Final and Dates in the DatePicker-Control have the format mm/dd/YYYY. Would it be possible to show Dates with the format dd/mm/YYYY?
Thanks for your help!

Check whether a form date field is equal to 1899-12-30 00:00:00.000

I know this should be simple but after hours of googling I am still failing...
I have a vb.net form application. Basically I have an SQL database with an Employee table with an EmpFinish column in datetime, null format (Employee Finish Date). The data is imported from a linked SQL DB (populated from an external app). Any "blank" dates show as 1899-12-30 00:00:00.000 in SQL.
The Employee table data is shown on a datagridview form, a row is selected, then I want to perform a check to test whether that rows EmpFinish date from the form is earlier or equal to today and is not equal to it's "blank" value i.e. has the employee left employment.
Code excerpt:
Dim currentDateTime = DateTime.Now
Dim selectedEmpFinishDate As DateTime =
EmployeesDataGridView.SelectedRows(0).Cells(5).Value
If selectedEmpFinishDate.CompareTo(currentDateTime) <= 0 Then
' code to do
End If
I didn't start out using the CompareTo() above util I started Googling this issue and it seems this is the best way to compare dates. Yes???
This test works for actual dates e.g. yesterday but also catches all 1899 dates, I have tried lots of tests (using 1 If statement of separate ones) to check for the 1899 blank dates but cannot get anything to work. If I debug the code at the test line, selectedEmpFinishDate supposedly equals #12/30/1899#. If I show the field value onscreen via
MsgBox("selectedFinDate = " & selectedEmpFinishDate) it reports as 00:00:00
I know this must be possible but cannot figure it out.
Could someone please offer a solution as I am running out of hair to pull out.
I have followed djv's advice (I had the same thought last night) and done an override to set these date values to NULL. I was then able to use IsDBNull() successfully.
To clarify where these dates came from... Data is imported into this database from another SQL DB created by a huge business software application. Not sure if they want the dates stored this way or whether the import sets them to be this "blank" default 1899 date.
They actually showed on all forms as 1899 etc so resetting them to NULL is the best option all around.
To anyone else who has these 1899 dates I would advise to update them to NULL.
Thank you to everyone who responded especially djv.

SQL query for limiting records

I have following SQL query in Data Flow, Control flow of SSIS package and I want to limit records by cutting off point, and that cut off point is current day/date from system. So, it should only display past records, not including todays. So, I think I need to use the specific field (which is date field - in the query its called 'FinalCloseDate' and compare with current system date and tell it to only to pull the records (perhaps < todays date) that happened before today or current system day.
Add
AND dbo.Producthit.FinalCloseDate < CAST(GETDATE() AS DATE)
to your WHERE clause.

Detecting weekends in SQL query for Access database

I have an MS Access database, in which the records of a table have a text field that stores dates in the form 29-Mar-14 (as text). I know, this is not a good database design, but this is how my client's database system was originally developed and I cannot modify it.
My questions is: How do I run an SQL Update command on this table, to be applied only on weekend records? So basically I need help in 2 points:
On how to write the SQL statement so that it treats the text fields of "29-Mar-14" as dates, and
On how to write the SQL Update statement so that it detects which dates are weekends.
Thanks!
The challenge here is that the CDate() function in Access will interpret '29-Mar-14' as 2029-03-14. So, you need to swap the day and year
CDate(Right(delivery_date,2) & "-" & Mid(delivery_date,4,3) & "-" & Left(delivery_Date,2))
The above will give you the true Date value. To determine if it is a weekend date, pass that date value to the Weekday() function and see if it returns 1 (vbSunday) or 7 (vbSaturday).