Skip to main content
formatting, remove extra styles for readability
Source Link
Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88

I'm extremely new to using AMPSCRIPTAMPScript, and wonder if any of you AMPSCRIPTAMPScript savvies can help me. I

I am trying to create an AMPSCRIPTAMPScript inside of an AMPSCRIPTAMPScript. The

The point to this HTML is to present the user a graph of his last 5 weeks of stats. If

If the user doesn’t have stat for 5 weeks but only 4 or 3 or 2 the stat’s graph will present only the weeks he have stat in. In

In my DE I have a column of flag_weekstartflag_weekstart that helps me to determine how many weeks to present in the graph. The 5Total

The 5Total attribute represent the total stat a user has in week number 5 (5weeks5 weeks ago). I

I am using this code:

<!--%%[

VAR @5Total
SET @5Total = AttributeValue("5Total")
 

VAR @weekstart1

IF [flag_weekstart] == "5" THEN
     
 SET @weekstart1 = '
                    <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="20%" style="border-top:3px solid #000000;">style="">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana,style="">Aug Geneva,28</span>
 sans-serif;font-size:18px;color:#5B6770;text-align:center;">Aug 28<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">style="">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Weekstyle="">Sep of<br><span04</span>
 style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 04<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">style="">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana,style="">Sep Geneva,11</span>
 sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 11<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">style="">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana,style="">Sep Geneva,18</span>
 sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 18<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">style="">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana,style="">Sep Geneva,25</span>
 sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 25<br>&nbsp;</span></center>  </span></td>
                 </tr>
                </table>
 
                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="100%" style="border-bottom:1px solid #A3C70D;">style="">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>Totalstyle=""><center>Total Measurements</center></span>
    </td>
                 </tr>
                </table>
 
                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%=vstyle=""><center>%%=v(@5Total)=%%<br>&nbsp;</center></span>
    </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%4Total%%<br>&nbsp;<style=""><center>%%4Total%%<br>&nbsp;</center></span> </td>
               </td>
    <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%3Total%%<br>&nbsp;<style=""><center>%%3Total%%<br>&nbsp;</center></span>  </td>
               </td>
    <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%2Total%%<br>&nbsp;<style=""><center>%%2Total%%<br>&nbsp;</center></span>  </td>
               </td>
    <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%1Total%%<br>&nbsp;<style=""><center>%%1Total%%<br>&nbsp;</center></span>  </td>
               </td>
  </tr>
                </table>table>'
]%%

The code is continuing with: IF [flag_weekstart] == "4" THENIF [flag_weekstart] == "4" THEN Until

Until 1.

I tried puling the 5Total5Total attribute using %%=v(@5Total)=%%%%=v(@5Total)=%% and %%5Total%%%%5Total%% with no luck.

The value I am getting is %%5Total%%%%5Total%% like the AMPSCRIPT doesn’tAMPScript doesn't know from where to pull the data from.

I'm extremely new to using AMPSCRIPT, and wonder if any of you AMPSCRIPT savvies can help me. I am trying to create an AMPSCRIPT inside of an AMPSCRIPT. The point to this HTML is to present the user a graph of his last 5 weeks of stats. If the user doesn’t have stat for 5 weeks but only 4 or 3 or 2 the stat’s graph will present only the weeks he have stat in. In my DE I have a column of flag_weekstart that helps me to determine how many weeks to present in the graph. The 5Total attribute represent the total stat a user has in week number 5 (5weeks ago). I am using this code:

<!--%%[

VAR @5Total
SET @5Total = AttributeValue("5Total")
 

VAR @weekstart1

IF [flag_weekstart] == "5" THEN
     SET @weekstart1 = '
                    <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Aug 28<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 04<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 11<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 18<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 25<br>&nbsp;</span></center>  </span></td>
                 </tr>
                </table>
 
                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="100%" style="border-bottom:1px solid #A3C70D;">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>Total Measurements</center></span>  </td>
                 </tr>
                </table>
 
                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%=v(@5Total)=%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%4Total%%<br>&nbsp;</center></span> </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%3Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%2Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%1Total%%<br>&nbsp;</center></span>  </td>
                 </tr>
                </table>

The code is continuing with: IF [flag_weekstart] == "4" THEN Until 1.

I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.

The value I am getting is %%5Total%% like the AMPSCRIPT doesn’t know from where to pull the data from.

I'm extremely new to using AMPScript, and wonder if any of you AMPScript savvies can help me.

I am trying to create an AMPScript inside of an AMPScript.

The point to this HTML is to present the user a graph of his last 5 weeks of stats.

If the user doesn’t have stat for 5 weeks but only 4 or 3 or 2 the stat’s graph will present only the weeks he have stat in.

In my DE I have a column of flag_weekstart that helps me to determine how many weeks to present in the graph.

The 5Total attribute represent the total stat a user has in week number 5 (5 weeks ago).

I am using this code:

%%[

VAR @5Total
SET @5Total = AttributeValue("5Total")

VAR @weekstart1

IF [flag_weekstart] == "5" THEN
 
 SET @weekstart1 = '
 <table width="90%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="20%" style="">
      <span style="">Aug 28</span>
    </td>
    <td width="20%" style="">
      <span style="">Sep 04</span>
    </td>
    <td width="20%" style="">
      <span style="">Sep 11</span>
    </td>
    <td width="20%" style="">
      <span style="">Sep 18</span>
    </td>
    <td width="20%" style="">
      <span style="">Sep 25</span>
    </td>
  </tr>
</table>
<table width="90%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="100%" style="">
      <span style=""><center>Total Measurements</center></span>
    </td>
  </tr>
</table>
<table width="90%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td width="20%">
      <span style=""><center>%%=v(@5Total)=%%<br>&nbsp;</center></span>
    </td>
    <td width="20%">
      <span style=""><center>%%4Total%%<br>&nbsp;</center></span> 
    </td>
    <td width="20%">
      <span style=""><center>%%3Total%%<br>&nbsp;</center></span>  
    </td>
    <td width="20%">
      <span style=""><center>%%2Total%%<br>&nbsp;</center></span>  
    </td>
    <td width="20%">
      <span style=""><center>%%1Total%%<br>&nbsp;</center></span>  
    </td>
  </tr>
</table>'
]%%

The code is continuing with: IF [flag_weekstart] == "4" THEN

Until 1.

I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.

The value I am getting is %%5Total%% like the AMPScript doesn't know from where to pull the data from.

edited tags, adj title
Link
Adam Spriggs
  • 31.1k
  • 6
  • 44
  • 88

create an AMPSCRIPT inside of an AMPSCRIPT Create a simple AMPScript graph

Week of
Aug 28
 Week of
Sep 04
 Week of
Sep 11
 Week of
Sep 18
 Week of
Sep 25
 Total Measurements%%=v(@5Total)=%%
 %%4Total%%
 %%3Total%%
 %%2Total%%
 %%1Total%%
 The code is continuing with:IF [flag_weekstart] == "4" THEN …
<!--%%[

VAR @5Total
SET @5Total = AttributeValue("5Total")


VAR @weekstart1

IF [flag_weekstart] == "5" THEN
     SET @weekstart1 = '
                    <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Aug 28<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 04<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 11<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 18<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 25<br>&nbsp;</span></center>  </span></td>
                 </tr>
                </table>

                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="100%" style="border-bottom:1px solid #A3C70D;">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>Total Measurements</center></span>  </td>
                 </tr>
                </table>

                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%=v(@5Total)=%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%4Total%%<br>&nbsp;</center></span> </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%3Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%2Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%1Total%%<br>&nbsp;</center></span>  </td>
                 </tr>
                </table>
Until 1.I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.The value I am getting is %%5Total%% like the AMPSCRIPT doesn’t know from where to pull the data from.Any ideas?

The code is continuing with: IF [flag_weekstart] == "4" THEN … Until 1.

I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.

The value I am getting is %%5Total%% like the AMPSCRIPT doesn’t know from where to pull the data from.

Any ideas?

Week of
Aug 28
 Week of
Sep 04
 Week of
Sep 11
 Week of
Sep 18
 Week of
Sep 25
 Total Measurements%%=v(@5Total)=%%
 %%4Total%%
 %%3Total%%
 %%2Total%%
 %%1Total%%
 The code is continuing with:IF [flag_weekstart] == "4" THEN …Until 1.I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.The value I am getting is %%5Total%% like the AMPSCRIPT doesn’t know from where to pull the data from.Any ideas?
<!--%%[

VAR @5Total
SET @5Total = AttributeValue("5Total")


VAR @weekstart1

IF [flag_weekstart] == "5" THEN
     SET @weekstart1 = '
                    <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Aug 28<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 04<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 11<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 18<br>&nbsp;</span></center>  </span></td>
                  <td width="20%" style="border-top:3px solid #000000;">
                <span style="font-family:Verdana, Geneva, sans-serif;font-size:14px;color:#5B6770;text-align:center;"><center>Week of<br><span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#5B6770;text-align:center;">Sep 25<br>&nbsp;</span></center>  </span></td>
                 </tr>
                </table>

                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                  <td width="100%" style="border-bottom:1px solid #A3C70D;">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>Total Measurements</center></span>  </td>
                 </tr>
                </table>

                <table width="90%" cellspacing="0" cellpadding="0" align="center">
                 <tr>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%=v(@5Total)=%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%4Total%%<br>&nbsp;</center></span> </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%3Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%2Total%%<br>&nbsp;</center></span>  </td>
                   <td width="20%">
                <span style="font-weight:bold;font-family:Verdana, Geneva, sans-serif;font-size:18px;color:#A3C70D;text-align:left;"><center>%%1Total%%<br>&nbsp;</center></span>  </td>
                 </tr>
                </table>

The code is continuing with: IF [flag_weekstart] == "4" THEN … Until 1.

I tried puling the 5Total attribute using %%=v(@5Total)=%% and %%5Total%% with no luck.

The value I am getting is %%5Total%% like the AMPSCRIPT doesn’t know from where to pull the data from.

Any ideas?

Source Link
Loading