Hoppa till huvudinnehållet

Where clause syntax

Kommentarer

4 kommentarer

  • Ryan Cooney

    Hi Todd,

    If GetSub.ToString() gives you an "Object reference not set to an instance of an object" error it means that your GetSub variable is null. Have a look at where that variable gets assigned.

    --Ryan

    0
  • James Landwehr

    Hi Todd,

     

    This is an equivalent for what we use as an expression and it seems to return suitable results.

     

    "SUBNAME like '" &"%" & GetSub &"%'"

     

    Thanks,

    Jim

    0
  • Todd Sales

     

    Thanks for the responses. The feedback seems to help substantiate my suspicions of the underlying problem, while not resolving it. It appears the where clause is not being interpreted correctly (i.e. null), so the LIKE statement returns all features. This occurs for multiple FC attributes (in different search workflows) and with different text strings/entries tested. It does not appear to be a case-sensitivity issue. BTW, it seems inconsistent, as I've built another search workflow using a LIKE statement in the where clause, and it functions as expected. Just trying to figure out what's different between them..???..

    0
  • Permanently deleted user

    I was having a similar problem when using the value entered by the user. 

     

    I had the variable as string, but the search was failing.

    Once changed the variable for the user entered value to an OBJECT and in the Where clause convert the object to string it worked.

    Try this where clause "SUBNAME like '%" & GetSub.ToString() &"%'"

    0

Du måste logga in om du vill lämna en kommentar.