SSRS Parse Error local report processing - reporting-services

Please I need your help 4 days i'm searching about solution for this error i have this code :
SELECT NON EMPTY { [Measures].[T POND], [Measures].[FACT TABLE Count],
[Measures].[disponibilite], [Measures].[POND], [Measures].[T] }
ON COLUMNS, NON EMPTY { ([DIM AXE GEO 2].[VILLLE].[VILLLE].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS FROM (
SELECT (
STRTOMEMBER("[dim_date_Debut].[PK_Date].&["+ Format(CDate(Parameters!FromDimDateDebutPKDate.Value),
"yyyy-MM-dd")+"T00:00:00]") : STRTOMEMBER("[dim_date_fin].[PK_Date_fin].&
["+Format(CDate(Parameters!ToDimDateDebutPKDate.Value),"yyyy-MM-dd")+"T00:00:00]"))
ON COLUMNS FROM [CubeDispo])
CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
This is the error when i deploy
query execution failed for dataset 'dataset1' query(4,93) Parser: the syntax for '.' is incorrect
Thank you in advance

Is something wrong with your parameter replacement in SSRS? It looks like maybe they are not being passed down? When I change:
STRTOMEMBER("[dim_date_Debut].[PK_Date].&["+ Format(CDate(Parameters!FromDimDateDebutPKDate.Value),
"yyyy-MM-dd")+"T00:00:00]")
To
STRTOMEMBER("[dim_date_Debut].[PK_Date].&[2010-01-01T00:00:00]")
The syntax is fine.
Firstly, run SQL Server Profiler, do an Analysis Services trace and capture the MDX that is being sent to SSAS from SSRS.
If the "Parameters!ToDimDateDebutPKDate.Value" is still in the MDX, then check how your parameters are being assigned to the dataset.

I see you are doing string concatenation to form your query. Make sure you use = operation to tell RS that its not a static query but an expression.
For example if i use this as a query in query designer, i would get an error.
"Select * from table where col =" & Parameters!FromDimDateDebutPKDate.Value
while the same thing with = operator before it becomes an expression which RS would evaluate before sending it to SQL
="Select * from table where col =" & Parameters!FromDimDateDebutPKDate.Value

Related

Parameter filter SSRS Expression Dataset

I have a dataset created from an expression that takes parameters from 3 other datasets.
I need to add a parameter to this that allows the user to input a value, and then the dataset will add that value to the where clause to filter the results displayed. If the value "Any" is input then the results will be unfiltered for this section of the Where clause (If that makes sense).
I wrote this and added it to the expression Where clause, but it is not working.
+ IIf(Parameters!RCode.Value = "ANY", "", " AND h.rcode = " + Parameters!RCode.Value + " ")
I can provide the rest of the where clause if it is needed, but if i remove this line, the whole thing works, if i add this line, it bombs out with
An error has occurred during report processing. (rsProcessingAborted)
Cannot set the command text for dataset 'DS'. (rsErrorSettingCommandText)
In the dataset query you can use parameter names by simple prefixing them with # eg. #RCode
To make it work, your WHERE clause should be look like (I assume your column name is rcode):
WHERE ....
AND (#RCode = 'ANY' OR rcode = #RCode )
For multivalue parameters
WHERE ...
AND ('ANY' IN (#RCode) OR rcode IN (#RCode) )

SpagoBI OLAP report passing optional parameter

Helo. Today is my another fight day with OLAP raport with optional parameter. I have problem with MDX query. I wrote it like this:
select
NON EMPTY {{[Measures].[VALUE]}} ON COLUMNS,
NON EMPTY {
IIF(ISEMPTY([CUSTOMER].[${param}]) //CHECKING IF PARAMETER IS EMPTY
,{[CUSTOMER].[COUNTRY].Members},
{[CUSTOMER].[${param}]}
)
}ON ROWS
from [TRANSACTIONS]
${param} is my optional parameter for [CUSTOMER].[COUNTRY]. I unchecked "required" check button for my parameter, so OLAP should have all [VALUE] after executing it without parameter. And there is a problem, because after launching my OLAP raport parameter probably wants to be filled with something. It gives me an error.
Profile attribute 'param' not existing.
But I dont want to fill it with profile attribute. I have created list of values, and analytical driver for my parameter, which I use to pass possible values to my list box string parameter - ${param}.
Is there possibility to have OLAP report with optional parameter? Any BI master here?
I would be greatfull for any help.
Update: I have done something like this, I think this syntax is right, (I was checking SpagoBI examples)
WITH MEMBER [CUSTOMER].[SELECTED] AS ' Parameter("param") ' , SOLVE_ORDER = 2
MEMBER [CUSTOMER].[LEN] AS ' LEN(Parameter("param")) ', SOLVE_ORDER = 1
select
NON EMPTY {{[Measures].[VALUE]}} ON COLUMNS,
NON EMPTY {
IIF([CUSTOMER].[LEN]=0
,{[CUSTOMER].[COUNTRY].Members},
{[CUSTOMER].[CUSTOMER].[SELECTED]}
)
}ON ROWS
from [TRANSACTIONS]
But now I have same error for both possibilities (set/unset) parameter
javax.servlet.jsp.JspException: org.apache.jasper.JasperException: javax.servlet.ServletException: javax.servlet.jsp.JspException: com.tonbeller.jpivot.olap.model.OlapException: 1
Any ideas? Thanks :)
This question is a direct copy oF your previous posts:
https://stackoverflow.com/questions/38970610/olap-report-with-optional-parameter
Is ${param} is a string?
If it is a string then the following should function:
WITH MEMBER [Measures].[x] AS ${param}
SELECT
NON EMPTY {[Measures].[x]} ON COLUMNS
FROM [TRANSACTIONS];
Does it function?
If it does not function then the question is not really mdx related - as for some reason your syntax or the way the parameter is moving to the client is wrong.
note
The above is the equivalent of this super simple script:
WITH
MEMBER [Measures].[x] AS "hello world"
SELECT
NON EMPTY
{[Measures].[x]} ON 0
FROM [Adventure Works];
Do you have AdvWrks cube? Try these:
WITH
MEMBER [Measures].[x] AS "I'm not empty"
SELECT
{
IIF
(
(IsEmpty([Measures].[x])) //<< this returns False
,[Product].[Product Categories].[Category].MEMBERS
,{[Measures].[x]} //<< this is what IIF returns
)
} ON 0
FROM [Adventure Works];
It returns this:
Now I tested out IsEmpty:
WITH
MEMBER [Measures].[x] AS "I'm not empty"
SELECT
{
IIF
(
(NOT //<< added this to check functionality of IsEmpty
IsEmpty([Measures].[x]))
,[Product].[Product Categories].[Category].MEMBERS //<< this is what IIF returns
,{[Measures].[x]}
)
} ON 0
FROM [Adventure Works];
We get the following:
What I think is happening in your scenario is this - the param is not empty but is actually a zero length string:
WITH
MEMBER [Measures].[x] AS ""
SELECT
{
IIF
(
(
IsEmpty([Measures].[x]))
,[Product].[Product Categories].[Category].MEMBERS
,{[Measures].[x]} //<< the zero length string goes to here
)
} ON 0
FROM [Adventure Works];
Results in:

SSRS Space Issue in Parameter Value

I am facing some issues with parameter in SSRS reports that when my Multi value parameter contains the space in between then I get the syntax error
If i choose any other parameter value which do not contains the space then it works well. I am using SSAS cube as a data source
WITH MEMBER [Measures].[PV] AS #Percentile
Member [Measures].[CntCT] as Count(NonEmpty(STRTOSET(#State) * [Tb Main].[UID].[UID].ALLMEMBERS,[Measures].[CPT1] ))
Member [Measures].[PVInt20] as Int(((([Measures].[CntCT] - 1)* [Measures].[PV])/100) - 1)
Member [Measures].[PVC] as
([Measures].[CPT1],Order(NonEmpty(STRTOSET(#State)*[Tb Main].[UID].[UID].ALLMEMBERS ,
[Measures].[CPT1]), [Measures].[CPT1],BASC).Item([Measures].[PVInt20]))
Select [Measures].[PVC] on columns, STRTOSET(#State) on rows from [POC 1];
Query works in query designer with both parameter and entire unique name i.e [Tb Main].[State Name].&[Wash DC]
Try changing the state parameter query to:
WITH
MEMBER [Measures].[ParamValue] as [Tb Main].[State Name].CurrentMember.UniqueName
SELECT { [Measures].[ParamValue] } ON COLUMNS,
NonEmpty ([Tb Main].[State Name].[State Name].ALLMEMBERS, [Measures].[CPT1] ) DIMENSION PROPERTIES MEMBER_CAPTION ON ROWS FROM [POC 1]
Use the ParamValue column as the value property of the state parameter. Then your query downstream should work even when there are spaces.

How to create MDX parameters for SQL Server Reporting Services (SSRS)?

In SQL Server Reporting Service, when I connect to my cube to create a dataset, in Query Designer I create my query with a filter. It creates the following MDX for me:
SELECT NON EMPTY { KPIValue("KPI1"), KPIGoal("KPI1"), KPIStatus("KPI1") }
ON COLUMNS, NON EMPTY { ([Create Date].[Month Num].[Month Num].ALLMEMBERS * [Create Date].[Hierarchy].[Month].ALLMEMBERS ) }
DIMENSION PROPERTIES MEMBER_CAPTION,
MEMBER_UNIQUE_NAME ON ROWS FROM ( SELECT
( STRTOSET(#CreateDateYear, CONSTRAINED) )
ON COLUMNS FROM [ERP])
WHERE ( IIF( STRTOSET(#CreateDateYear, CONSTRAINED).Count = 1,
STRTOSET(#CreateDateYear, CONSTRAINED),
[Create Date].[Year].currentmember ) )
CELL PROPERTIES VALUE, BACK_COLOR,
FORE_COLOR, FORMATTED_VALUE,
FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
When I add this dataset, Reporting Services creates a parameter named CreateDateYear. When I pass a value like "2014" to this parameter I get nothing and I have to pass a value like [Create Date].[Year].&[2014].
How can I change my report to change this parameter for passing the value like "2014" instead of ugly and not user-friendly string [Create Date].[Year].&[2014]?
I did not change the MDX. In the Dataset Properties of my report I Changed the Parameter Value to:
="[Create Date].[Year].&[" + Parameters!Year.Value + "]"
And the problem solved
Use string concatenation to add the "prefix" '[Create Date].[Year].&[' and the "postfix" ']' in MDX:
STRTOSET('{ [Create Date].[Year].&[' + #CreateDateYear + '] }', CONSTRAINED)
if #CreateDateYear contains something like "2014".
Notes: I also added braces around the member unique name, as that is the proper syntax for a set in MDX. And if you would want to allow multiple selection, then probably it would be better to do the string concatenation in Reporting Services instead of MDX.

Parameterised MDX query does not recognise parameters

I have an MDX Query in reporting services (built with query builder) which looks like this:
SELECT NON EMPTY { [Measures].[Injury Illness Cases] } ON COLUMNS
, NON EMPTY { ([DimI Gender].[Gender Text].[Gender Text].ALLMEMBERS
* [DimI State].[State Text].[State Text].ALLMEMBERS ) } DIMENSION
PROPERTIES MEMBER_CAPTION, MEMBER_UNIQUE_NAME ON ROWS
FROM ( SELECT ( STRTOSET(#DimIStateStateText, CONSTRAINED) ) ON COLUMNS
FROM ( SELECT ( { [DimI Gender].[Gender Text].&[Female], [DimI Gender].[Gender Text].&[Male] } ) ON COLUMNS
FROM [US Census Final Injuries])) CELL PROPERTIES VALUE, BACK_COLOR, FORE_COLOR
, FORMATTED_VALUE, FORMAT_STRING, FONT_NAME, FONT_SIZE, FONT_FLAGS
The problem is I used to have user-input, query-based parameter here (#DimIStateStateText) and the report used to run fine. I was, however, forced to changed it to free text parameter, and even when I type in the exact same value as it was shown before (e.g. Oklahoma) the reports doesn't return any data.
What is the cause of this? Can I provide the parameter without changing the whole query to dynamic string?