Why does SSRS Independent parameter is cascading by default - sql

I have a report which currently has four parameters
1) BatchID
2) ProductName (dropdown parameter populated based on the batch ID)
3) StartDateTime (Date/time parameter with default value set to =Now)
4) EndDateTime (Date/time parameter with default value set to =Now)
When I run the report the StartDateTime and EndDateTime are greyed out why? As they are independent parameters I would have thought it will be enabled by default.
The next question I have is the delay, after entering the first parameter the second parameter is populated as expected. However after selecting the second parameter from the dropdown. There is a delay of over 30 seconds to populate the StartDateTime and EndDateTime parameter(s) with the current datetime.
I don't know if I did a good job in explaining my question. Any help.

Note that the problem of having a disabled date type of parameter for SSRS only occurs when the date/time parameter’s default value is an expression like =Now. If the default value is not set or is set to a literal value like 1/1/2018, the control functions as expected — it is enabled.
"Parameter order is important when you want to show users the default value for one parameter before they choose values for other parameters"
Ref:http://msdn.microsoft.com/en-us/library/cc281392.aspx
The controls after non-default parameters are disabled the user picks something, so order is important. The date/time control won’t be enabled until it evaluates its default value expression. It is stated that the delay you mentioned here is intended to allow this parameter’s expression to use the proceeding parameter’s value in its computation.
Ref2: https://bengribaudo.com/blog/2011/03/02/595/ssrs-datetime-parameter-disabled-when-default-value-expression-is-used

Related

Fluent assertion to verify DateTime field is not empty

var dte = "2021-12-18T15:06:33.2677927Z"
dte.Should().
I want to check that this dte is not empty.
Currently I am using :
dte.Should().BeAfter(new DateTime());
From the example, your definition of an "empty" DateTime seems to be one different from the default value.
If you're looking for a more readable/idiomatic way to express that, I would go with
DateTime subject = MethodUnderTest();
subject.Should().NotBe(default);
For the general case, one cannot speak of an "empty" DateTime since even the default value is just the minimum representable valid datetime, namely 0001-01-01T00:00:00.
So all of these are identical.
DateTime.Parse("0001-01-01T00:00:00")
default(DateTime)
new DateTime()
DateTime.MinValue
DateTime.FromBinary(0)

How to keep initial value of a field after POST is done

I have an Oracle Forms app. There is a form with a date field and I need to keep it initial value (when form is loaded), to compare it with actual value in the field. Also there is a button on the form, that posts changes.
I've tried to store initial value with global variable and check if it's changed, also I've tried to simply check that :system.record_status != 'QUERY' to track if date is modified.
Problem that at the moment, when button is pressed and post is done the values of all global variables become null, so I can't compare the initial value with the new one and :system.record_status becomes 'QUERY' again, and I don't see any more if user modified something.
How to keep the initial values or track that data was changed, doesn't matter if user posts changes or not?
This:
Problem that at the moment, when button is pressed and post is done the values of all global variables become null, so I can't compare the initial value with the new one
doesn't work that way. Post (if you refer to POST built-in) (nor COMMIT, as we're at it) doesn't clear global variables. Explicitly setting it to NULL does, so - check the form whether you've done it somewhere in your code. How? Run the form in debug mode, trace its execution and see what's going on.
Another thing that might be going wrong is that global variables's datatype is CHAR so - if you plan to compare it to a different datatype value, you should perform conversion. As it is a date value, consider applying TO_DATE function to the global variable with appropriate format mask.
this will work:
IF GET_ITEM_PROPERTY(:SYSTEM.CURSOR_ITEM,UPDATE_COLUMN) ='TRUE' THEN
Copy(Get_Item_Property(itm, Database_Value), :System.Cursor_Item);

Setting the value of prompt to current date

How do you possibly set the value of a prompt(date) to the current date when the user does not input any value? I always get invalid datatype error no matter what I do. :(
This is my prompt:
Maybe my format is wrong but I have tried, NVL, setting default value on prompt settings and always get the same error.
Try entering %Date as the default value.
It should populate the prompt with the current date when the query is executed.
You will also need to uncheck the "optional" flag, as a prompt with a default value cannot be optional.
On the criteria, you should define an expression as a decode (since you are on oracle), like this:
EFFDT = DECODE(:3,' ', SYSDATE,:3)

SQL Report Builder Error: Argument not specified for parameter 'DateValue' of 'Public Function Day(DateValue As Date) As Integer'

I'm quite new to Report Builder, and looking to apply the solution from this question to a report I'm working on. I have #startDate established as a Parameter, but trying to set its value to = dateadd(day, 1 - datepart(dayofyear, getdate()), cast(getdate() as date)); gives me this error.
The Value expression for the report parameter ‘startDate’ contains an error: [BC30455] Argument not specified for parameter 'DateValue' of 'Public Function Day(DateValue As Date) As Integer'.
Now, I can set the Default Value of #startDate to =Today() and it works fine...except for the fact I can't change the date from that in the report itself, without establishing some Available Values. However, whether the above expression is set to Available or Default Values, the report crashes with that error message.
I would like to keep =Today() as the Default Value, with the above expression as one of the Available Values. Can anyone explain to me what I may be doing wrong, and the most sensible solution to it?
Try set this as your default value within Report Builder itself, Parameter properties - Default Value - fx:
=DateValue(CStr(Year(Today())) + "-01-01")

In SSRS, how do I make a drop-down parameter visible only if a previous parameter has one option chosen?

I have a situation where I want to make a drop-down parameter visible only if a previous multi-drop-down param. has one choice chosen(out of many choices).
Wht i've triedso far is to set the Default Val. for the drop-down parameter to be this:
=iif( Parameters!AccountIDs.Count >0 , 1, Nothing)
But it's not working. any tips appreciated, thanks
You won't be able to make a parameter disabled or enabled like this. (At least not without getting really complicated and hacking the page a bunch)
But you can make the second parameter have dynamic available options. Then make it just a sinlge option such as "<Not applicable>" and select that if the earlier parameter has multiple values.
You will need to create a dataset that returns the available parameters. Something like this might work:
SELECT
'<Not Applicable>' AS ParameterValue
WHERE
#ParamOneCount > 1
UNION ALL
SELECT
SourceName
FROM
someTable
WHERE
#ParamOneCount = 1
(You could change replace the second SELECT with multiple selects to have multiple hard coded values.) Then in the parameters for this dataset, set one of the parameters to be called "ParamOneCount" and set its value to be =Parameters!Account.Count