var number field = 311;
var text deebid = [_DBID_ITEM_DETAIL];
var text PETfilters = "{'314'.EX.'" & [Related Project (formula)] & "'}"
& "AND{'400'.EX.'" & [Substrate Size] & "'}"
& "AND{'368'.EX.'" & [PET Bottle Color] & "'}"
& "AND{'367'.EX.'" & [Label/Substrate Type] & "'}"
& "AND{'271'.EX.'" & [Label/Substrate Supplier] & "'}"
& "AND{'370'.EX.'" & [Closure Finish] & "'}"
& "AND{'371'.EX.'" & [Closure Color] & "'}";
var text CANfilters = "{'314'.EX.'" & [Related Project (formula)]&"'}"
& "AND{'400'.EX.'" & [Substrate Size] & "'}"
& "AND{'374'.EX.'" & [End/Lid Color] & "'}"
& "AND{'163'.EX.'" & [Tab Color dropdown] & "'}"
& "AND{'252'.EX.'" & [TabType] & "'}";
var text GLASSfilters = "{'314'.EX.'" & [Related Project (formula)] & "'}"
& "AND{'400'.EX.'" & [Substrate Size] & "'}"
& "AND{'369'.EX.'" & [Glass Bottle Color] & "'}"
& "AND{'367'.EX.'" & [Label/Substrate Type] & "'}"
& "AND{'271'.EX.'" & [Label/Substrate Supplier] & "'}"
& "AND{'370'.EX.'" & [Closure Finish] & "'}"
& "AND{'371'.EX.'" & [Closure Color] & "'}";
var text ALUMITEKfilters= "{'314'.EX.'" & [Related Project (formula)]&"'}"
& "AND{'400'.EX.'" & [Substrate Size] & "'}"
& "AND{'370'.EX.'" & [Closure Finish] & "'}"
& "AND{'158' .EX. '" & [Related End/Closure] & "'}"
& "AND{'371'.EX.'" & [Closure Color] & "'}"
& "AND{'91' .EX. '" & "CAN" & "'}"
& "AND{'157' .EX. '"& "BOTTLE CAN" & "'}";
var text filters = If([Primary Substrate]="PET", $PETfilters,[Primary Substrate]="GLASS", $GLASSfilters,[Primary Substrate]="CAN" and [Container Design dropdown]="BOTTLE CAN", $ALUMITEKfilters, [Primary Substrate]="CAN",$CANfilters);
var text query = ToText(GetFieldValues(GetRecords($filters, $deebid), $field));
$query
------------------------------
Taury Anderson
------------------------------