I'm keep experiencing a problem where the if control statements do not function correctly.
I'm trying to complate a interger value from a fetchxml query but when doing so the value does not match the compared value.
//////////////////////////
The code that is giving a problem is the following: {%if case_status == 0%} try as I might it does not recognise the 0 even though the output from the case_status is 0.
I've changed the assign code to {%assign case_status = caseobj.statecode|plus:0%} to force numeric but this also does not work.
Any advise would be great ?
Hi @FenrirZA
In Optionset field you need to use "label" & "value".
{%assign case_status_value = caseobj.statecode.value%}
{%assign case_status_label = caseobj.statecode.label%}
{%if case_status_value == 0%}
ACTIVE
{%else%}
INACTIVE
{%endif%}
{%if case_status_label == "Active "%}
ACTIVE
{%else%}
INACTIVE
{%endif%}
--------------------------
If you like this post, give a Thumbs up. Where it solved your query, Mark as a Solution so it can help other people!
I've tried the caseobj.statecode.value and assigned that to a variable. I know the variable contains the data seeing I can output it. But when I do the if statement it does not work.
{%assign case_status_value = caseobj.statecode.value%}
{%assign case_status_label = caseobj.statecode.label%}
//Does not Work
{%if case_status_value == 0%}
ACTIVE
{%else%}
INACTIVE
{%endif%}
//Does Work
{%if caseobj.statecode.value == 0%}
ACTIVE
{%else%}
INACTIVE
{%endif%}