DX NetOps

 View Only
  • 1.  Filter using 'attribute is not set'

    Posted May 01, 2015 08:50 AM

    I'm trying to request all user models which have no e-mail addresses set, but this doesn't seem to work:

     

    <?xml version="1.0" encoding="UTF-8"?>
    
    <rs:model-request throttlesize="1000"
      xmlns:rs="http://www.ca.com/spectrum/restful/schema/request"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://www.ca.com/spectrum/restful/schema/request ../../../xsd/Request.xsd">
    
      <rs:target-models>
        <rs:models-search>
          <rs:search-criteria
               xmlns="http://www.ca.com/spectrum/restful/schema/filter">
            <filtered-models>
              <and>
                <equals>
                  <attribute id="0x10000">
                    <value>User</value>
                  </attribute>
                </equals>
                <does-not-equal>
                  <attribute id="0x12912">
                    <value />
                  </attribute>
                </does-not-equal>
              </and>
            </filtered-models>
          </rs:search-criteria>
        </rs:models-search>
      </rs:target-models>
    
      <rs:requested-attribute id="0x1006e"/>
      <rs:requested-attribute id="0x10074"/>
      <rs:requested-attribute id="0x101f6"/>
      <rs:requested-attribute id="0x10075"/>
      <rs:requested-attribute id="0x12912"/>
    
    </rs:model-request>
    

    This doesn't seem to work. I got the '<value />' by adding a filter in OneClick and looking in the custom/console/config/ directory of the oneclick server to look at the syntax - but this doesn't seem to work.


    When I run this query, I still see entries with empty e-mail addresses appear in the list.

     

    Is there a way to request 'if attribute *** is not set'? It seems simply using two single quotes next to each other doesn't work. I know on some attributes you can use regex and '^$' but this doesn't give you the option to use 'and regex does NOT match ***'.

     

    Has anyone been able to sort this problem out?

     

    Perhaps if not, I'll recommend it as a suggestion in an upcomming release!


    Thanks


    Frank



  • 2.  Re: Filter using 'attribute is not set'
    Best Answer

    Posted May 01, 2015 01:44 PM

    You could always use this as a filter

     

     

       <filtered-models> 

         <and> 
           <equals> 

              <attribute id="0x10000"> 

                <value>User</value> 

              </attribute> 

           </equals> 

           <does-not-have-substring> 

              <attribute id="0x12912"> 

                 <value>@</value>

              </attribute> 

           </does-not-have-substring> 

         </and> 

      </filtered-models> 

     

     

    -Greg



  • 3.  Re: Filter using 'attribute is not set'

    Posted May 01, 2015 02:01 PM

    Thanks, while that will work in this example, I'm specifically looking for a generic example - I have a few queries I need to run where the logic contains the 'where attribute *** is not set' clause. I was hoping there was a way to do this.



  • 4.  Re: Filter using 'attribute is not set'

    Posted Jul 21, 2015 12:42 PM

    Frank, you create a Locator search for any attribute, and find models with null values just leaving the Attribute Value field blank.

     

    Scott



  • 5.  Re: Filter using 'attribute is not set'

    Posted Jul 22, 2015 08:06 AM

    I tried using the Locator search (this is where I usually test or work out what XML to use) but this doesn't always work (as in the example I provided). I think Gregory is correct, we just have to get clever and try to find other ways to query.


    Thanks