In Marketing cloud - Content Builder

I have an email with some AMPscript (including lookuprows ect) that gives me a particular number of rows in my email table depending on the data in a specific DE.

My table has 3 values:




This works great, however, I am trying to pass these variables to a cloud page.

If there is more than 1 row of data in the table (dependent on the AMPscript mentioned above) then each variable has 2 values e.g. the person has x2 @name/@num/@email & I cant seem to pass all of these values to the cloud page.

E.g if there is 2 Rows in the table - I can only pass one row of the table. From the below example only Sam's details will pass to the cloud page. This is because both Sams and Bobs data is produced from the same variables %%=v(@name)=%% %%=v(@num1)=%% %%=v(@email)=%%)

Sam (%%=v(@name)=%%) 123 (%%=v(@num1)=%%) sam@gmail

Bob (%%=v(@name)=%%) 456 (%%=v(@num1)=%%) [email protected]

Any help would be great?

  • Hi, what is the expected behavior? - the solution is probably somewhere in the "lookuprows etc. " part, please share the code so we can help you. Jun 22, 2021 at 6:21

1 Answer 1


If your LookupRows function returns two rows of data within one email, then you would need to either:

  1. Create a condition, which will set all three variables (@name, @num1, and @email) with only one value and you would not send other values to the CloudPage;
  2. Or extend the link to the CloudPage to make it include all parameters by concatenating all 3 variables with each cycle of the For loop. Thus you would send all possible values of variables in separate parameters.

/* set up LookupRows function yourself based on your DE and field names */
SET @rows = LookupRows(...)

FOR @i = 1 TO rowcount(@rows) DO

    SET @row   = row(@rows, @i)
    SET @name  = field(@row, "Name") /* adjust field name */
    SET @num   = field(@row, "Number") /* adjust field name */
    SET @email = field(@row, "Email") /* adjust field name */

    IF @i == 1 THEN
        SET @parameters = CONCAT('?name', @i, '= ', TreatAsContent(@name), '&num', @i, '= ', TreatAsContent(@num), '&email', @i, '= ', TreatAsContent(@email))
        SET @parameters = CONCAT(@parameters, '&name', @i, '= ', TreatAsContent(@name), '&num', @i, '= ', TreatAsContent(@num), '&email', @i, '= ', TreatAsContent(@email))
NEXT @i 


And that is how you can have a link with all possible parameters - %%=RedirectTo(CloudPagesURL(999, "", @parameters))=%%

If your LookupRows function returns only one row of data, then simply refer to the LookupRows guidelines and correctly set the variables, which later should be passed to the CloudPage via the same logic shown above.

Hope it helps.

  • For Option 2 - name2, email2 & num2 have not been set. When there is two rows of data appearing in my table they are currently both cooing from the original variables %%=v(@name)=%% ect. Jun 22, 2021 at 21:36
  • so what is the question or issue with that option?
    – Niko
    Jun 23, 2021 at 8:50
  • %%=v(@name)=%% can produce multiple values. e.g. Sam & Bob. I want to pass Sam and Bob to the cloud page but they are both set as @name. How can I make it so Sam and bob are set to different variables? Jun 23, 2021 at 21:30
  • I do understand that and in order to do that, you would have to extend the parameters string within your link that is leading to the CloudPage with separate parameters for Bob and Sam. Bob is going to be in the @name1 variable, for example, and Sam in the @name2 variable. But before that, of course, you need to change the logic of parsing the LookupRows function. That is how you can pass both values to the CloudPage via AMPscript.
    – Niko
    Jun 24, 2021 at 17:56
  • Yeah I'm just not sure how to go about changing my current logic so that this is possible. Thanks for the help though :) Jun 25, 2021 at 0:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .