0

So I have the following Ampscript block at the header of my email:

%%[

Var @current_term_end_date, @rows 

if Rowcount(@rows)>0 then 
 Set @row = Row(@rows, 1) 
 Set @current_term_end_date = Field(@row, "current_term_end_date") 
endif

]%% 

The inline AMpscript is set as %%=format(@Current_term_end_date,"MM/dd/yyyy")=%% so that when that date value is pulled in it displays in the proper format.

Some of our rows don't have the value in that cell, so I'm wanting to configure the block AMPscript so that it will pull in "N/A" into the email. Essentially, I'm wanting to input a conditional into the middle of the If/Then. Is this possible?

0

You could do something like this, where you only format the date if you know it's not blank:

%%[

Var @current_term_end_date, @rows 

/* lookup code here */

Set @current_term_end_date = "N/A"

if Rowcount(@rows) > 0 then 

 Set @row = Row(@rows, 1) 
 Set @current_term_end_date = Field(@row, "current_term_end_date")

 if not empty(@current_term_end_date) then
   Set @current_term_end_date = format(@Current_term_end_date,"MM/dd/yyyy") 
 endif

endif

]%% 

%%=v(@current_term_end_date)=%%

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.