0

I am having issues using greater than and less than in an IF statement, for some reason the statement keeps getting truncated, it's like they system is seeing this as an HTML tag even though it is in brackets.

Has anyone has this issue?

%%[IF @curGPA > '2.24' AND ( @Grade == 'A' OR @Grade == 'B' OR @Grade == 'C' ) THEN]%%
    %%=ContentBlockbyID('37122')=%% 
%%[ELSEIF ( @Grade == 'D' OR @Grade == 'F' ) THEN]%% 
    %%=ContentBlockbyID('38793')=%% 
%%[ELSE]%% 
    %%=ContentBlockbyID('37123')=%%
%%[ENDIF]%%
8
  • Do you get an error message, you can share? (For readability I updated the code to just an ELSE instead of a condition that would pretty much work as an ELSE, as you said in the other comment that you tried that before) Commented Jun 21, 2017 at 16:10
  • Yes, it is an error with formatnumber function: An error occurred when attempting to evaluate a FormatNumber function call. See inner exception for details. Function Call: Formatnumber(@curGPA, 'D2') Commented Jun 21, 2017 at 16:24
  • And with your original code, which error do you receive? Or what exactly is the unexpected behavior? Is the expression unevaluated at all and you don't see any content block? Commented Jun 21, 2017 at 16:30
  • The expression does not evaluate the condition with the '>', only the second and the default 'ELSE' Statement Commented Jun 21, 2017 at 16:52
  • Please update your question to include the code that sets @curGPA Commented Jun 21, 2017 at 16:52

1 Answer 1

0

I'd try something like this that utilizes the Add() function set the data type. I'd also output the values for verification.

%%[

var @curGPA, @grade
set @grade = AttributeValue("grade")
set @curGPA = AttributeValue("curGPA")
set @curGPA = Add(@curGPA,0.0)
output(concat("<br>@curGPA: ",@curGPA))
output(concat("<br>@grade : ",@grade ))

]%%

%%[ IF @curGPA > 2.24 AND ( @Grade == 'A' OR @Grade == 'B' OR @Grade == 'C' ) THEN]%%

    %%=ContentBlockbyID('37122')=%% 

%%[ELSEIF ( @Grade == 'D' OR @Grade == 'F' ) THEN]%% 

    %%=ContentBlockbyID('38793')=%% 

%%[ELSE]%% 

    %%=ContentBlockbyID('37123')=%%

%%[ENDIF]%%
2
  • I think that may have worked, I am testing it now Commented Jun 21, 2017 at 17:29
  • So this actually does work but it creates a new issue in that there is a separate set of rules for anyone with the @curGPA that does not have a value. But I think I can resolve that. Commented Jun 22, 2017 at 14:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .