Comparison with an integer from a dropdown list not working I'm not sure if this is a bug or not, but there is something weird going on if I try to compare an integer form a dropdown field to an integer in the template. In short, it doesn't work.

I'm working with a dropdown level field for users from 1 to 15 and use conditionals for content:

{% set integer = 7 %}
{% set mylevel = currentUser.level %}

My level: {{mylevel}}&lt;br&gt;
Number: {{integer}}&lt;br&gt;&lt;br&gt;

{% if mylevel &gt;= integer %}
    {{mylevel}} bigger than or equals {{integer}}
{% else %}
    {{mylevel}} smaller than {{integer}}    
{% endif %}


This outputs:

My level: 8&lt;br&gt;
Number: 7&lt;br&gt;&lt;br&gt;
8 smaller than 7


HOWEVER if I replace the code "currentUser.level" with 8 like:

{% set integer = 7 %}
{% set mylevel = 8 %}

My level: {{mylevel}}&lt;br&gt;
Number: {{integer}}&lt;br&gt;&lt;br&gt;

{% if mylevel &gt;= integer %}
    {{mylevel}} bigger than or equals {{integer}}
{% else %}
    {{mylevel}} smaller than {{integer}}    
{% endif %}


Then the output is:

My level: 8
Number: 7
8 bigger than or equals 7


I checked the database and reinserted all numbers, but nothing changes.

Database had this:

{"options":[{"label":"SG1","value":"1","default":""},{"label":"SG2","value":"2","default":""},{"label":"SG3","value":"3","default":""},{"label":"SG4","value":"4","default":""},{"label":"SG5","value":"5","default":""},{"label":"SG6","value":"6","default":""},{"label":"SG7","value":"7","default":""},{"label":"SG8","value":"8","default":""},{"label":"SG9","value":"9","default":""},{"label":"SG10","value":"10","default":""},{"label":"SG11","value":"11","default":""},{"label":"SG12","value":"12","default":""},{"label":"TG01","value":"13","default":""},{"label":"TG02","value":"14","default":""},{"label":"TG03","value":"15","default":""},{"label":"TG04","value":"16","default":""}]}
You'll want to use:

{% set mylevel = currentUser.level.value %}


If you just use currentUser.level and assign it to a variable, then what you'll get back is a MultiOptionsFieldData class, instead of the value you are expecting.

There is a note on the bottom of the page here that describes it.