Report parameter field value has a single quote. need to escape before pass

Report has a parameter whose value might have a single quote in it. If I pass that value directly into the SQL Command... like
where ... user_name = {?parm_user_name}...
which would translate to
user_name='O'Donnel Honda'
I am getting an error... so would like to convert this parameter value into 'O''Donnel Honda' before passing into the query.
I created a formula called parse_user_name with following:
Replace ({?parm_user_name}, "'", "''")
And used in the query like
where ... user_name = {@parse_user_name}...
I am getting an error like invalid SQL92 character...

I think you should use the condition like this
where ... user_name = '{?parm_user_name}'
keep the parameter in single quote at the command level itself.
Now use the same formula like
replace({?Parameter},"'","''")
This works only if the parameter is a single value parameter but not multi value parameter.
Regards,
Raghavendra

Similar Messages

  • Is there a way to insert a string even if the value has a single quote in it?

    Hi,
    I have a varchar string like
    Name: D'souza
    I am getting an error when i am inserting  like this.
    insert into table (D'souza)
    Is there any way to allow inserting the exact value even if it has single quotes attached to it like set define off in oracle ?
    Regards
    Gautam S
    Gautam S

    insert into table values('D''souza')
    insert into table values('D'''+'souza')
    Try also this one
    SET QUOTED_IDENTIFIER { ON | OFF }
    http://msdn.microsoft.com/en-us/library/ms174393.aspx

  • How to use a parameter field value as a substring in a "like" statement?

    Hi all,
    I'm trying to use a parameter field in a Record selection formula where the parameter field value would be a substring of the data stored in the field.
    My parameter field (SlctResearcher) is constructed as follows:
    Type: string
    List of Values: static
    Value Field: (Reports) RptAuthors
    (in Value Options) Allow custom values?: True
    {Reports.PubDate} in DateTime (2009, 04, 01, 00, 00, 00) to DateTime (2010, 03, 31, 23, 59, 59) and
    {Reports.RptAuthors} like "*{?SlctResearcher}*"
    When I hit F5 to generate the data, I get no results (and the parameter prompt field does not even come up...)
    If I modify the formula to put a hard-coded string, like
    "*Jones*"
    after the 'like', I get results (all the reports where "Jones" is a substring in the RptAuthors string.) If I modify the formula to just use the parameter field without the quotes/stars like:
    {Reports.PubDate} in DateTime (2009, 04, 01, 00, 00, 00) to DateTime (2010, 03, 31, 23, 59, 59) and
    {Reports.RptAuthors} like {?SlctResearcher}
    I do get the parameter prompt field, but still no results even if I put in a valid substring value (since it is not searching for a substring anymore...)
    How can I do this?
    Thanks,
    Will

    1st thing... Make a copy of your report before doing anything!!!
    To use a SQL Command, you'll want to open the Database Expert and look at the Current Connections. Expand the data source and the 1st option you see is the Add Command option.
    To find the SQL That CR is currently using, choose Database from the menu bar and select Show SQL Query...
    You can copy this and paste it directly into the command window. (If you you can write your own SQL you don't need copy CR's, it's just an option.)
    You'll also want to take not of any parameters that you have, you'll need to add them the the Parameter List of the command as well... be sure to spell them EXACTLY as they are in the design pane.
    Anyway, once the SQL statement is in the Command window you'll be able to alter the WHERE clause to use the wild cards.
    For future reference... What type of database are you reporting against???
    Jason

  • URGENT  update a table with a text that has a single quote in it

    Hello, I am trying to update a table with a text that has a single quote in it. I believe I need to use two singles quotes but I am not sure how.
    For example:
    UPDATE TEST
    SET DESCRLONG='Aux fins d'exportations'
    WHERE etc...
    Should I put 2 singles quotes before the quote in the text?
    UPDATE TEST
    SET DESCRLONG='Aux fins d'''exportations'
    WHERE etc...
    Thank you very much :)

    The best way depends on the version of Oracle.
    But, the quick and universal answer is to use two single quotes
    SQL> connect test/test
    Connected.
    SQL> create table test (descrlong varchar2(128));
    Table created.
    SQL> insert into test values ('This is a string with a '' single quote');
    1 row created.
    SQL> select * from test;
    DESCRLONG
    This is a string with a ' single quote
    SQL> update test set descrlong='Aux fins d''exportations'
      2  where descrlong like 'T%';
    1 row updated.
    SQL> select * from test;
    DESCRLONG
    Aux fins d'exportations
    SQL>                                             

  • Parameter Field Value Elimination Based on Another Parameter

    I'd like to make 3 grouping parameters with static values to produce 3 drop downs in the user prompt.  The problem is, I'd like for the second drop down to eliminate the choice made from the first drop down and the third drop down to have been eliminated to only one choice.  Is there a way to edit the parameter field values from the formula workshop?...Or maybe this would be better handled in the group selection formula area.  Any help would be very much appreciated.

    Can't be done unless you use one of the 3rd-party Crystal viewers listed at http://kenhamady.com/bookmarks.html
    A simpler approach is to have a record selection formula that causes no records to be retrieved if 2 parameters have the same selected value.  You can then unsuppress a text object telling the user their parameter selections can't be the same.

  • How to Print the same field value in a single row

    Hi,
    I need to print the same field values in a single row
    For Examble
    in a table TestTable
    ID Name Value
    1 AB 120
    1 BC 150
    1 CD 130
    2 AB 111
    2 BC 112
    2 CD 113
    I need the query like if the Name contains BC and CD then i need to print like ID, BC Value, CD Value as below
    ID BC'Value CD'Value
    1 150 130
    2 112 113
    Kindly suggest me...
    Thanks in Advance
    Anu

    Hi,
    Since you're on 9i some available functionality unfortunatly isn't at your disposal.
    This should work, however, using your sample data:
    MHO%xe> create table t as ( -- generating sample data:
      2  select 1 cid, 'AB' cname, 120 cvalue from dual union all
      3  select 1, 'BC', 150 from dual union all
      4  select 1, 'CD', 130 from dual union all
      5  select 2, 'AB', 111 from dual union all
      6  select 2, 'BC', 112 from dual union all
      7  select 2, 'CD', 113 from dual
      8  );
    Tabel is aangemaakt.
    MHO%xe> select cid
      2  ,      max(decode(cname, 'BC', cvalue, null)) BC_value
      3  ,      max(decode(cname, 'CD', cvalue, null)) CD_value
      4  from   t
      5  group by cid;
           CID   BC_VALUE   CD_VALUE
             1        150        130
             2        112        113For reference and future challenges, see:
    http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:419593546543
    http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php

  • SSAS SSRS Report Action on Cell Value w/ Embedded Single Quote Not Executing

    I have configured an SSAS 2008 R2 cube SSRS ReportAction. I'm having problems when the member value for a cell has an embedded single quote, e.g. abc's. The action displays on the context menu appropriately, but when I click on the action, nothing happens.
    For member values that do not have the single quote, the action works as designed. I've added a calculated ember to escape the embedded single quote by adding another single quote, e.g. abc''s, with no luck. Is there a resolution or workaround for this?

    Hi Mdccuber,
    According to your description, you create a reporting action in you cube, and it works fine except the members that have embedded single quote, right? In your scenario, it seems that you pass this value to the report as the parameter.
    In SQL Server Analysis Services (SSAS), when pass values to a report, multi-select parameters have to be placed into IN statement and SQL Server Reporting Services (SSRS) will do single-quote wrapping for string values automatically. In this case, the original
    value that have embedded single quote will be damaged. So this action not work. You can submit a feedback at
    http://connect.microsoft.com/SQLServer/Feedback and hope it is resolved in the next release of service pack or product.
    Regards,
    Charlie Liao
    TechNet Community Support

  • Report Parameter Default Value at runtime

    Post Author: DMiller
    CA Forum: .NET
    Hi,
    I need to be able to create new parameters at runtime and have been somewhat successful in this endeavor. I have one remaining issue that I am hoping that somebody can help me with. Let me explain.
    When you create a parameter from within the Crystal XI designer, you are able to specify a number of default values that will display as a list box at runtime. Eg. ParameterName is MaritalStatus and default values are ("Married", "Single", "Divorced" etc). There is also the ability to specify the Default Value in the Value Options area of the screen. This value could be set to any one of the default values above - let's say that I set it to "Single". By setting the Default Value, this causes the Parameter Fields screen, at runtime, to "Select" the specific default value set above - in this case "Single", instead of showing "..." as the parameter value.
    The default value setting in the Value Options is beneficial when you have reports that are usually run with certain parameter values and only occasionally these need to change. Instead of having to specify every parameter value, the user only has to set the ones that have not been defaulted or they want to change.
    So, I have been successful in creating the parameters at runtime and successfully running the report. I have been unsuccessful in setting the "Default Value" as seen in the Value Options area. I have tried a number of properties on the report parameter object and have not found anything to set this.
    Does anybody know how to set the "Default Value" as seen in the Value Options area in the designer at runtime?
    Thanks for any help.

    Post Author: JerryB
    CA Forum: .NET
    You have described my scnario to a tee.  Did you ever figure out how to get the single default value that is available in the "value options" area when working within the Crystal Reports development environment.  I am using VB.Net and have a nice report menu form and viewer but recently a user ask me to set the default value in one of my combo boxes and I have been unsuccessful in finding the correct property to use.

  • Parameter Field Value returns "no records"

    I am using Crystal 11 and am new to Crystal but not to other Reportwriters.  I have a Crystal report that has 2 parameter fields, one is "Enter Date" that prompts for the start and end date, the other "Select Items" prompts for the supply Item Numbers to be included in the report.  In the "Edit Parameter: Select Items:" edit/create parameter dialog, the Select Item parameter has "Allow Multiple values" and "Allow discrete values" set to true. The report runs fine and returns any items entered in the "Select Items" prompt that has usage during the start & end date.  My problem is ... if the entered Item Number for the Select Items parameter returns no records, I cannot report that Item Number as having zero usage.  I cannot find a way at the time of report running to identify and report the "not found" items.  I would also like to report the Start and End Dates parameters requested, but cannot, the Enter Date parameter returns an empty parameter field across the whole report.  I'm sure other users have had this problem of reporting the requested parameter values.   Need assistance.  

    Jeff's answer is one way to do it.  There are others:
    If you want the items with no data interspersed with the other items (say, in item number order), then you'd change the report to use your item master table and do a left join from that to the usage data.  If a field from the usage table is null, then there was no usage, and you can condition a message based on that.
    Or, if your parameter selects item numbers without some type of "ALL" option, then you can use arrays to keep track of which if the selected items printed.  Then in the report footer, compare the list of items reported to the parameter items, and show which item numbers had no usage.  (This might run a tad faster than the separate subreport that Jeff suggested - but maybe not...)
    HTH,
    Carl

  • Crystal Report Parameter Default Value

    Hi All,
    I have one issues regarding the parameter in the report.
    I have two parameter field in the report. The scenario will be as below:
    In my report, i have mobile no & passport no parameter selection. Currently in my report, the selection was like below:
    {pax.mobile} = {?mobile} and
    {pax.passport} = {?passport}
    Formula above was placed in report's select expert. Each time user need to select or enter the two parameter above in order to select the entered data to be reflected into the report. However, my report REQUIRED to allowed null value from the parameter selection. I can enter mobile no but leave passport null, however with the formula above was unable to proceed to refresh the report. I have the formula as below, however it could not be able to work.
    (if(hasValue({?mobile}) = true) then {pax.mobile}  = '*ALL'
    else {pax.mobile} = {?mobile} ) and
    (if(hasValue({?patssport}) = true) then {pax.passport}  = '*ALL'
    else {pax.passport} = {?passport} )
    The formula above will display all of the records and sometimes it will b hung.
    Appreciated anyone who knows this able to advice.
    Thanks.
    Regards,
    CK

    hi,
    Thanks for your feedback.
    I have try one of the example below:
    if(hasValue({?Country})=false) then true
    else {Customer.Country} like '*'&{?Country}
    If country parameter is null, it will retrun all country. But i would like to return Country = 'USA' if my parameter value is null.
    Is this possible to do it in the formula above? I tried something like below, but if has parameter value it will return the USA as well.
    if(hasValue({?Country})=false) then {Customer.Country} = "USA"
    else {Customer.Country} like '*'&{?Country}

  • How to ignorenon-numeric parameter field value

    Post Author: burhan.survery
    CA Forum: General
    I am passing a parameter to a subreport. While running the report, I get an error which says that the parameter field is a non-numeric value. I'm not sure why since, the parameter field should be passing a quantity. Is there a way for me to check if the parameter field is passing a non-numeric value and if so, ignore it so  that the report continues.
    thanks.
    b

    Post Author: bettername
    CA Forum: General
    Strange! I would have imagined from the fact that it gave you the original "non-numeric" error that it must be passing a string (how can a number be non-numeric!), but that's clearly not the case.  I'm stumped...  What does Crystal identify the 'source' field as (do a 'browse data' or 'show field types')? I assume that the parameter datatype is the same as the source field? 
    What's your data source (SQL Server, DB2 etc...)?  Is there a way you can validate everything is numeric outside of Crystal?

  • Report parameter default value do not default correctly

    Hello Experts, I have a cascading parameters in my report.
    The first parameter called "Project" will allow to select a single Project Name from the list and based on the Project Name, the second parameters which is a "Date" parameter will give out list Months and Year in the Format 'Nov-14'. 
    For this Second parameter I defaulted the parameter to show First Month in the retrieved list of Months. But the problem is it will display the default Date correctly only certain times (there is a refresh problem). If i select a different project and it
    has a month that was retrieved in the first project it will still show the that Month but not the actual default month (Start Month) for that particular Project.
    Example: If I select Brisk from Project parameter, It will give me 18 months of Dates in the Date parameter. In that 18 month range first month is Sep-13 it will default to Sep-13 correctly. Then if I select a different project like "Creek" (example)
    as Project , the Date parameter retrieves some dates corresponding to Creek Project and in the retrieved months if  Date parameter has Sep-13 it will still show Sep-13 even though the
    Start Date for Creek project is Jun-12.
    1. Project Brisk: Defaulted correctly to Sep-13
    2. Creek Project : Should default to Jul-12 but still shows Sep-13
    Just for default value I created a separate dataset and used it to populate the default value and the SQL I used just for default value is as below:
    SELECT DISTINCT TRUNC(DATE_KY, 'MM') AS DEFUALT_DATE
    FROM            DATE_D D
    WHERE        (DATE_KY = ADD_MONTHS(:PROJECT_DT, - 6))
    Date parameter datatype is Date/Time,
    Available Values Tab: label field is a String but the Value field and the default field (Default Values tab) are Dates 
    Thanks in advance

    Thanks Vicky for reply.
    Yes you are right but I did not use First function as the query above retrieves only one date.
    I used your suggestion but it did not fix it.
    In this report I have three parameters.
    1. Project Code (Visible)
    SELECT DISTINCT PROJECT_CODE
    FROM      DIM.PROJECT     
    ORDER BY PROJECT_CODE
    2. Project Date (Invisible)
    SELECT
    MAX(CASENA.MILESTONE
    WHEN'ABCD'THENTRUNC(PROJECT_DATE,'MM')ELSENULLEND)PROJECT_DATE
    FROM
    DIM.PROJECTNA
    WHERE(NA.PROJECT_CODE
    =:PROJECT_CODE
    or'ALL'=:PROJECT_CODE)
    3. Start Date (Visible):
    Available Values Query:
    SELECT DISTINCT
    --DER_DATE is "Value Field"
    TRUNC(D.DATE_KY, 'MM') DER_DATE 
    --Display_date is "Label Field"
    , TO_CHAR(D.DATE_KY, 'Mon-YY')   Display_Date
    FROM DATE_D D
    WHERE DATE_KY BETWEEN ADD_MONTHS(:PROJECT_DATE, -6)  AND ADD_MONTHS(:PROJECT_DATE, 6)
    ORDER BY 1
    Default Values Query:
    SELECT DISTINCT TRUNC(DATE_KY, 'MM') AS DEFUALT_DATE
    FROM            DATE_D D
    WHERE        (DATE_KY = ADD_MONTHS(:PROJECT_DATE, - 6))
    When you select a Project from "Project Code", it will give a "Project Date" and based on the "Project Date" it will give a date range in "Start Date". That is why I am using "Project Date" parameter in my
    query. I even tried using Project code as you suggested but I still got the same result.
    Thanks a lot for your reply.

  • Pass parameter field value to a formula

    Hi ,
    I want to pass a parameter value to a formula. I have a formula FX rate and want the user to be prompted to enter a fx rate and that value to be passed to the FX formula.
    Thanks!
    Romeo

    Yes, it is.  Similarly to my last post.
    Do something like this to the formula that has Fx Calculation.
    ({?FX Rate} * {another.field})/{some.other.field}
    Whatever value the user inserts to {?FX Rate} will be populated or passed to the formula seen above.
    I hope that makes sense.
    Regards,
    Zack H.

  • How to identify the field value has been changed to new value?

    Hi,
    I am adding a custom field through CI include for 171 info type.
    But I need to identify that whenever user enters into change mode and changes the value(Custom field) then I have to populate an error message(i.e Manitain date type in 41.).
    I know we can identify that by change(AEDAT) date of that particular record but I could not identified that particular field has changed or not.
    Please share your experience, if possible send pseudo code.
    <REMOVED BY MODERATOR>
    Thank you,
    Ravi.
    Edited by: Alvaro Tejada Galindo on Feb 6, 2008 12:37 PM

    Can you keep a copy of the record when you enter the infotype and check changes against that?
    Rob

  • Passing sql report query field value to hidden item in javascript

    I have sql report which has in each row one html button. Let us say that query SHOULD look like (two columns, to be easy to get the point):
    select 1 SECURITY_ID
      , '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||SECURITY_ID||');" >' BTN
    FROM DUAL;
    function Top10Click (vValue) {
      html_GetElement('P31_PROCESS_VALUE').value = vValue;
      doSubmit('GO_BACK');
    } <br><br>
    where P31_PROCESS_VALUE is hidden item where i want to store value of row where click happened.
    <br><br>
    In every button i want to pass row value "SECURITY_ID" to Top10Click function for each row differently.
    <br><br>
    Problem is that when I place double qoute then js is not working, else js is ok but "SECURITY_ID" is passed as constant not as live SQL value.
    <br><br>
    Any help...THX!
    <br>
    Demo is on oracle:
    http://htmldb.oracle.com/pls/otn/f?p=26216:1
    Workspace entry:
    WK: FUNKY
    UN: [email protected]
    PW: qwertz

    I have tried to unify the solution, so it looks like:
    select 1 SECURITY_ID
      , '<input type="BUTTON" value="Top10" onClick="javascript:Top10Click ('||'&quot_X;'||SECURITY_ID||'&quot_X;'||');"  >' BTN
    FROM DUAL;change '&quot_X;' (remove "_X" part ... so it can be seen in HTML properly!
    THX Denes for great ideas...

Maybe you are looking for

  • Primavera & BPM 11g

    Hi Experts, Can any one help me on this.. I have the working environment of BPM 11g now i want to 1) Install Primavera6 8.2 2) Integrate both P6 and BPM 11g These are the things i want to achieve so please any one help me out with the steps.I have fo

  • SharePoint Report Viewer Web Part Parameter Issue

    I'm using the SharePoint Report Viewer web part to display a SSRS report that I have created in a library.  Reporting Services is integrated into my SharePoint farm.  The report I am displaying has a single parameter that needs to be set.  When I sel

  • Benefits of Lightroom vs Camera RAW

    I currently use the following: Elements 11 (w/ Camera RAW) Canon Rebel XS (1000D) Canon Powershot SX50 HS). I also shoot RAW that vast majority of the time. I just downloaded a trial version of Lightroom 4.  So far seems like I can do everything in E

  • Connecting airport extreme to macbook and windows 7 desktop

    Hello, I currently connect my macbook to the internet via airport extreme wifi.  I tried to also connect my windows 7 desktop to the airport via ethernet, but the PC is saying I have no internet connection.  Are there any configuration / settings  I

  • Enterprise Email and groupare for Apple Computer?

    I'm sure this question has been asked before, but I'm extremely curious to what groupware product Apple is using in house. Do they have something similar to exchange or better? And I'm sure they've had to install a couple exchange servers for their i