0

I’m trying to pull in variable values from a SSJS continent block.

I’ve looped over a base name to create incremental variable names.

It is putting out the literal variable names in to the email as opposed to the values (in attached image). I’m curious if I missed a step or need to wrap it something.

example of rendering


%%=ContentBlockbyKey("ssjs_testing")=%%

%%[

FOR @i = 0 TO 2 DO ]%%

%%[ SET @test_data = Concat('%%=v(@mls_number_0', @i,')=%%')]%%

<p>
  
</p>%%=v(@test_data)=%%</p>

%%[NEXT @i
]%%
Adam Spriggs
  • 626
  • 8
  • 23
Jason G
  • 1
  • 1
  • You'll get a lot more eyes on your SFMC questions over at [salesforce.stackexchange.com](http://salesforce.stackexchange.com), specifically with the [marketing-cloud](http://salesforce.stackexchange.com/questions/tagged/marketing-cloud) and [ampscript](http://salesforce.stackexchange.com/questions/tagged/ampscript) tags. – Adam Spriggs Oct 28 '22 at 16:36

1 Answers1

0

You're mixing inline AMPscript in your AMPscript block.

This:

%%[ SET @test_data = Concat('%%=v(@mls_number_0', @i,')=%%')]%%

Should be:

%%[ SET @test_data = Concat('@mls_number_0', @i) ]%%

In context:

%%=ContentBlockbyKey("ssjs_testing")=%%

%%[

FOR @i = 0 TO 2 DO ]%%

%%[ SET @test_data = Concat('@mls_number_0', @i) ]%%

%%=v(@test_data)=%%

%%[ NEXT @i ]%%
Adam Spriggs
  • 626
  • 8
  • 23
  • I appreciate the answer and that makes sense to remove the inlining, unfortunately I'm still getting the same results with the literal names in the preview – Jason G Oct 28 '22 at 18:25