SQL Command Dynamic Parameters

I have several reports which run on SQL commands.  I created a number of parameters and inserted them into the Command.  When I then modify the parameters to be 'dynamic', I get 2 sets of prompts.
I'm told this is a bug in XI.  I'm using Crystal reports 2008.  Does anybody know if there is a fix for this bug?

Use a separate Command to pull your LoVs (make sure that it's doesn't require any parameters). There should be no need to link the LoV Command to your main data Command... Just make sure you aren't placing any of the LoV fields on the report.
HTH,
Jason

Similar Messages

  • SQL command date parameters breaking SQL code

    Hello,
    I have an SQL statement that executes without error against Oracle 10g.  I've created a command in Crystal Reports 2008 for it.  It uses a date range.  When I parametrize the date range, and select 'Date' as my value type for the parameter, it breaks the SQL with the following error:
    "Failed to retrieve data from the database.
    Details: ORA-00907: missing right parenthesis
    [Database Vendor Code: 907]"
    Here is a sample SQL statement that breaks:
    SELECT *
    FROM gift g
    WHERE g.gift_date_of_record BETWEEN to_date ('{?GiftDateStart}', 'mm/dd/yyyy')
      AND to_date ('{?GiftDateEnd}', 'mm/dd/yyyy')
    Has anyone else experienced this problem or know a work-around?
    Thanks in advance!

    Hi,
    Do it like this
    SELECT *
    FROM gift g
    WHERE g.gift_date_of_record BETWEEN to_date ('{?GiftDateStart}', 'dd/mm/yyyy')
    AND to_date ('{?GiftDateEnd}', 'dd/mm/yyyy')
    I hope this will help you.
    Regards,
    Misra P

  • Dynamic SQL Command Queries Using Parameters

    Post Author: tdoman
    CA Forum: Data Connectivity and SQL
    I'm using Crystal Reports 11 and am trying to dynamically build part of the "Where" clause in the SQL command query to filter data on the server before the results are sent to the client. I'm doing this to decrease the load time of my reports by not having to send a large set of data to the client, then filter the results on the client side.
    I want to create a parameter list that is dynamically generated from a table in a database and allows you to select mutiple values from that list. For example: I have two tables. One employee table and one employee type table. The employee table lists all employees and their related employee types (full-time, part-time, and contractor). The employee type table lists the employee types that will dynamically be loaded into the parameters list.
    Employee Table
    ID    Name       TypeID
    1     Bob          2
    2     Steve        1
    3     John         3
    4     Bill            1
    Employee Type Table
    ID   Type
    1     Full-Time
    2     Part-Time
    3     Contractor
    Assuming the user selects u2018Full-Timeu2019 and u2018Contractoru2019 from the parameter list, the SQL command query I want to generate is as follows:
    SELECT *
    FROM emp, emp_type
    WHERE emp.ID = emp_type.ID and emp.TypeID in (u20181u2019, u20183u2019)
    I tried building the following SQL command query so it would dynamically replace {?EmpType} with the IDu2019s of the types the user selected but it doesnu2019t work. Any ideas how to fix this?
    SELECT *
    FROM emp, emp_type
    WHERE emp.ID = emp_type.ID and emp.TypeID in ({?EmpType})

    Post Author: tdoman
    CA Forum: Data Connectivity and SQL
    btw...I just realized I had a typo in my "where" clause of the previous example. It should have been like so:WHERE emp.TypeID = emp_type.ID and emp.TypeID in (u20181u2019, u20183u2019)  satish_nair31:
    Instead of passing the filter condition as parameter it would be fine if you pass it by ReportViewer.SelectionFormula Property.
    The selection formula property of report viewer control will dynamically append the where condition with the SQL value. You will pass the filter condition as per the syntax of language supported by crystal reports.I believe using the ReportViewer.SelectionFormula property you are referring to is only available if I'm loading the report through a VB application. If this is true, then this option will not work for me because I'm loading the report in a browser from the Crystal Report web server and currently don't have a VB application that can load the report. If I did, then I could dynamically build the SQL string using VB then pass it to the Crystal Report on the fly.But I'm trying to figure out if it's possible to do it without loading the report using VB. Please correct me if I'm wrong on these assumptions.

  • Mixing SQL Command parameters and UI created parameters

    Post Author: shecter
    CA Forum: Data Connectivity and SQL
    I'm using Crystal Reports XI.  I've created a report with an SQL Command - no other tables or views. I want to allow my users to be able to choose data from a dynamic parameter and have the SQL read that and spit out the results. I was able to add a parameter to the SQL using the Parameter column in the Command window. This allows my user to type in a parameter. However, when I run the report after creating a parameter using the UI (i.e. Field Explorer/Parameters/right clicking and selecting "new" and then adding the parameter to a field using the selection wizard), i first get a screen that shows me the parameter that I created in the SQL Command window, then I get a screen that shows me the UI created parameters. How can I make it show only one screen with all the parameters?  -Marc 

    Post Author: jenxia
    CA Forum: General
    SQL Command is :
    SELECT UNIQUE ContactID,  incomingAddress,applicationid,
    MediaStatus, MediaDirection, EndDateTime, StartDateTime
    FROM MMCAContactMediaViewwhere EndDateTime>= {?1-reportstarttime}  and  EndDateTime <= {?2-reportendtime}
    Order by ContactID
    Select formula using dynamic prompts as
    {Command.contactid} = {?ContactID} and{Command.applicationid} = {?ApplicationID} and{Command.incomingaddress} = {?IncomingAddress}

  • Running a SQL Stored Procedure from Power Query with Dynamic Parameters

    Hi,
    I want to execute a stored procedure from Power Query with dynamic parameters.
    In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
        Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
    Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
        Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
        Name_Value = Name_Parameter{0}[Value],
    I have tried like below but it is not working.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
    Can anyone please help me with this issue.
    Thanks
    Dileep

    Hi,
    I got it. Below is the correct syntax.
    Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
    Thanks
    Dileep

  • Parameters from SQL command not available in Web Viewer

    Hello,
    I recently built a report using Crystal Reports 2008, and I'm using it with CR4E 2.0 SP1.  The report has had a SQL command inserted into it, instead of pulling in tables and taking the desired fields.  This was done to speed up rendering time.  The SQL command also has some parameters in it to adjust the date, etc.
    When the report is viewed in CR4E under the web viewer, the parameters are not available to be changed.  They will appear at first for the initial settings, but cannot be changed afterward.  These parameters were set to "Editable" in CR2008.  In fact, other reports will work this way, but those reports don't use SQL commands as a datasource.  Is there another step I haven't completed?
    Thanks so much for your help!
    Edited by: John_AM on Jun 29, 2009 3:31 PM - Added CR4E version.

    Hi John,
    This is NOT a support case management system but a public forum for all to use. If you don't get an answer then you always have the option to purchase a support case and ahve a dedicated Engineer assist you.
    http://store.businessobjects.com/store/bobjamer/DisplayProductByTypePage&parentCategoryID=&categoryID=11522300?resid=-Z5tUwoHAiwAAA8@NLgAAAAS&rests=1254701640551
    Thank you

  • Optional Date parameters in SQL Command

    I'm using Crystal Reports 2008. I want to make the start and end date parameters optional and have them default to the beginning and end of the previous month. Unfortunately, I'm using an SQL Command, rather than filtering in the Record Selection Formula, and I can't see any way to pass the computed start and end dates into the query. Is there any way to get the results I want short of omitting the date parameter in the query and doing all the filtering on the front end? Thanks.

    The way I have gotten around this problem is to make the date parameters strings, and allow mnemonics such as PM for prior month, PD for prior day, PQ for prior quarter, etc.  I then wrote Crystal and database functions that convert these mnemonics to actual dates, which are then used where necessary.  This is also useful for scheduling the same report to run weekly (for the prior week), monthly (for the prior month) and quarterly (for the prior quarter)...
    Also, remember that an SQL command in Crystal is basically the equivalent of a stored procedure, so you can do a lot of logic in them before returning your data set.  So, in your SQL, you could set a variable to either the parameter value or a calculated prior month dependent on if the date parameter is null (assuming Crystal allows no entry for the parameter, which I think 2008 does [I'm on XI R2]).
    HTH,
    Carl

  • SQL Command and Datetime Parameters

    <p>Hi, </p><p>I am having problems  adding datetime parameters to a SQL command.</p><p>The code is AND table.startdatetime >= &#39;{?start}&#39; </p><p>I enter the time and date in the parameter and get the following error.<br /><br /><strong>Incorrect syntax near 2006</strong></p><p>Any clues</p><p>Thanks</p>

    Hi,
    What database you are using?
    Regards
    Sarobinyal

  • SQL command to feed a dynamic param

    I have created a sql statement :-
    SELECT "SRMHOST"."HOSTNAME"
    FROM   "EMCSTS"."SRMAGENTCOMPONENT" "SRMAGENTCOMPONENT" INNER JOIN "EMCSTS"."SRMHOST" "SRMHOST" ON "SRMAGENTCOMPONENT"."HOSTKEY"="SRMHOST"."HOSTKEY"
    WHERE  "SRMAGENTCOMPONENT"."AGENTDESC" LIKE 'Host%' AND "SRMAGENTCOMPONENT"."COMPSTATUS"='inactive' AND "SRMAGENTCOMPONENT"."COMPVERSION" LIKE '6.1%'
    It just displays host names, which match the "where".
    I want to use the output from this command to feed a dynamic param. I am able to create the param, and set it to record selection, but i get presented with the list of "hostnames", and have to make a selection(s).
    I want the output from the sql command to just feed the dynamic param without any interaction from myself. I do not see a setting to do this.

    >
    John E Fleming wrote:
    > Thanks Debi, could not see the wood for the trees !
    > ?
    Been there and done that before  : )
    >
    John E Fleming wrote:
    > The report works fine, but takes a long time, about 2 mins.
    >
    > If i link command.hostname to srmhost.hostname in db expert, it is even slower.  Any ideas ?
    > ?
    I my short experience with SQL, I learned that linking from the crystal reports database expert to a command field is very slow indeed, and short of doing your whole select statement SQL. I do not know anyway around it.
    Edited by: DebiHerbert on Dec 14, 2010 2:00 PM

  • Sql Server Stored Procedures Dynamic Parameters

    <p>Hi All,</p><p>Please can anyone post a example for SQL Server 2005 Stored Procedure using Dynamic Parameters in Crystal Reports XI.</p><p>Thanks</p><p>Rahul </p><p>&#160;</p>

    search notes for samples

  • "Between NVL" - Works in SQL Command, not in APEX report region

    First, I realize I could use dynamic SQL (model 4), but I don't want to (too hard just yet).
    I have a select statement with a series of Where conditions that employ values, in bind variables, supplied by the user.
    I want the choice of parameters to be optional, so I am checking for and replacing nulls.
    Select emp_name from employee_table where
    emp_rating between nvl(:p7_rating_choice, 0) and nvl(:p7_rating_choice, 99)
    and
    emp_language_no between nvl(:p7_lang_choice, 0) and nvl(:p7_lang_choice, 99);
    (the binds should be numeric).
    The actual statement is quite a bit longer, but the point is that the BETWEEN NVL(:x, min) AND NVL(:x, max) piece does not seem to work when used in a report region.
    It works fine if ALL parameters are provided, but returns an error if one or more are null.
    In the SQL command window it works (with a pop-up) just fine.
    By the way, the :p7_lang_choice bind variable is chosen from a LOV list which works in all other cases.
    Also, if I disable nulls (choosing "no" in ITEM page), everything works fine. It seems that the substitution of the min and max values via the NVL returns the wrong data type.
    Any ideas what I have done wrong?

    Thanks Scott.
    Every day brings a little more understanding!
    I also noticed a simplified method in the APEX documentation (although there was no explanation of the code) as follows:
    Where
    (column = :p1_user_input_1 OR :p1_user_input_1 = [null substitution value])
    AND
    (column = :p1_user_input_2 OR :p1_user_input_2 = [null substitution value])
    AND
    etc...
    Using the value you provide in the LOV section for the null, the second part of the OR handles the null situation.
    For some reason I was so tied up with comparing to the column that I never thought to have an OR with a compare to something else.
    Oh well.
    Thanks,
    Norm

  • Dynamic parameters in CR XI

    Hi,
    In my crystal report(version XI), there are 5 parameters. 4 of them are static and one is dynamic. But when i executing the report, it is asking for parameter input values twice!!!
    Is that the bevaviour of crystal?
    And...
    Is it possible to have both dynamic and static parameters in a report?
    If yes, how can i achieve it without asking parameters for twice?
    Help me in resolving this issue.
    Thanks in Advance
    Viswa

    Hi Raghav
    Thanks for your reply. Yes, in my reports, there are command level parameters...
    I've some follow-up questions.
    Actually the report is trigerring a SP in SQL Server. When i directly linked with the SP as data source, in the parameter window, it is showing unwanted check-box Set to NULL value
    To suppress that only, i went with the command option which calls the SP, now i'm getting the prompt twice because of the dynamic LoVs.
    Any suggestions or work-around to resolve this?
    Thanks
    Viswa

  • Dynamic Parameters in MS Analysis Services and BPC

    Hello Experts !
    I need to execute a BPC Package, but in Microsoft Analysis Services I'm not able to have dynamic parameters, so I have to do it manually every time, because of the following problem when I try to execute it in Source Editor on Analysis Services.
    "Parameter cannot be extracted from the SQL Command. The provider might not help to parse parameter information from the commnand"
    The source is Sybase OLEDB
    Best Regards,
    Rodrigo

    Hi Rodrigo,
    I'm not sure I understood your question.
    I'm refering to this: "but in Microsoft Analysis Services I'm not able to have dynamic parameters"
    What do you mean?
    Are we speaking about tasks to process cube or partitions of SSAS(SQL Server Analysis Services)?
    Are you speakinga about tasks from SSIS (Sql Server integration services?)
    Into SSIS you can build tasks to accept parameters.
    You can have also tasks into SSIS which can perform actions into SSAS.
    MODIFYSCRIPT variable is used to send parameters to tasks.
    If you will clarify your questions then I hope I will be able to provide more details.
    Kind Regards
    Sorin Radulescu

  • How to pass command line parameters in calling ant file

    Hi All, I m using a Build file which calls another build file.
    That build file is run from the command prompt by give ant -lib <path of jars it needs for executing>.
    Now i m calling this file from main build file but it does not work as i m not able to set <b>-lib </b>.
    Pls can anybody let me know how to set such command line parameters to call the build file in ant script.
    Thanks in Advance.
    Ketan.B.Parekh

    Create the control file dynamically (and fill one of the columns with the file name as a constant) before you start SQL*Loader
    Another option is to use external tables
    Re: Data Loading
    Message was edited by:
    Jens Petersen

  • Crystal Reports Dynamic Parameters with SAP Business One

    Okay, I've got this very strange issue with dynamic parameters in Crystal Reports connected to SAP Business One.
    Let's start with the software versions:
    - Crystal Reports 12.3.0.601
    - SAP Business One 8.8 (8.80.231) SP: 00 PL: 13
    - Windows XP SP3
    (SBO Server on Windows 2003 and SQL 2005)
    What I'm about to describe is something I've tried in several reports and for which I created a very, very simple test report to see if it was reproducible in a very simple situation.
    - I connected to a Business One server through CR's SBO connection type. Logon is successful, tables are shown.
    - I pick OCRD and plac CardCode and CardName in the details section on the report. Previewing the report shows data.
    - I create a dynamic parameter on CardCode and in the Select Expert I select the CardCode field and define that that should be equal to the parameter.
    - I preview the report again. Now it asks me in such a parameter screen for logon credentials. It shows the server and database it tries to connect to and in the username it shows the SQL Server username I used to connect to the SQL Server in the first place. However, the password for that user is not accepted. I also tried to login with the Windows administrator user and with the SBO manager user, but no success with any attempt.
    I also tried to add a static parameter and add all database values to the list. Same screen, different result:
    Crystal Reports 2008 wrote:
    Logon Failed.
    Error in File UNKNOWN.RPT:
    Unable to connect: incorrect log on parameters. (rptcontrollers.dll)
    (On a side note: the report is saved as report1.rpt)
    Anyone else got similar issues and found a solution?

    Hi,
    When you have fixed your crystal installation following the note posted earlier, please take a look at the [how to guide|http://service.sap.com/sapidb/011000358700000882232009E.pdf] and also at the [e-learning|http://service.sap.com/sapidb/011000358700001370262010E] about SAP Business One 8.8 and Crystal Reports.
    There are so called "tokens" which you need to use instead of dynamic parameters.
    Dynamic paramters don't work in SAP Business One 8.8, if they are not defined as a static paramter with token.
    Best regards,
    Darius

Maybe you are looking for