SMK wrote:If([Customer Option] = "Customer", "&_fid_376=" & URLEncode([Related Customer4])
, [Customer Option] = "Local Chain","&_fid_360=" & URLEncode([Regional Account - LocalChainId])
, [Customer Option] = "Promo Plan","&_fid_365=" & URLEncode([Related RegionalPromo])
, [Customer Option Channel] = "Channel","&_fid_34=" & URLEncode([Related Market])
)
Should you break out "Customer Option" from "Customer Option Channel" in this first if statement?
Since you're encoding each of these values (Customer, Geographic, and Product Option) just prior to your If() logic, what happens if there is no value for these fields? Is there just a double ampersand - "&&"?
When formulas like this one don't seem to be what I'm expecting, I like to use either the "check my formula" option from within the field settings, or take a small chunk of this code and create a report to use report variables to see the data generated.
*edit: just wondering if you take your last bit of code and put it into a report formula, what generates?
var text sample = "&_fid_55=" & URLEncode([Product Option]) &
If(
[Product Option] = "Material", "&_fid_70=" & URLEncode([Related Material]),
[Product Option] = "Beverage Type & Package Size", "&_fid_42=" & URLEncode([Related Beverage Type]) & "&_fid_46=" & URLEncode([Related Beverage Type - Package Relationship]),
[Product Option] = "Trademark & Package Size", "&_fid_50=" & URLEncode([Related Trademark]) & "&_fid_52=" & URLEncode([Related Trademark - Package Relationship]),
[Product Option] = "Package Size Only", "&_fid_72=" & URLEncode([Related Package])
);
$sample