0

I'm working on a cloud page where i would like to use an ELSE IF condition instead of two IF conditions. Does any one know a syntax for ELSE IF

Below is my current Ampscript code. These are captured from Form submission via HTTP POST . I don't think that code is necessary here, But if it helps I'm more than happy to add it to the question!

%%[ var @campaignMemberRows, @initialResp, @finalResp set @initialResp = RequestParameter('Attendance') /* Capturing accepted status */ IF @initialResp == "Accept" THEN set @finalResp = "Accepted" ENDIF /* Capturing Declined status */ IF @initialResp == "Decline" THEN set @finalResp = "Declined" ENDIF ]%% 

What I'm rather wanting to do is something like below!(This code just doesn't set the values and doesn't throw any error either)

%%[ /* Capturing accepted status */ IF @initialResp == "Accept" THEN set @finalResp = "Accepted" /* Capturing Declined status */ ELSE IF @initialResp == "Decline" THEN set @finalResp = "Declined" ENDELSEIF ]%% 

NOTE: I'm not looking for IF ELSE condition as there might be more than a couple of responses I might want to capture so I'm specifically looking for ELSE IF condition.

2
  • 1
    have you looked at ternaries i.e IIF? Commented Nov 27, 2018 at 17:52
  • 1
    also change this ENDELSEIF to ENDIF Commented Nov 27, 2018 at 17:54

1 Answer 1

4

Your end statement should just be

"endif"

That would work IF Syntax here

2
  • That looks simple and it worked ! Thanks, only thing is i haven't seen an example with else if so unsure of what goes in the end! Commented Nov 27, 2018 at 17:58
  • Link I provided in answer has a example in the "Using IF Syntax" section Commented Nov 27, 2018 at 18:00

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.