MapInfo Pro

 View Only
  • 1.  Queries - Finding Multiple text

    Posted 25 days ago
      |   view attached

    Hi,

    I want to be able to find multiple texts e.g. "ALEXANDER" AND "ANVIL" out of 7000 lines of record. But I am unable to figure out the syntax for this. 

    Anyone able to help? (Picture attached)



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------


  • 2.  RE: Queries - Finding Multiple text

    Posted 25 days ago

    Hi Alexis,

    You can use the following expression in the Where clause:

    hydroname in ("ALEXANDER", "ANVIL")

    Another option is to use the following:

    hydroname = "ALEXANDER" Or hydroname =  "ANVIL"

    (Note that the following is invalid: hydroname = "ALEXANDER" Or "ANVIL")

    Wildcards are also possible, if using the "like" operator; e.g. to select all records where hydroname begins with "ALEX":

    hydroname like "ALEX%"

    I hope this helps.



    ------------------------------
    James Nolet
    GIS Manager
    Caf Consulting
    Mentone office, VIC, Australia
    ------------------------------



  • 3.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    HI James,

    I've tried your methods, but was unable to make it work. So, I decided to use another data set but still unable to work.

    I tried:

    hydroname like "APPLETREE%" Or hydroname like  "AYRES%"   

    And tried:

    hydroname = "APPLETREE" Or hydroname = "AYRES%"   

    Both came back with an error: "No Records were selected"

    Can you spot an error in my methods? or provide a different solution

    Im using mapinfo pro version 15.0.3 release build 404



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------



  • 4.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    I restarted my mapinfo, and now it works!

    Thanks James



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------



  • 5.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    Hi James,

    The following worked: hydroname in ("ALEXANDER", "ANVIL")

    However, is there a way to combine it for wildcards?

    I've tried: hydroname like ("ALEXANDER%", "ANVIL%")

    but it said syntax error and didnt work.

    Alex



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------



  • 6.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    Hi Alex,

    I'm glad it worked after the restart.  There's no way to combine the two unfortunately.



    ------------------------------
    James Nolet
    GIS Manager
    Caf Consulting
    Mentone office, VIC, Australia
    ------------------------------



  • 7.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    Alexis,

    You would have to use:

    wherer hydroname like "ALEXANDER%" OR hydroname like "ANVIL%"

    You would have to keep adding OR statements for each value you want.

    Also note that with the % wildcard at the end the value would need to start with ALEXANDER and then can have anything after that. If you also want records where ALEXANDER is anywhere within the value you would use like "%ALEXANDER%".



    ------------------------------
    Sean Loos
    Mapping Solutions, LLC
    ------------------------------



  • 8.  RE: Queries - Finding Multiple text

    Posted 24 days ago

    Thanks Sean,

    That worked well.

    With regards to this:
    "Also note that with the % wildcard at the end the value would need to start with ALEXANDER and then can have anything after that. If you also want records where ALEXANDER is anywhere within the value you would use like "%ALEXANDER%".   "

    Where would this come in handy? Do you have an example. Keen to try this out.

    Alex



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------



  • 9.  RE: Queries - Finding Multiple text

    Posted 20 days ago

    One example would be if you had records for East Alexander and West Alexander, you could query both with like "%ALEXANDER%".



    ------------------------------
    Sean Loos
    Mapping Solutions, LLC
    ------------------------------



  • 10.  RE: Queries - Finding Multiple text

    Posted 20 days ago

    Thanks!



    ------------------------------
    Alexis Ha
    Lyall & Associates
    Burlington MA
    ------------------------------