Zum Hauptinhalt gehen

Query WHERE Clause Not Working Properly

Kommentare

4 Kommentare

  • Permanently deleted user

    This isn't my forte, but I use this to find anything that people type:

    "UPPER (ADDRESS) LIKE UPPER('" + "%" + address + "%" + "')"

    So for example, if the user types "ma" it will suggest "Main", "Irma", and "Armando".  However, I don't think this covers the instance where they miss the W in 275 W 13th Street.  It might be worth a shot, though.

    0
  • Permanently deleted user

    Thank You Stephani! With your suggestions I can enter 275 or 13th and it gives me a list of possible addresses, however it's still not accepting 275 13th St.

    I'm so close to figuring this out, It's probably something really simple that i'm overlooking! 

    Any more suggestions would defintely be helpful. Thank You!

    0
  • Permanently deleted user

    Great, I'm glad that got it part way there!  I don't know if you can add a wildcard for the middle of the user-entered string.  Maybe the solution is to update the data to include both 275 13th Street and 275 W 13th Street.  That would be a workaround, anyway.

    0
  • Permanently deleted user

    Yeah it's pretty close. You will need to split the string if you want to match the address with words missing in between. Then you will have to add an AND LIKE statement for each word so... (I think string.split(" ") will give you an array of strings)

    addresses = userInputString.split(' ')  // addresses is a string array

    Your query will end up looking something like this below after you run it through a for loop or however you want to create it with your string array:

    "UPPER (ADDRESS) LIKE UPPER('" + "%" + addresses[0] + "%" + "') AND UPPER (ADDRESS) LIKE UPPER('" + "%" + addresses[1] + "%" + "')""

    EDIT: my VB syntax is terrible here btw. split actually accepts and array of char as an argument and I honestly don't know how to do it inline for vb in a workflow. take that as psuedo code. You may have to create a variable of char[] and assign it the value {' '} and use that as the argument or it's possibly --> ("my address to split").Split(New [Char]() {" "c})  //wow <that is really not simple

     

    0

Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.