Set Reporting services parameter value in subscription as current date - sql

In reporting services SQL server , when I created a subscription for a report with parameter as date time type, I don’t know how to set up value of the parameter as current date (wherever the subscription is running).
I tired Today(), Today, today, #ExecutionTime. But none of them worked for me. Only a specific date worked eg: “11/11/2010 00:00:00”.
I also tried to hide the parameter but the subscript still required to fill the parameter. For the "default value” textbox did not allow the value “Today()”, “Today”, etc.
Thanks in advance!
Helen

You need = to make it an expressions
= Today()

You can't put "=today()" in the text box prompt at runtime. You have to setup the parameter's default value as "=today()" in visual studio.

Try Data Driven subscription and pass a SQL Statement to return the current date for the parameter value.

The following code worked on my case:
parameter1.Value = Date.Today()

Actually I did that in visual studio and it worked well in preview (display the current date by default for the parameter and allow people to select other date) .
But for some reason, the subscription setting still asked me for the parameter value (as in the early post "Report Parameter Values").

On the report parameter configuration (on development time, not on the subscription creation), add a default value for the parameter. If you do, you will have a check box called "use default value" when creating the subscription

I tried it as well but it did not work for the subscription.
Sorry I can not attach the screen shot in the post currently.
In Subscription screen shows:
Report Parameter Values
Specify the report parameter values to use with this subscription.
Date To = Today()
Regards,
Helen

If you want to default the report parameter to the current date in the short format, you can set the default value of the parameter to the expression:
=CDate(FormatDateTime(Now, DateFormat.ShortDate))

Related

SSRS 2016: Can't set a default parameter value

I’m having a problem selecting a default parameter based on previous cascading parameters.
My report has the following parameters, all required:
• Start Date (Defaults to yesterday)
• End Date (Defaults to yesterday)
• District (Where they worked)
• Field Reps (Who worked)
When the user selects one or more Districts, a stored procedure fills the FieldReps parameter selector with a list of workers who worked in that district during that date range. That list can change from day to day, which makes it hard to set up a subscription to this report.
My solution was to add a field rep with a code of 'ANY' to the FieldReps data set and set it as the default. That way, the report will only include any workers who worked during the date range. This option makes it possible to subscribe to this report. If the user selects 'ANY', the report will return a valid list of workers for the default date range, which is 'yesterday.'
But: I want 'ANY' to be selected by default. But it doesn’t work!
My source dataset provides available values for the FieldReps parameter. (Value is FieldRepCode, Label is FieldRep) An ‘ANY’ entry is added to the top of the list by the stored procedure.
If I specify 'AL06' as the default value (that field rep is in the list), it is selected by default. But if I specify 'ANY', no default is selected.
I’ve checked to ensure 'ANY' has no leading/trailing spaces. I even suspected case sensitivity, so I ensured the case matched. I used an expression (="ANY") to set the default value. None if it made a difference.
Any ideas why this isn’t working?
Thanks!

Using datepicker in DotNetNuke-7 module

I'm a DNN beginner. I am currently building a module in which I can display statistics. My DotNetNuke Version is 7.0. The statistic is from Chartjs. For this statistic I would like to implement filters. These filters should be datepickers. As UI element I have now included a textbox with TextMode='Date'. But currently I have problems to set the default value of this field. The default value should be 01.01. of the current year.
I have already tried to set the value via C# server side. Unfortunately without success. I also tried to set the value on the client side via JavaScript. Unfortunately also without success.
These are some lines I tried in JavaScript:
document.getElementById(<%= this.DatumVon.AccessKey %>).value = "01.01.2019";
document.getElementById(<%= this.DatumVon.AccessKey %>).innerText = "01.01.2019";
document.getElementById("DatumVon").value = "01.01.2019";
These are some lines I tried in C# in the method "Page_Load" (server side):
this.DatumVon.Text = "01.01.2019";
I expected the value of the TextBox to be 01.01.2019. However, it currently only contains dd.mmm.yyyy. How can I change this?
Thank you.
There is something wrong with your localization. Please refer to the jQuery UI datepicker documentation (the "Localization" section), this should give you the answer.
wow... I solved it. I made it. Sometimes the solution is right in front of you and you don't see it. Michael Tobisch was absolutely right. When setting the value, the format is very important. I have always used the German format. A DNN TextBox with TextMode="Date" can't handle that. DNN converts this TextBox into an HTML input field. But this input field can only be clear with the format "yyyy-mm-dd". Depending on the geographical position of the client (at least that's what I think) the text displayed in the input field will be formatted. But the value of the input field always has the same format ("yyyy-mm-dd"). So very important here: the displayed text and the actual value have different formats.
Many thanks again to Michael Tobisch for the mental inspiration and the patience with me.
What is also important is that the access to the actual ID of a DNN element works as follows: this.Element.ClientID and not as I assumed before this.Element.AccessKey. This was also buggy.

Dialog box appear

I'm using decode for my query but when every time I run my query, there's a two dialog box appeared and need to input some number in those dialog box before to see the result. What should I need to remove it?
Please help me.
Thank you.
Here's some of my query..
SELECT (CODE_SALESROOM) POS_ID
,DECODE(CODE_SALESROOM, '60001', 'ABM SYSTEM'
,'50001', 'Acenet Unlimited Business Computer'
,'40002', 'RL My Phone - Robinsons Galleria') AS POS_NAME
FROM OWNER_DWH.DC_SALESROOM
WHERE CODE_SALESROOM NOT IN ('XAP', 'XNA', '10001')
Sounds like you're being prompted for substitution variables, because part of your query has somethling like and col = 'AT&T' - the ampersand is interpreted as a variable by default, and you're prompted for a value for &T (or whataver your actual value is interpreted as).
You can add set define off to your script to stop it looking for, and prompting for, a value when that is not what you want.
(The links are for SQL*Plus documentation, but much of that applies to SQL Developer as well; the documentation for that is a bit sparser),

Selecting a datetime range in YII input form

Here is the problem.
I have to create a submission form on my Yii-based website. The form requires to enter a datetime range.For that I am using "jui datetimepicker" third-party Yii extension.
http://www.yiiframework.com/extension/datetimepicker/
I use two date fields with this extension pertaining to start and end time respectively. So, what I want to achieve is be able to restrict the start datetime only to time in the future (neither past dates nor time should be selected) and the end time itself should be restricted to the maximum of three hours following the start time.
EXAMPLE: a user wants to schedule an event. They choose a date and time, which are of course in the future. Let's say they choose March 15, 13 O'clock as the start time in the start time field. Once they are done and move to the next field ("end time"), the respective datetimepicker restricts the range of time from March 15, 13:00 to March 15, 16:00.
Hence the second datetimepicker should be dynamically updated depending on the input of the first one.
It's possible o specify date range in the datetimepicker starting from the current date, but there is nothing like that for the time selection, so a user still can select time which has already passed.
It's not that I want to solve this problem with this extention, if anybody has any suggestions about YII solutions allowing to specify a datetime range in the most clean and effective way - it would be much appreciated.
You should use the edaterangepicker extension instead.
Given the API for the jquery timepicker addon. you should add the following to your widget call (along side 'model','attribute', etc)
'options'=>array(
'minDateTime'=>'<start dateTime here>',
'onSelect'=>'<JS function to run>'
)
The function you run on the "onSelect" event should dynamically set the minDateTime for the second dateTime input field, for ex:
function (selectedDateTime){
<EndDatePickerElement>.datetimepicker('option', 'minDateTime', <start dateTime here using selectedDateTime> );
}
There are more examples on the link provided earlier if you need to make it even more precise (like say if you wanted the starting date to be pushed back by the amount of time the user was on the page rather than it being set when the page was loaded. etc...)

Problem with default values for Reporting Services parameters

I have a SQL 2005 Reporting Services report that has several report parameters. One of them is called IsActive and is of type Boolean. The parameter is hidden and set to allow null values. For its default values settings, I have it set to null. In my application that has the reportviewer control, I have logic that decided whether or not to set this parameter to a value (true or false). There are conditions that require it to be not set at all. For some reason, if I do not pass a value, the parameter defaults to TRUE. It operates fine when a value is passed. Is my problem stemming from the simple reason that it is a Boolean parameter? Would changing it to a string be better?
Thanks!
Changing it to a string is only necessary if there's no way to get it to take the NULL value because of a bug or "feature".
Don't know if this is related...
I had a problem where I could not get the default value to be selected when viewing the report from outside of the BIDS after making changes to the report.
It turned out that the parameter settings was not updated when deploying the report.
Changing the settings manually via the Report Manager or removing and re-deploying the report solved the problem.
IIf(IsNothing(Fields!BooleanField.Value) , "-- Any --" , IIf(Fields!BooleanField.Value = True , "Yes" , "No"))