Filtering a reference field based on another variable

toddjarman
Tera Expert

I have a custom location table with 4 location types (site, building, floor, room).  All site records are the top of the tree and therefore cannot have a parent.  All Building records, must have a parent of Site.  All Floor records must have a parent of Building etc.
So in the Parent field, I want to limit the locations to only allow Sites records for Buildings etc.
In the reference specification, I switch to Advanced and put in this reference qual:
javascript: "switch (u_location_type.toString()) {default:case 'site':u_location_type='';break;case 'Building': u_location_type='Site';break;case 'Floor':u_location_type='Building';break;case 'Room': u_location_type='Floor';break;}"

 

What am I missing?

1 REPLY 1

shun6
Giga Sage

Hi @toddjarman,

I created a Script Include and called it from a Reference Qualifier—it worked as expected.

Script Include

shun6_0-1749956387347.png

 

Reference qual

shun6_1-1749956506546.png