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?
I think this is the same problem essentially:
Set analysis in a variable, with dynamic field value in another variable
If it is, it is unclear how to resolve it.
Does vFieldname returns multiple values?
Your expression works if you have one of the value selected in a field.
No - vFieldName is simply a way to generalize the code so it can be re-used elsewhere with little modification. It returns the one value I assigned to it (the name of the field in question).
I think the issue is with the expansion of the dollar sign expansion
Expression as a variable with $-sign expansion
LET vSubSelectColor1 = 'Only({<CompName={"$' & '(=TRIM(SUBFIELD(GetFieldSelections($' & '(vFieldName)),',',1)))"}>} CompColor)';
That resulted in the error " Garbage after expression 's' "
Error while reloading or when you used in your expression?
I'm displaying the expression in a text object. When I reload, the text object displays that error message instead of the expression.
can you see what the variable definition is after the reload is completed in the variable overview? Can you share an image of variable overview?