Report has two parameters
DateFrom
DateTo
DateTo set to "Always Refresh"
I have the following expression for DateTo - Default Values - so that it will dynamically default to the last of the month set by DateFrom
=DateSerial(Year(Parameters!DateFrom.Value), Month(Parameters!DateFrom.Value), "1").AddMonths(1).AddSeconds(-1)
However, the field doesn't update.
It shows the correct last date of month when DateFrom is selected the first time.
If DateFrom is set to 15/02/2019 then DateTo will show "28/02/2019 23:59:59".
But if you subsequently change DateFrom to a different month, DateTo doesn't update - still shows "28/02/2019 23:59:59".
I have just added these Parameter properties
1) data type -> date/time and allow nulls
2) available values -> specify values -> label and value as
=DateSerial(Year(Parameters!Datefrom.Value), Month(Parameters!Datefrom.Value), "1").AddMonths(1).AddSeconds(-1)
3) Advanced=always refresh. and checked notify me box.
This works the moment i change param 1 ('Datefrom') i get new dateto as last date from month.
Are your settings matching this?
Related
I am creating an SSRS report where I need to have a parameter called Status and the values would be "Current", "Former", or basically selecting both of them in terms of display both Current and Former.
This parameter will reference a date column and if the (date is NULL OR date > GETDATE()) then they would be considered "Current"
If (date is not NULL AND date < GETDATE()) then they would be considered "Former"
I've tried using in the WHERE clause (WHERE DATE #NULL OR DATE > GETDATE()) and similarly with the "Former" parameter value, but I am not sure if in SSRS if it's possible to pass the IS NULL and IS NOT NULL to these parameter values.
Sample of table data:
Name Date
John NULL
Bill 2/27/2021
Bob 2/1/2021
So in this example, John is "Current", Bill is still "Current", and Bob is "Former".
I think what you're looking for is this:
WHERE (#param = 'Current' AND (Date is NULL OR date > GETDATE()))
OR (#param = 'Former' AND Date <= GETDATE())
OR #param = 'All'
As jarlh said, you don't need to check for "is not null and less than" in the second line.
Not sure what you meant by "basically selecting both of them" so I assumed a third option for "all". If the parameter being null triggers that instead, you should be able to change the last line to:
OR #param is NULL
Then "NULL IS NULL" would satisfy the third condition and bring back all rows.
I have an issue with SOQL within a query activity in Salesforce Marketing Cloud Automation Studio.
I want to update null values with birth dates of users in a column named "date of birth" that includes birth dates of a ton of users with datatype = date.
I want to update this column, "date of birth", based on another column named "date of birth 2" which also includes birth dates of a ton of users but instead with datatype = string.
Thus, my goal is to be able to update only the missing date fields in the column "date of birth" leveraging data from the column "date of birth 2".
With my current very simple code (see img 1/2), I either update nothing in the data extension (when the WHERE column = NULL is added, see img 2) or I update the null values but also overwrite the existing date values in the data extension (when there's not added a WHERE column = NULL, see img 1). I wonder if it possible to simply update the null fields and let the currently filled fields stay?
Looking forward to hearing from you and please tell me if my query is unclear!
So I think you can query on the object where your (date of birth) field is equal to null and (date of birth 2) is not equal null.
SELECT (date of birth),(date of birth 2) FROM objectName WHERE (date of birth) = NULL AND (date of birth 2) != NULL
Please make sure your (date of birth 2) field must be in YYYY-MM-DD format.
Sample code.
List<objectName> li = [SELECT (date of birth),(date of birth 2) FROM objectName WHERE (date of birth) = NULL AND (date of birth 2) != NULL];
for(objectName o : li){
(date of birth) = Date.valueOf((date of birth2));
}
update li;
I have two parameters in my Report - Begin and End Dates which are of Date/Time type. When I select the Begin Date from the Calendar, how do I automatically show dates equal to or greater than Begin Date for the End Date calendar? I would like the have the user the ability to select only End dates after Begin date.
This could be a potential workaround going off the comment I made to your question. You would need three datetime parameters:
-#1 StartDate
-#2 EndDate
-#3 EndDate2 - make this hidden
The StartDate and EndDate (#1 and #2) are for users to select. For the report, we will use StartDate (#1) and EndDate2 (#3) to filter.
You can set the default for StartDate/EndDate however you would like. For EndDate2, if the user selects a date prior to the start date, default the end date that gets passed to the report. We set this by adjusting the default value for EndDate2 parameter with the IIF function to compare the user input dates.
Add this to default value for EndDate2 parameter:
=IIF(Parameters!EndDate.Value < Parameters!StartDate.Value, Parameters!StartDate.Value, Parameters!EndDate.Value )
I need to select from a table that has two fields , a start date and an end date , selecting the row that the current date is. Look at the image ...how do i select the row that encompasses the date range 91/201 - 9/15/2018 ? Somehow this was flagged as a duplicate. I am NOT attempting to find overlap. I am attempting to find the row that represents a given date. Say , one table has a field that has the value 9/5/2018 ....how do I select the row that has a start date of 9/1/2018 and end date of 9/15/2018
EXPLAINATION
I have 2 parameters in SSRS report: Year and Month
AVAILABLE VALUES
Available values are selected from dropdown list (could be multiselected values).
Year available values are selected with SQL query;
Month available values are from 1 to 12.
DEFAULT VALUES
Default values for now are:
Year expression: =YEAR(NOW())
Month expression: =MONTH(NOW())
WHAT I NEED
If for parameter Year user change default value and select 2 or more values (i.e. 2015 and 2016) It automatically should select all values for Month parameter (select from 1 to 12)
Also I have custom value in both parameters: All, if value All is selected It's the same as select all values from the list.
How can I achieve It?