SSRS 2016: Can't set a default parameter value - sql

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!

Related

UniQuery LIST without page breaks

This should be simple but it's just not working. I have a list of records that I want to display in the terminal without anything besides the list of record keys. No Headers, page gaps, etc. The problem is I can't get rid of the page gaps that keep chopping up my list.
SORT INVENTORY HDR.SUPP COL.HDR.SUPP NO.PAGE NO.SPLIT COUNT.SUP
You need to change your TERM settings, ignore the 'type' option.
Increase the TERM 'B' (HELP TERM) to the total number of records you are returning.
For example if the report contains 100 records, you enter:
: TERM [to get default settings]
: TERM 80,100,132,60
: run LIST/SORT
: TERM A,B,C,D [ use values from first TERM ]
You need to run the term command prior to running your select.
Just in case you're trying to get this list of bare keys so you can copy/paste it somewhere else (like Excel), I'll throw out another option that may be helpful and save some scrolling:
:sort INVENTORY TO DELIM 9 /tmp/inventory.txt
Will run your command and dump the output (tab-delimited, though that's irrelevant with only one field) to a file in the tmp directory.
:UDT.OPTIONS 91 ON
Is helpful if you're dumping dates, numbers or anything that needs output formatting.
UDT Options Command reference describes that:
UDT.OPTIONS 91 U_LIST_TO_CONV
affects saved queries on
data that is defined in the dictionary with a conversion code. For
example, when a date is defined as D4, the internal date is 9611,
which the conversion code translates as 04/24/94. UniData does not
convert the data before it saves UniQuery results to an ASCII file.
With UDT.OPTIONS 91, you can force the conversion before UniData saves
the ASCII file.

Cognos Report Author 10.2.1 and Drill-thru parameters

I have a unique issue that I need to deal with. I have Multiple Drill-Thru running from Source to Target Report. So, Report A has multiple Drill-Thurs
from each Intersection to different Drill-Thru Reports. It was a little tricky
but I got it working.
So, now, I have to use a item value or parameter to send from the Source to the SAME EXACT Target Report but for different filters that the Target Report can use to show different information.
So, Source A ---> Target A, based on parameter or Value of "Jaguars" and the Target will return only "Jaguars" information.
If Source A ---> Target A, based on parameter or Value of "BMW" and the Target will return only "BMW" information.
Since there is no parameter in the Prompt Page for the Car Type, I have to some how setup a value as "Jaguar" and send it as a value to the Target report. Same thing for the "BMW".
So, does anybody knows how I can setup a value in the Source and send it as a part of the Drill-Thru definition to the Target Report.
Thx so much for your time.

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...)

Set Reporting services parameter value in subscription as current date

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))

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"))