Find a string within a field

This may be easy but I am new to this so here it goes.  I am trying to find if a string can be found in a mysql database field.
The following will only find exactly match
    <CFQUERY DATASOURCE="databasename">
    SELECT mycontact, userid
    FROM mytable
    WHERE email = #form.email#'
    </CFQUERY>
The following will return result if the field email is contain in the form.email
    <CFQUERY DATASOURCE="databasename">
     SELECT mycontact, userid
     FROM mytable
     WHERE email like '%#form.email#%'
    </CFQUERY>
But these will not give what I want.  I want the reverse of the above.  The email fied can contain MORE than one email addresses.  I want to be able to enter a value i.e. form.email and search the table and find any record in the "email" field that contain form.emal.  Help is appreciated.  I am using MYSQL database.  Thanks.

FIRST OF ALL
Everybody is right, fix the darn database.
SECOND OF ALL
Problem 2 is why you have the four cases.
WHERE
email = '#form.email#' 
this finds the case where there is one email in the field
OR email like '%,#form.email#,%'
this finds emails in the middle of a list.  By putting the comma's in your search prevents [email protected] from matching [email protected] because you are searching for ,[email protected],
OR email like '%,#form.email#'
This finds the email if it is at the end of a list, including the comma in the search for the same reason as the previous case.
OR email like '#form.email#,%'
And finally find the email if it at the beginning of a list.
Message was edited by: ilssac Hopefully you can understand this with the stupid forum making all the 'emails' into links including the silly envelope icon.

Similar Messages

  • Using Excel Active X to Find a String within a column

    I am trying to use ActiveX functions to search for a string within a specific column in excel. And return the row index of that string if a match occurs. Any help on that will be appreciated. I used Read then Compare for each cell in that column, but it is too slow. Maybe a search will be faster.

    Here are some Vi's that will allow you to do a "find" just like doing the edit find function in excel. There is also a vi in there to do a search and replace.
    Joe.
    "NOTHING IS EVER EASY"
    Attachments:
    replace.llb ‏117 KB

  • How to find the number of occurance of a string in text field of Infopath form?

    Hi All,
    In Infopath text field, How to find the number of occurrence of a particular string in that field?
    Thanks in advance!

    You can check to see if it contains a string once by using the contains function, but there isn't a very clean way to do what you want. If you wanted to guess at the maximum number of occurrences, then you could:
    Box A has your initial. Set Box B to do a concat of string-before and string-after of Box A where it copies Box A minus the string we're looking for. Then we have Box C that does the same thing to Box B. Repeat as many times as you see necessary.
    Example:
    String: "1"
    Box A - "123451234512345"
    Box B - "23451234512345"
    Box C - "2345234512345"
    Box D - "234523452345"
    etc.
    We then have a field that has nested ifs looking backwards from Z -> A looking for a non-blank. Based on that, we return the number of occurrences. Again, this isn't clean, but it will work if you think there's a predefinable maximum.
    Andy Wessendorf SharePoint Developer II | Rackspace [email protected]

  • Finding a pattern within a String

    How can I find a pattern within a string using Java? does Java has the ability to do this or do I have to write a function?

    The String API documentation shows how to do it.

  • How to find Infopath form Libaray Attachment field Saving location?

    Hi All,
     I have Infopath customized form Lib and have 5 attachement fields in it. How can i find location where the attachment are getting stored?
    Velu K

    Hi,
    According to your description, you want to know that
    where the InfoPath form attachments stored.
    InfoPath attachments are stored as pieces of text called base64 encoded strings within the InfoPath form itself.
    Here is a link, you can use as a reference:
    http://www.bizsupportonline.net/blog/2010/04/top-10-questions-infopath-file-attachments/
    Best Regards,
    Lisa Chen
    Forum Support
    Please remember to mark the replies as answers if they help and unmark
    them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
    [email protected]

  • How to find a string in SAP code

    Hello,
    Does anyone here know how I can find a string inside the SAP code efficiently? I tried finding a custom table name using the Where-used list feature but the results doesn't show the complete/correct results. It missed some user exits where the table name was also used.
    Please help

    Hello Jimmy,
    You can try what Krishna has said there is one more way that is
    goto trxn SE12,
    enter Z* in the table name field,
    it will give a popup box with all the Ztables found in your system...you can find your table maybe it is a little tedious job
    Sravani

  • Reading String within the single quotes

    Hi All,
    Can you please let me know, how to read a String within the sinle quote in line.
    I have to read a report into internal table and again from that I need to read a string within the single quote. Please help me in this.
    Thanks in Advance,
    Raghu

    I have the following code:
    REPORT  test.
    DATA:  v_test(05) TYPE c.
    v_test = ‘TTT’.
    I am getting this errror:
    Field “TTT” is unknown.  It is neither kin on e of the specified tables nor defined by a “DATA” statement.
    For some reason, my single quote is not being recognized from my keyboard.  I noticed that my emotion icons are not being displayed either (example:  I type and i do NOT get the smiley face on my end).
    Is there a button that I pressed that caused that?

  • How can I use SQL to search for a pattern within a field?

    Hello, Frank, Solomon, ect
    I am now faced with this particular scenario, I've got the SQL to search through a field to find text within the field, but I have to know what it is before it can look for it.
    What I have to do is this:
    Search through a field, for a pattern, and I won't know what the data is I am looking for. Can this be done in SQL?
    For instance, Here is my SQL this far, I was helped allot in order to get to this point.
    select table_name,
           column_name,
           :search_string search_string,
           result
      from (select column_name,
                   table_name,
                   'ora:view("' || table_name || '")/ROW/' || column_name || '[ora:contains(text(),"%' || :search_string || '%") > 0]' str
              from cols
             where table_name in ('TABLE1', 'TABLE2')),
           xmltable (str columns result varchar2(10) path '.')
    When you execute the above SQL, you have to pass in a value. What I really need is to alter the above SQL, to make it search for a pattern that exist's within the text of the field itself.
    Like for instance, lets say the pattern I am looking for is this" xx-xxxxx-xxxx" and it's somewhere in a field.
    I need to alter this SQL to take this pattern and search through all the schemas and tables to look for this pattern match.
    Can be done?

    When you use something dynamically within a function or procedure, roles do not apply and privileges must be granted directly.  So, you need to grant select on dba_tab_cols directly.  If you want to do pattern matching then you should use regular expressions.  The following example grants the proper privileges and uses regexp_instr to find all values containing the pattern xxx-xxxx-xxxx, where /S is used for any non-space character.  I limited the tables in order to save time and output for the test, but you can eliminate that where clause.
    SYS@orcl> CREATE USER test IDENTIFIED BY test
      2  /
    User created.
    SYS@orcl> ALTER USER test QUOTA UNLIMITED ON USERS
      2  /
    User altered.
    SYS@orcl> GRANT CREATE SESSION, CREATE TABLE TO test
      2  /
    Grant succeeded.
    SYS@orcl> GRANT SELECT ON dba_tab_cols TO test
      2  /
    Grant succeeded.
    SYS@orcl> CONNECT test/test
    Connected.
    TEST@orcl> SET LINESIZE 90
    TEST@orcl> CREATE TABLE table1
      2    (tab1_col1  VARCHAR2(60))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table1 (tab1_col1) VALUES ('xxx-xxxx-xxxx')
      3  INTO table1 (tab1_col1) VALUES ('matching abc-defg-hijk data')
      4  INTO table1 (tab1_col1) VALUES ('other data')
      5  SELECT * FROM DUAL
      6  /
    3 rows created.
    TEST@orcl> CREATE TABLE table2
      2    (tab2_col2  VARCHAR2(30))
      3  /
    Table created.
    TEST@orcl> INSERT ALL
      2  INTO table2 (tab2_col2) VALUES ('this BCD-EFGH-IJKL too')
      3  INTO table2 (tab2_col2) VALUES ('something else')
      4  SELECT * FROM DUAL
      5  /
    2 rows created.
    TEST@orcl> VAR search_string VARCHAR2(24)
    TEST@orcl> EXEC :search_string := '\S\S\S-\S\S\S\S-\S\S\S\S'
    PL/SQL procedure successfully completed.
    TEST@orcl> COLUMN "Searchword"     FORMAT A24
    TEST@orcl> COLUMN "Table"     FORMAT A6
    TEST@orcl> COLUMN "Column/Value" FORMAT A50
    TEST@orcl> SELECT DISTINCT SUBSTR (:search_string, 1, 24) "Searchword",
      2               SUBSTR (table_name, 1, 14) "Table",
      3               SUBSTR (t.column_value.getstringval (), 1, 50) "Column/Value"
      4  FROM   dba_tab_cols,
      5          TABLE
      6            (XMLSEQUENCE
      7           (DBMS_XMLGEN.GETXMLTYPE
      8              ( 'SELECT ' || column_name ||
      9               ' FROM ' || table_name ||
    10               ' WHERE REGEXP_INSTR
    11                     (UPPER (' || column_name || '),''' ||
    12                  UPPER (:search_string) || ''') > 0'
    13              ).extract ('ROWSET/ROW/*'))) t
    14  WHERE  table_name IN ('TABLE1', 'TABLE2')
    15  ORDER  BY "Table"
    16  /
    Searchword               Table  Column/Value
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>matching abc-defg-hijk data</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE1 <TAB1_COL1>xxx-xxxx-xxxx</TAB1_COL1>
    \S\S\S-\S\S\S\S-\S\S\S\S TABLE2 <TAB2_COL2>this BCD-EFGH-IJKL too</TAB2_COL2>
    3 rows selected.

  • How can I detect a certain text within a field within CASE using IF

    Dear all,
    for a transformation / generation of values receiving from R/3 into BW I try to
    manupulate three fields. I have a problem detecting a string in a field.
    I am using a CASE with several WHEN clauses on one field. Depending on the
    value, an IF is integrated. There I look into another field evaluating, if it contains
    a certain string. E.g. IF STRING CP 'xyz' OR 'abc'.
    System gives error for the locigal expression. I also tried CS, but same error.
    How can I detect a certain text within a field and which is the right logical
    expression.
    Many thanks in advance!!!
    Claudia

    Hi,
    Folow the blow example...
    May be it helps....
    DATA: hex1 TYPE string,
          hex2 TYPE string.
    hex1 = 'FFFF'.
    hex2 = '123FF'.
    IF hex1 CP hex2.
    ENDIF.
    Cheers,
    SImha.

  • How to find out the number of fields in generated proxy structure?

    Hi All,
    Can anybody help me to find out the number of fields in generated proxy structure in back end system along with controller fields.
    i know how to get number of fields in XI system but i want the number of fields in back end system when we generate proxy including automatically generated controller fields.
    Thanks in advance.
    Regards,
    Ujwalkumar

    U mean u want to know at runtime?
    Get the output from ur proxy as a string, count the number of "<" characters and divide it by 2. :-P
    Of course, you'll have to treat the header fields separately.
    Regards,
    Henrique.

  • How to find a string from a set of records?

    I am having a stored procedure which is used for creating a crystal report. When I run the stored procedure sometimes it gives more than one row of data. I want to check if a particular string exists in any row of a particular column. To make it clear let me give an example
    When I run the query I get the below columns
    Part          Part type
    A001          Blanket
    A002          Blanket
    A003          Toys
    What I want to check is if Toys is appearing in any of the row in a formula in crystal reports.
    Thanks
    Sreejith J

    Hi,
    If you want to check a particular sub string or part of a string within a string, you can try this:
    if instr(<database column>, <String to be searched>) = 1 then true
    So, your formula output will be true if the <string to be searched> is part of your <database field>.
    Thanks,
    Raghavendra

  • [AS] Find a string of words in text

    Hello - hopefully someone can help as I'm now stuck on this. I want to be able to find a specific string of words within a text frame, though I want to be able to do this without using the Find Text Preferences approach.
    I can get it to work if i am just finding one word, but if there is more than one word it doesn't work.
    For example this works (given a text frame with text in that contains the word Example):
    tell application "Adobe Indesign CS5"
    tell active document
    set mybox to selected
      tell mybox
       set myfind to object reference of every word whose contents = "Example"
      end tell
    end tell
    end tell
    However the same does not work (searching for "The Example", which is two words)
    tell application "Adobe Indesign CS5"
    tell active document
    set mybox to selected
      tell mybox
       set myfind to object reference of every word whose contents = "The Example"
      end tell
    end tell
    end tell
    What i can't figure out is the correct phrasing for finding a string of words, i guess i should not be looking for the object reference of WORD, but nothing else i've tried seems to work. Many thanks for any help

    I think what John has said is correct… I only had a quick look in the dictionary terms. Without find/change the closest you may get is line or paragraph after that you would need to manipulate the line/para contents further… Word by definition I would think can't contain space but is encapsulated in space bar first/last…
    tell application "Adobe InDesign CS5"
    tell active document
    tell story 1
    set myfind to object reference of every word whose contents = "Example"
    end tell
    show text first item of myfind
    end tell
    end tell
    This would show the line you can then break down further…
    tell application "Adobe InDesign CS5"
    tell active document
    tell story 1
    set myfind to object reference of every line whose contents contains "For Example"
    end tell
    show text first item of myfind
    end tell
    end tell

  • Reports 6: Character format within the field

    Is it possible to apply different types of formatting (bold,italic,font size changes and font type changes) to a text within same field using Oracle Reports 6i? We are generating PDF files using Oracle Reports (legal documents) that must have proper formatting within the field and can't find way of doing it dynamically. Text for the field is pulled from the database - it is not hard-coded in report.
    Is this available in Ver 9/10?
    Thanks,
    Dejan Bogojevic

    Hi Dejan,
    You can get the desired output in HTML format in 9i/10g. Look at the "Contains HTML Tags" property in Builder Online Help. However, for PDF output this is not currently supported.
    Navneet.

  • How would I do a http post of the below listed XML string within a JSP?

    Hi,
    How would I do a http post of the below listed XML string within a JSP?
    <DoService xmlns="http://www.gdinrw.org/wss" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" service="WSS" version="1.0">
    <ServiceRequest DCP="HTTP_POST" mimeType="text/xml" encoding="UTF-8"><![CDATA[REQUEST=GetCapabilities&SERVICE=WMS]]></ServiceRequest>
    <AuthMethod>urn:opengeospatial:authNMethod:OWS:1.0:password</AuthMethod>
    <Credentials>guest,guest</Credentials>
    <FacadeUrl>https://bern:8443/wss_umn_wms/WSS</FacadeUrl>
    </DoService>
    Thanks,
    John

    Yes,
    I need to set up data as POST format before I POST it.
    To be more specific I know how to post within a JSP if an xml element is like:
    <AuthMethod>urn:opengeospatial:authNMethod:OWS:1.0:password</AuthMethod>
    where the field is AuthMethod and the value is urn:opengeospatial:authNMethod:OWS:1.0:password
    but what I am not sure of is when the field has values embedded within it like:
    <ServiceRequest DCP="HTTP_POST" mimeType="text/xml" encoding="UTF-8"><![CDATA[REQUEST=GetCapabilities&SERVICE=WMS]]></ServiceRequest>:
    It has a field of ServiceRequest and a value of ![CDATA[REQUEST=GetCapabilities&SERVICE=WMS]]
    but it also other value embedded with ServiceRequest like mimeType="text/xml" .
    Thanks,
    John

  • Finding text in a data field

    Hi, How could I find the % character in a string? I need its position in the string. The string is a field of a table.

    Hi Jacob,
    here a short example with char and string.
    DATA: ST TYPE STRING.
    DATA: CH(250).
    START-OF-SELECTION.
      ST = 'I am a String with an % Character'.
      SEARCH ST FOR '%'.
      WRITE: / SY-SUBRC, sy-fdpos.
      CH = 'I am a Char with an % Character'.
      SEARCH CH FOR '%'.
      WRITE: / SY-SUBRC, sy-fdpos.
    Regards, Dieter

Maybe you are looking for

  • Problem with a display size in N200 0769

    sorry for my english. i once conected my laptop, to a desktop computer, and since then, my display's resolution is very big. and if i make it smaller, than display become really small, and black borders appears around the it. only with the biggest re

  • Regarding navigation

    Hi Experts, I have one master report and one detail report. Master report contains 5 columns in that on column contains count of customers. when user clicks on the count of customers value it will take him to the detail report where he can see the de

  • Where are the Fujifilm color film presets in Lightroom 5.4?

    While I can now import Fuji .RAF into LR 5.4 and convert to .DNG, I cannot find the Fuji Color and Monochrome presets that are supposedly part of the update to LR 5.4. Where are they hiding and how do I get them? --Thanks, Ken

  • Dynamic spellcheck doesn't work, autocorrect and normal spellcheck do work.

    Hi, my dynamic spelling doesnt work, i use windows 7 and indesign cs6. My normal spellcheck (the word per word one) does work, my dictionary works, everything works exept dynamic spelling, pls help. I have chosen the correct disctionary and my text i

  • Handling collections in coherence cache

    hi, In a mutithreaded environment, how does coherence cache handles collection like HashMap in a multithreaded environment where the large majority of method calls are read-only, instead of structural changes? Are the read calls non-synchronized by c