Beware that GKCs are odd in the sense that they behave differently if you use $variables$ in new style Beanshell expressions vs old style expressions.
With old style, $CardChoice$ is substituted right away, parsing the value in the source piece, before actually running the GKC.
With new style, $CardChoice$ or "$CardChoice" or just CardChoice is checked at target level, instead.
No, this is incorrect.
$$ properties like $CardChoice$ are ALWAYS, IN ALL CASES evaluated and replaced directly with the value of the property from the piece that holds the expression. This happens as a pre-processor step prior to the execution of the expression.
The difference with GKC's happens at the second step, where the property expression is actually evaluated. For a GKC, the evaluation of the expression resulting from the pre-processor stage is performed on the target piece. For other than GKC's, the evaluation of the expression is done on the source piece.
The correct, modern form of the expression to use in a GKC will normally be
- Code: Select all
{CardType=="$CardChoice$"}
Say the CardCoice on the source piece is Artifact, then after the pre-processor stage you will have
- Code: Select all
{CardType=="Artifact"}
which is the correct expression.
If the expression is not a GKC expression (say a Trigger Action), then the the correct modern form to use will usually just be
- Code: Select all
{CardType==CardChoice}
There is no pre-processor step and the evaluation step is a direct comparison between the CardType and CardChoice variables.
What happened when you tried to use
- Code: Select all
{CardType==$CardChoice$}
is that after the preprocessor step, you got this:
- Code: Select all
{CardType==Artifact}
which is doing a comparison between the CardType property and property named 'Artifact', which I doubt exists, so returns false.
Regards.