For example, say I have 3 lists

  • List 1: District (dist_code,Title)
  • List 2: City (dist_code,District(lookup to Title column of District list), Title, city_code)
  • List 3: Quarter (dist_code, city_code, quarter_code, Title, City (lookup of Tile column in City list))
  • List 4: The final list - "StixiaTemaxion"(District, City, Quarter which are lookup columns to the corresponding list of Title column)

I have to fill my lists with some data.

For the Quarter list I need in some way to have a relationship with district because if I have two quarters with the same name of city but with different district it shows me for both cities the same quarters (because I need to have a filter for the 3rd relationship column in code with the district in quarter list).

Can this be achieved with below code with SPServices library? If not, how can I do it?

My code is working fine but I need this extra filtering. Thanks

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script language="javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery.SPServices/0.6.2/jquery.SPServices-0.6.2.min.js" type="text/javascript"></script>
var myJQ = jQuery.noConflict(true);

myJQ(document).ready(function() {
  myJQ().SPServices.SPCascadeDropdowns({
    relationshipList: "City",
    relationshipListParentColumn: "Disctrict",
    relationshipListChildColumn: "Title",
    parentColumn: "Dictrict",
    childColumn: "City",
    promptText: "Select city",
    debug: true
  });

  myJQ().SPServices.SPCascadeDropdowns({
    relationshipList: "Quarter",
    relationshipListParentColumn: "City",
    relationshipListChildColumn: "Title",
    parentColumn: "City",
    childColumn: "Quarter",
    promptText: "Select quarter",
    debug: true
    // options
  });
});
1

There are 1 best solutions below

0
Michael Han On

You have to create a relationship between Quarter list and District list:

In the Quarter list, you need to create a lookup column Distrct(lookup to Title column of District list).

Then add the below to your code:

 myJQ().SPServices.SPCascadeDropdowns({
    relationshipList: "Quarter",
    relationshipListParentColumn: "Disctrict",
    relationshipListChildColumn: "Title",
    parentColumn: "District",
    childColumn: "City",
    debug: true
  });