function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Elavarasan BalasubramaniyanElavarasan Balasubramaniyan 

Amp script

Hi all,
 
 
          I have code Logic in AMPScript Code:
%%[/* Modify to view AMPScript <div style="display:none"> */
VAR @email, @Split1, @Split2, @Split3, @acts, @acts2, @acts3
SET @rowset = LookupRows("raviDE","Email", "aomemail@gmail.com")
SET @row = Row(@rowset, 1)
set @email = "aomemail@gmail.com"
if rowcount(@rowset) > 0 then 
  set @email = Field(@row, "Email")
endif
set @act = Field(@row,"subscrption")
SET @Rows = BuildRowSetFromString(@act, ",")
set @rowCount = rowcount(@rows) 
output(concat("<br>@rowCount: ", @rowCount))
set @split1 = ""
set @split2 = ""
set @split3 = ""
set @acts = ""
set @acts2 = ""
set @acts3 = ""
if @rowCount > 0 then
  if @rowCount >= 1 then
    SET @Split1 = Field(Row(@Rows, 1), 1)
  endif 
  if @rowCount >= 2 then
    SET @Split2 = Field(Row(@Rows, 2), 1)
  endif 
  if @rowCount >= 3 then
    SET @Split3 = Field(Row(@Rows, 3), 1)
  endif 
  if @Split1 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split1 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
if @Split1 == "Ski Deals Seasonal"  then
      SET@acts2 = "checked" 
  endif
 if @Split2 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split2 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
if @Split2 == "Ski Deals Seasonal"  then
      SET @acts2= "checked" 
  endif
 if @Split3 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split3 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
  if @Split3 == "Ski Deals Seasonal"  then
      SET @acts2= "checked" 
  endif
endif
/*</div>*/
]%%
<br>%%=v(@Split1)=%%
<br>%%=v(@Split2)=%%
<br>%%=v(@Split3)=%%
<form id="myForm" method="post" action="http://pages.S7.exacttarget.com/page.aspx?QS=38dfbe491fab00ea0ad4b925273e8608d40bab6a35b96d3428a16f6a0f519dc7">
<br>Email: <input type="text" name="test4" value="%%=v(@email)=%%" />
<br>Checkbox:<input type="checkbox" name="test5" value="Seasonal travel information and trip ideas"  %%=v(@acts)=%%/> Seasonal travel information and trip ideas
<br><input type="checkbox" name="test5" value="Travel Deals-monthly" %%=v(@acts1)=%%/> Travel Deals-monthly
<br><input type="checkbox" name="test5" value="Ski Deals Seasonal" %%=v(@acts2)=%%/> Ski Deals Seasonal
<br><input type="submit" value="submit"/>
</form>
Here I am using lot of If conditions in these lines:
 
 
if @Split1 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split1 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
if @Split1 == "Ski Deals Seasonal"  then
      SET@acts2 = "checked" 
  endif
 if @Split2 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split2 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
if @Split2 == "Ski Deals Seasonal"  then
      SET @acts2= "checked" 
  endif
 if @Split3 == "Seasonal travel information and trip ideas"  then
      SET @acts= "checked" 
  endif
  if @Split3 == "Travel Deals-monthly"  then
      SET @acts1= "checked" 
  endif
  if @Split3 == "Ski Deals Seasonal"  then
      SET @acts2= "checked" 
  endif
 
 
Is it possible to minimize the If conditions using AMPScript code? can anyone please help me?