I have in my report a few needed arguments like 'A','B','C' and I would like to pass it using SQL.
How can I do that?
I tried prm_szDiscType='C','N','P' , prm_szDiscType = C,N,P, and prm_szDiscType=''C'',''N'',''P''
I'm not sure how you pass parameters via URL.
In Crystal Reports desktop client, I created a Command Parameter with "Allow multiple values" check on.
Then in my Command SQL, I use a where clause such as:
where item in {?Item}
When you check "Allows multiple values" on, Crystal will create the clause after in. If you select Value Type of String, the values you enter will automatically be wrapped in single quotes.
Credit to ExpertsExchange thread on command parameters ;)
Related
The problem I'm running into is quite easy to recreate.
In Crystal Reports Developer I add two different tables:
The full table "Users"
A Command containing SELECT * FROM Users
In the Field Explorer I add a new parameter and set this to dynamic. I have this parameter pull it's data from any field in either of the two tables (doesn't matter). Of course making sure the parameter is used in the record select.
If I now preview this report (in Developer) it works perfectly. I get a popup allowing me to select data from whatever field I selected in the parameter.
Using this report in Crystal Viewer it prompts for database username and password.
It seems it only does this when the same report contains both a dynamic parameter and a command. Removing the SQL command (leaving only the table) and the report works as expected.
Does anyone know how to resolve this, or is there some workaround?
This is my Query In SSRS Report:
SELECT
GTCODE,
COUNT(GTCODE),
SUM(HLD_FLG),
Reason
FROM ICWGHC.W_STOCKINFO
WHERE GTCODE IN (?GTC)
GROUP BY GTCODE, Reason;
I have Connected SSRS to ORACLE through ODBC.
I have to pass the parameter GTC, I have created another Dataset for the parameter.
And when i execute the query i get this message
ERROR ORA 00907 missing right parenthesis
Please help me.
For ODBC data sources, no need to specify the parameter name after the question mark. You can use
SELECT
GTCODE,
COUNT(GTCODE),
SUM(HLD_FLG),
Reason
FROM ICWGHC.W_STOCKINFO
WHERE GTCODE IN (?)
GROUP BY GTCODE, Reason;
After editing the query go to the parameters tab to correctly map the parameter. Replace the Parameter value with (assuming your parameter name is GTC):
=Join(Parameters!GTC.Value,",")
I currently have a report which feeds off a stored procedure with the parameters being two date fields i.e. dateto and datefrom.
Now within crystal report and not sql I have created another parameter which asks for the option to select the company the employee belongs to, this can be multiple option or not.
My issue now is that when I run the report the first parameter prompt I get is only the stored procedure parameters, once I input these values another parameter window appears asking for the stored procedure parameters again i.e. the dates but this time also the company parameter.
Is it possible to only have one parameter window prompt with the dates and company parameter appearing once and having to be entered once ?
You can check two aspects:
There is no subreport in this report.
Option "Verify on First Refresh" and "Verify Stored Procedures on First Refresh" are unchecked.
I have a custom SQL expression with some parameters.
I've added it to Field Explorer correctly.
But I couldn't find an example of syntax for using pre-defined parametrized SQL command with my own non-default parameters.
For example, there is a SQL expression like this (it's body of SQL command):
select count(*) from table A where A.col1 > {?param}
I want to create a set of fields with different parameters.
What should I to do?
Is it possible?
Version of CR is 11, SQL syntax is Oracle SQL.
Thank in advance.
You can't use parameter field in a SQL-expression field.
You can, however, use a parameter field with a Command object (assuming that the parameter was defined in the Command object)
I have an SSRS report, Oracle is my backend and am using this following query for dataset of my second parameter.
select distinct X
from v_stf_sec_user_staffing_center usc
where usc.center_group_id in (
select distinct center_group_id from V_T_STAFFING_CENTER_GROUP scg
where INSTR(','||REPLACE(:PI_REGION_LIST,' ')||',', ','||scg.group_abbreviation||',') > 0)
and usc.nt_user_name=:PI_NT_USER_NAME
Here PI_REGION_LIST is a multivalued parameter of string type.
and PI_NT_USER_NAME is a default string valued parameter
This query works fine when I try to execute in manually in the Data tab, also in the Oracle tool. But when I run the report in SSRS and select more than 3 values for the parameter PI_REGION_LIST the report throws an error on this dataset
ora-00939 error,too many arguments for function.
I am not able to figure out the error here.
Please help me with an idea.
The REPLACE function takes three string parameters, the last being optional.
The MS documentation says a multi-valued parameter has the following restriction
"The query must use an IN clause to specify the parameter."
If you don't actually need to do the REPLACE to get rid of spaces, you should be able to do something like
WHERE scg.group_abbreviation in (:PI_REGION_LIST)