Hello,
Just wondering if someone can please help me on the correct "operator" / approach for an IF or Modifiers call when targeting the various options in a checkbox TV.
(This is in an Evo 1.4.15 site)
I can't get my IF or Modifier calls to work (either direct in a template or in a DocLister call) - I presume because when I select multiple options, the answer changes - I am obviously using the wrong "operator" to check when the condition is met. In IF I am trying inarray, in_array, in, is, =
all without success.
I guess I am looking for something like the equivalent of DocLister's containsOne filter parameter.
This is the scenario...
- I have a checkbox TV with 10 options.
- Each option has a single corresponding Alphabetical letter for a code. For simplicity sake let's presume it is
- A,B,C,D,E,F,G,H,I,J
- I need to assign a score to each option: for each option that is checked give a score of 1, else give 0 (that is the default score and should apply to all unchecked options).
- I need to be able to output the score directly on a template, and also within a DocLister menu.
Anticipated usage is something like this where I return the relevant score per each option...
[[if? &is=`[*my-codes*]:is:A` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:B` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:C` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:D` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:E` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:F` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:G` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:H` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:I` &then=`1` &else=`0`]]
[[if? &is=`[*my-codes*]:is:J` &then=`1` &else=`0`]]
These return 1 true
if only option A is checked...
1: [[if? &is=`[*my-codes*]:inarray:A` &then=`1 true` &else=`0 false`]]
2: [[if? &is=`[*my-codes*]:in_array:A` &then=`1 true` &else=`0 false`]]
3: [[if? &is=`[*my-codes*]:in:A` &then=`1 true` &else=`0 false`]]
4: [[if? &is=`[*my-codes*]:is:A` &then=`1 true` &else=`0 false`]]
5: [[if? &is=`[*my-codes*]:=:A` &then=`1 true` &else=`0 false`]]
These always return 0 false
when multiple various options, including A, are checked...
1: [[if? &is=`[*my-codes*]:inarray:A` &then=`1 true` &else=`0 false`]]
2: [[if? &is=`[*my-codes*]:in_array:A` &then=`1 true` &else=`0 false`]]
3: [[if? &is=`[*my-codes*]:in:A` &then=`1 true` &else=`0 false`]]
4: [[if? &is=`[*my-codes*]:is:A` &then=`1 true` &else=`0 false`]]
5: [[if? &is=`[*my-codes*]:=:A` &then=`1 true` &else=`0 false`]]
If I select A,C,E and use the following, it returns 1 true
but that is obviously not what I need nor sustainable with so many combinations available 😆 ...
[[if? &is=`[*my-codes*]:is:A,C,E` &then=`1 true` &else=`0 false`]]
Any ideas on the correct operator / approach for TVs with checkbox options in this scenario?
Thanks in advance for any help.