Neq with Cascading Dropdowns

Coordinator
Mar 12, 2010 at 1:58 AM
Edited Mar 12, 2010 at 2:03 AM

From Joe, via email:

Mark,

I’m really sorry to bother you but I’m a newbie into this area and seek assistance from you.  I am currently and successfully using the jQuery Cascading Dropdowns and it has really saved major booty on this end.

This code works perfectly.
        $().SPServices.SPCascadeDropdowns({
            relationshipList: "CME Personnel",
            relationshipListParentColumn: "Active",   
            relationshipListChildColumn: "Title",           
            parentColumn: "Active",
            childColumn: "QAP Owner",
            CAMLQuery: "<Eq><FieldRef Name='CivMil'/><Value Type='Text'>G</Value></Eq>",
            debug: true
        });

However, if I change the CAML line to this: CAMLQuery: "<Neq><FieldRef Name='CivMil'/><Value Type='Text'>G</Value></Neq>", changing only the Eq to Neq, the wheels promptly fall off.

In running different variants on the idea, I isolated the issue to the “Neq”.  If I read your documentation carefully, the above statement should be <And>ed on to the end of whatever was upstream, presumably a Where clause.

So the question is: how do I use an Neq statement with the Cascading Dropdowns?

Many many thanks for your time!

and further... 

The working code gives me the correct set of records.   Anyhow, changing the working code from <EQ> … </EQ>  to broken code <NEQ> …  </NEQ> gives me the following message:

[image of the debug message was in the email]

So all I did was (try) to say, give me everything that isn’t a “G” .  I looked around for other CAML examples and in this site ( http://sharepointmagazine.net/technical/development/writing-caml-queries-for-retrieving-list-items-from-a-sharepoint-list ) it indicated that a “Neq” was a valid operator.

I’ve also tried changing the case on Neq (e.g. Neq, NEQ, NEq) with same results.

Coordinator
Mar 12, 2010 at 4:29 AM
Edited Mar 12, 2010 at 12:25 PM

Joe:

I did some testing on this in my enviroment.  I am able to get this to work:

CAMLQuery: "<Eq><FieldRef Name='Country'/><Value Type='Text'>United States</Value></Eq>",

replacing Eq with Neq, Lt, Geq, etc.  Here's the schema page I checked to be sure we were both right about syntax: http://msdn.microsoft.com/en-us/library/ms467521.aspx.  When I tried something that is NOT valid ('Le'), I got an error that's basically the same as you sent me.  That error is my library's, and it isn't telling you the right thing for this error case, but I see why it is popping up.

I guess my suggestion would be to try this again in the light of another day and let me know what you get.  If you're still having problems, let me know and we'll get it figured out.

BTW, I'm testing with the lastest version of jQuery and the library.  What versions are you running?

M.

Mar 15, 2010 at 8:00 PM

Mark,

I retried the info you supplied and got it to work.  I had two issues: 1) the operand and 2nd the Column name.  It turned out that the column name needs to be the Static name.  So when I used <Neq><FieldRef Name='StaticColumnName'/>blah blah </Neq> it worked perfectly!

Many thanks for your time!

Joe

 

Coordinator
Mar 15, 2010 at 8:01 PM

You bet.  Glad you got it working!

M.