Reference Qualifier based on previous field

gm01
Kilo Explorer

I am trying to figure out how to create an encoded query string for a reference qualifier or see if I have to possibly script this.   I have a request form which the first variable which is a lookup select references the sys_user table based on the user_name and pulls a custom field of test_uuid as the lookup value field.   The name of that variable is vm_user.   Now the next selection is a variable called test_proj which references another table that has values (in a column called proj) associated with that value of test_uuid.   I want to make sure that when the user is selected that only the values in the table that match test_uuid are returned.   Can this be done in a encoded query where I have the reference lookup the values for proj and only show proj values that match the test_uuid value or will this require a script include?

1 ACCEPTED SOLUTION

I'm using it on a Lookup Select Box so it should. All you are doing is creating a filter on your data and using another defined variable to give you the value.


Make sure to check that on the Type Specifications tab of your 'vm_user' variable-- your lookup value field must return the sys_id.



Small Example:


I have on my form a field called Building and another field called Floor. Floor is dependent on Building.


Building => reference to a table called u_building


Floor => reference to a table called u_floor (this table has a reference field called u_bldg that is a reference to the u_building table)



If I want to generate my Reference qualifier, I can view the Floor table records, build a sample filter with a random building, then right-click and grab the query:


u_bldg=57d1a36e4f403240c7567fe24210c719



My Catalog Item Variable for Building (u_bldg_name😞


Lookup from table = u_building


Lookup value field = Sys ID


Lookup label field(s) = u_name


Reference qual = u_active=true



My Catalog Item Variable for Floor (u_name):


Lookup from table = u_floor


Lookup value field = Sys ID


Lookup label field(s) = u_name


Reference qual = javascript:'u_bldg='+current.variables.u_bldg_name;   <<matches my prior filter query format


View solution in original post

14 REPLIES 14

Erik Stolberg
Tera Guru

I'm not 100% following everything you said, but I think you're doing this on a catalog item, and you should be able to create a Reference qual on any dependent fields as such:


javascript:'fieldname='+current.variables.fieldname1;



In your case, I think it would be:


javascript:'proj='+current.variables.vm_user;   <<this needs to be your previous variable field, not the lookup field or label which I think is test_uuid



That would be applied onto your test_proj variable, and limit the choices down to whatever values match the previously selected vm_user field.


Wondering if this works on Lookup Select Box?   I created the reference qual and it works if it is a reference field it will show me the options for that user.   If I use a lookup select box though it doesn't change.   Is this expected behavior?


I'm using it on a Lookup Select Box so it should. All you are doing is creating a filter on your data and using another defined variable to give you the value.


Make sure to check that on the Type Specifications tab of your 'vm_user' variable-- your lookup value field must return the sys_id.



Small Example:


I have on my form a field called Building and another field called Floor. Floor is dependent on Building.


Building => reference to a table called u_building


Floor => reference to a table called u_floor (this table has a reference field called u_bldg that is a reference to the u_building table)



If I want to generate my Reference qualifier, I can view the Floor table records, build a sample filter with a random building, then right-click and grab the query:


u_bldg=57d1a36e4f403240c7567fe24210c719



My Catalog Item Variable for Building (u_bldg_name😞


Lookup from table = u_building


Lookup value field = Sys ID


Lookup label field(s) = u_name


Reference qual = u_active=true



My Catalog Item Variable for Floor (u_name):


Lookup from table = u_floor


Lookup value field = Sys ID


Lookup label field(s) = u_name


Reference qual = javascript:'u_bldg='+current.variables.u_bldg_name;   <<matches my prior filter query format


Thanks.   I guess I will have to do it a different way or else there would have to be more scripting behind the scenes.   I am doing this for a catalog request form and so I need the value field to be a specific field from the table to pass on to my workflow instead of the SysID.   I think this is why it might work for certain use cases but not others