locked
Contains on string property type, is this supported? RRS feed

  • Question

  • Have a table with a string property - ContactName.

    Want to do a search equivalent to:

    query = query.Where(b => b.ContactName.Contains(this.ContactName));

    which is translated to:

    {https://credenzawebstore.table.core.windows.net/Matter()?$filter=(substringof('rowe',ContactName) and (PartitionKey eq 'bec81d60-f8c3-42f9-bd2f-3c4a9fdc167c')) and (Identifier ne guid'00000000-0000-0000-0000-000000000000')}

     

    However, this throws an exception:

     

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>

    <error xmlns="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata">

      <code>InvalidInput</code>

      <message xml:lang="en-US">One of the request inputs is not valid.

    RequestId:1d9f4f8f-88eb-4774-be23-24a0b22a00e5

    Time:2011-03-21T15:53:45.9107315Z</message>

    </error>

     

    Is this not supported? If so, how to do equivalent? 

     

    Monday, March 21, 2011 3:56 PM

Answers

  • Hi Christopher,

    Azure storage doesn't support Contain operator. To utilize this operator, you may need load all data and filter them on local(role instance).

    Another workaround, may not fully match your need, but you may want to know. You may consider maintaining a "Contact Name" list in role instance's memory, then use a autoCompleteBox as 'Contact Name' filter field, when user input part of 'Contact Name', autoCompleteBox would display all matched full contact name. Then user could use the full name to query the table storage.

    Thanks,


    Mog Liang
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • Marked as answer by Brad Calder Saturday, March 26, 2011 5:41 PM
    Tuesday, March 22, 2011 2:52 AM

All replies

  • The supported operators are listed here. Contains is not one of them.
    Monday, March 21, 2011 4:43 PM
    Answerer
  • I see, how to do you propose I do in-field searches (given that Azure doesn't have fulltext capability)?

     

    Monday, March 21, 2011 5:33 PM
  • query = query.Where(b => b.ContactName = this.ContactName);

    This doesnt work for you?

    Monday, March 21, 2011 6:58 PM
  • well, no... if the user simply enters the last name, it won't find it. Think of another, similar scenario: a title. Using the limited query capability, the user would need to remember the full title in order to retrieve the entity, instead of just a word that springs to mind (say "Benjamin Button"). 
    Monday, March 21, 2011 7:45 PM
  • Hi Christopher,

    Azure storage doesn't support Contain operator. To utilize this operator, you may need load all data and filter them on local(role instance).

    Another workaround, may not fully match your need, but you may want to know. You may consider maintaining a "Contact Name" list in role instance's memory, then use a autoCompleteBox as 'Contact Name' filter field, when user input part of 'Contact Name', autoCompleteBox would display all matched full contact name. Then user could use the full name to query the table storage.

    Thanks,


    Mog Liang
    Please mark the replies as answers if they help or unmark if not.
    If you have any feedback about my replies, please contact msdnmg@microsoft.com.
    Microsoft One Code Framework
    • Marked as answer by Brad Calder Saturday, March 26, 2011 5:41 PM
    Tuesday, March 22, 2011 2:52 AM