1

I have a dropdown list created using the SPServices ($().SPServices.SPCascadeDropdowns). It works as it should, I just need to add a requirement. I need to be able to filter the Parent Lookup list to show only unique values.

$().SPServices.SPCascadeDropdowns({
relationshipList: "ROInsComp",
relationshipListParentColumn: "AIP-RY",
relationshipListChildColumn: "NameAndCode",
parentColumn: "AIP-RY",
childColumn: "NameAndCode",
debug: true

});

The issue is that in AIP-RY I have stored Years and each year could be repeted several times: enter image description here

Is this even possible?

thanks!

1

I think you will have to try another way. SPCascadeDropdowns can use a CAML Query, but a CAML Query can not return the unique items the way you want.

There are a number of options discussed on the SPServices Discussion Forums for getting unique items from a list.

I like Frederik's option of returning the HTML for a dropdown from the filter.aspx

$.ajax({
url: weburl+'/_layouts/filter.aspx?ListId='+escape(listId)+'&FieldInternalName='+internalName+'&ViewId='+escape(viewId)+'&FilterOnly=1&Filter=1',
success: function(data) {
    //Do Something
}

});

  • Tom, thanks for the answer, but I don't get this to work. This is what I've done so far: $.ajax({ url: weburl+'https://my-site/_layouts/filter.aspx?ListId='+escape('{544C8B6A-C9B3-4BAD-B9CF-B032E5FD07DB}')+'&FieldInternalName='+"AP_x0020_Year" + '&ViewId='+escape('{4B433420-156F-4F4F-9E3C-551DC43B593C}')+'&FilterOnly=1&Filter=1', success: function(data) { alert('It worked!');} }); I wonder what am i doing wrong. thanks again! – cubanGuy Apr 9 '14 at 14:09
  • I think it's a formatting issue. I notice in Frederik's code he uses a javascript function called escape around the GUIDs. It may be this will help blogs.technet.com/b/sharepointcomic/archive/2008/12/09/… – Tom Resing Apr 15 '14 at 19:53
  • Thanks again! I actually used a similar one: [albionresearch.com/misc/urlencode.php ] for ma code above. – cubanGuy Apr 15 '14 at 20:18
  • Glad to hear it worked! – Tom Resing Apr 15 '14 at 21:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.