10-05-2016 06:27 AM
Based on the documentation for SP report Definitions I'm trying to link to Current User and Current User Time Zone. I cannot find any information on how to connect to those 2 Parameters. I have tried renaming parameters to 'Current User' and 'CurrentUser' and no luck.
Any help would be appreciated.
Solved! Go to Solution.
10-25-2016 08:12 AM
The version that you're using is a developer build from 11.5(1) release. The feature was probably only partially implemented. Please use an FCS box - the version is 11.5.1.10000-86.
10-06-2016 02:02 PM
The 2 Automatic Parameters "Current User" and "Current User Time Zone" are not usable in CUIC due to a major bug.
The bug stems from the fact that CUIC makes the SP call with Positional passing of the data
"exec sp_Mysp 'Value1','Value2' "
rather then Referential passing of the Data.
"exec sp_Mysp @Param1='Value1',@Param2='Value2' "
This Bug is aggravated with the way Automatic Parameters are assigned.
1 ) Report Definition -> Data Source -> Create Parameters
2) Report Definition -> Parameters
The parameters are organized in the way they map to the SP and not Alphabetical.
The assignment of the Automatic Parameters is done on the Create Parameters Screen and take the Position # based on the Alphabetical Listing.
Ex.
(1) @CU
(2) @CUTimeZone
(3) @DateFrom
(4) @DateTo
(5) @Filter1
(6) @Filter2
SP is created as
(1) @DateFrom
(2) @DateTo
(3) @Filter1
(4) @Filter2
(6) @CU
When the call will be placed the mapping will be as follows
call SP_MySP 'CurrentUser','TimeZone','Filter1',null,null,null
call SP_MySP @DateFrom,@DateTo,@Filter1,@Filter2,@CUTimeZone,@CU
causing SQL error and lots of issues.
Ways to Fix.
1) let the Automatic Parameter Assignment happen on the Parameter Screen so that it could obtain the proper sequence.
2) Change the Call to Pass In referential Parameter Name Such as
call SP_MySP @Cu= 'CurrentUser',@CUTimeZone='TimeZone',@Filter1='Filter1',@Filter2=null,@FromDate='2016-10-01 12:30:00',@ToDate='2016-10-05 12:30:00'admin!@@@@@@@
10-06-2016 10:41 PM
In the parameters tab, it allows you to re-order the parameters. Does this help?
10-07-2016 07:04 AM
That is not useful in any way at all as you lose Ordering sequence from the actual SP.
You would have to rewrite the SP and put the Parameters in Alphabetical order.
That is a lot of work and in some cases not doable as you would need to create new SP's since old reports might use the same SP's.
In your scenario Reordering on the Parameter page would create the same problem but a different sequence. The parameter page has Physical sequence but once you change the order on the Parameter page you create the same problem.
So in effect parameter page is also broken. As trying to Sequence the parameter for easy presentation to the user causes you to lose positional reference to the correct Parameter location. This causes the same issue.
This all stems from the fact that you are using positional reference rather then Parameter reference.
Please Fix this Bug
to see this effect Please use your case.
@param2,@Param1,@param3
SP has been created with sequence @Param1,@Param2,@Param3 what will happen is
@Param2 - > @Param1
@Param1 -> @Param2
@Param3 - > @Param3
If Param1 = Agents and Param2 = Teams ... You see the problem ?
compound the problem .. Make @Param2 = Datetime field and you will have a SQL conversion error as it tried to convert
'Agent Name' into Datetime.
10-11-2016 10:08 AM
to see this effect Please use your case.
@param2,@Param1,@param3
SP has been created with sequence @Param1,@Param2,@Param3 what will happen is
@Param2 - > @Param1
@Param1 -> @Param2
@Param3 - > @Param3
If Param1 = Agents and Param2 = Teams ... You see the problem ?
compound the problem .. Make @Param2 = Datetime field and you will have a SQL conversion error as it tried to convert
'Agent Name' into Datetime.
So, with the order I have in my image, the SP's 1st parameter will get the value of param2 in the RD (report definition), 2nd parameter will get the value of param1 in the RD and so on. And it will result in the error you mentioned.
But you can always re-order the RD's parameters to match what you have in the Stored Proc. So I am not seeing where the issues is.
If you have an example stored procedure for which this is not working, please give me the definition of it and I will try to see how it can be resolved. May be I'm missing something in this form of communication.
10-12-2016 07:20 AM
GO
CREATE procedure [dbo].[Test222]
@From datetime = null,
@To Datetime = null,
@DayWeek nvarchar(200) = null,
@TimeZone nvarchar(100) = null
as
select @From as FromDate,@to as ToDate,@DayWeek as dw ,@TimeZone TZ
GO
Create Report Definition.
Configure the Parameters
Create report for the report definition.
Select the parameters
Expected results
DW = "Mon:Tue:Wed:Thu:Fri", TZ="UTC" , From="10/12/16". To="10/12/16"
Real Results in error.
{call [Test222]('2016-10-12 00:00:00','2016-10-12 23:59:59','UTC','TEST')}
Per your suggestion reordering Parameters in Parameters tab.
Run Report same parameters.
{call [Test222]('UTC','2016-10-12 00:00:00','TEST','2016-10-12 23:59:59')}
Report execution fails SQL error
Msg 8114, Level 16, State 5, Procedure Test222, Line 0
Error converting data type varchar to datetime.
Now do you understand what I have been trying to explain?
Also Anonymous Block does not support Automatic parameters "Current User Timezone and Current Username"
So I cannot use Anonymous block as the mapping of the Parameters to call the SP.
declare
@From Datetime =:From,
@To datetime =:To,
@DayOfWeek nvarchar(200) =:DayWeek,
@TimeZone nvarchar(100) =:TimeZone
exec Test222 @From,@To,@DayOfWeek,@TimeZone
10-14-2016 04:58 AM
Let me test this out and get back to you.
10-14-2016 06:54 AM
Also Please explain how it was created as an automatic parameter and yet it's prompting me to enter a value.
If I make it null able then it gives me Null. So it gets overwritten. For an Automatic Parameter I should not be getting any prompt at all since the system will be passing in the value.
10-16-2016 08:59 PM
Here are the steps I used and I didn't face any issues for the same stored procedure:
(By the way, what version of CUIC are you using? I am looking at 11.5(1) - yours look like 11.0(1) or older).
01 - Create the fields:
02 - Fields List (second tab on Report Definitions):
03 - Parameters List (I made sure that TimeZone is the last parameter - because the SP has it as the last one):
04 - Created a report and then ran it - Choosing Filters (Notice the timezone being automatically picked):
05 - Show SQL on the executed report (TimeZone is the last parameter):
10-19-2016 08:18 AM
So you are saying the issue has been fixed in 11.5 the current version i'm running is
Version11.0(1) build 1 (11_5_0_99000_546)
Also looking at your test case I have a slight worry as the Date range selected is "Today"
and the dates passed in are
From :'2016-10-17 00:00:00',
To: '2016-10-17 00:00:00'
Should the date range not be passed in as
From :'2016-10-17 00:00:00',
To: '2016-10-17 23:59:59'
Your day Range is pretty short as only records happening between '2016-10-17 00:00:00' and '2016-10-17 00:00:00'
which means not much.
Also is your TimeZone on the Datasource different or the same as your user Timezone as I do not see any offset.
Please validate if this is a bug.
10-25-2016 08:12 AM
The version that you're using is a developer build from 11.5(1) release. The feature was probably only partially implemented. Please use an FCS box - the version is 11.5.1.10000-86.
05-25-2017 01:51 PM
Yes issue has been fixed in 11.5 or later releases!
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide