Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
How do I make a double-quoted string expand properly in a variable?
I have this:
SET vFieldName = ComplianceStatus;
SET vFieldCount = (GetSelectedCount($(vFieldName)) + GetAlternativeCount($(vFieldName)));
SET vSelectAllOrNone = GetSelectedCount($(vFieldName))=0 OR GetSelectedCount($(vFieldName))=$(vFieldCount);
SET vSubSelectColor1 = ONLY({<CompName={"$(=TRIM(SUBFIELD(GetFieldSelections($(vFieldName)),',',1)))"} >} CompColor);
Then, I have this:
SET vColor1 = IF($(vSelectAllOrNone), CompColor1, $(vSubSelectColor1));
The variable vSubSelectColor1 looks like this when I inspect it:
ONLY({<CompName={""} >} CompColor)
In vColor1, I'm expecting it to look like it does as I defined it. How do I make that happen?
Variable Overview shows this value for vSubSelectColor1 after a reload:
ONLY({<CompName={""} >} CompColor)
With your changes, after a reload, I get a script line error on the line, and Variable Overview shows this:
ONLY({<KeyValue={"$(=TRIM(SUBFIELD(GetFieldSelections($(vFieldName)),
I tried replacing the single quotes with chr(39), and Variable Overview shows this:
ONLY({<KeyValue={"$(=TRIM(SUBFIELD(GetFieldSelections($(vFieldName)),',',1)))"} >} KeyColor)
think I've got it figured out - I ALSO had to break the variable declaration up as you indicated on vColor1, like so:
LET vDimColor1 = 'IF($' & '(vSelectAllOrNone), KeyColor1, $' & '(vSubSelectColor1))';
Now, for the calculated color, the expression consists of this:
=$(vDimColor1)
After FOUR full days of work, it finally seems to work as intended.