javascript needed for reference qualifier for lookup value field dependent on more than one variable

patricklatella
Mega Sage

hi Community,

I'm setting up a series of fields on a catalog item that have choices dependent upon previous fields.   I've setup mapping tables to establish the relationships between the fields and am using "Lookup Select Box" type variables for the fields.   I've got the fields working properly that have choices that are dependent upon only 1 other field.   However I'm struggling with the reference qualifier script for the variables that are dependent up on more than 1 of the other fields.  

for example, for a field that is dependent upon one other field I've got the following:

variable name: profit_center_group

dependent upon the choice selected in the field: profit_center_segment

reference qualifier script: javascript: 'profit_center_segment='+current.variables.profit_center_segment //the first variable name here is the column on the associated mapping table and the second is the variable name on the form

THIS IS WORKING

so for a field that is dependent upon the values of 2 other fields I've got the following:

variable name: project_profile

dependent upon the choice selected in the BOTH these fields: profit_center_segment AND profit_center_group

reference qualifier script = ???

MY QUESTION IS what is this reference qualifier script for this variable?

so far I've got: javascript: 'project_profile='+current.variables.project_profile+current.variables.profit_center_group

but this is not working.  

Anyone got advice?   thanks!

javascript: 'profit_center_segment='+current.variables.profit_center_segment

1 ACCEPTED SOLUTION

Realized I was using the wrong piece. Disregard the last post. Try this instead:




javascript:'profit_center_segment=' + current.variables.profit_center_segment + '^profit_center_group=' + current.variables.profit_center_group;


View solution in original post

13 REPLIES 13

patricklatella
Mega Sage

when I try this script



javascript: 'project_profile='+current.variables.project_profile && +current.variables.profit_center_group



the project_profile field shows all the choices...so I think I'm getting close


What fields is the reference qualifier using? What table is the reference qualifier pointing to? Try going to a list of that table and building a filter. Once you get that, you should be able to copy the query. That will give you the syntax you need for the reference qual field. Guessing that the fields are called project_profile and profit_center, here is a possible filter to use as a baseline:



javascript:'project_profile=' + current.variables.project_profile + '^profit_center=' + current.variables.profit_center_group;


patricklatella
Mega Sage

Hi Christopher, thanks for the reply.



so yes the 2 fields that the reference qualifier is using are profit_center_segment and profit_center_group.  



The variable I want dependent upon these 2 fields is project_profile



I created a mapping table with 3 columns: profit_center_segment , profit_center_group and   project_profile


The records in this table establish the relationships possible between these 3 variables fields.



Wondering if my "variable attributes" is correct under the Default Value tab.



I tried your script and no luck yet.   Here are a couple screen shots:



find_real_file.png



find_real_file.png


Is the project_profile field a reference field? If it is, we may have to re-think how we are getting a list of those records from that table versus your look-up table.