0

I have the following DE called Metering_ElecDE_email

enter image description here

Where there is a match with Email (in this case 1)i want the Email to display as per below.

Supply address: Hamilton (next line) ICP: ert (next line) Customer number: 321 (next line)

Supply address: Auckland (next line) ICP: ert (next line) Customer number: 432

I have the below which (i know) is wrong. Any help here is appreciated.

%%[ var @rows, @row, @rowcount, @i, @ICP, @supply_address, @customer_number, @Emailaddress,
set @rows = lookupRows ("Metering_ElecDE_email", "subscriber_key",_subscriberkey” )

set @rowcount = rowcount(@rows)

if @rowcount > 0 then

for @i = 1 to @rowcount do

set @row = row(@rows, @i) /*get row based on loop counter */

set @ICP = field(@row,"ICP")
set @site_address = field(@row,"supply_address")
set @party_code = field(@row,"customer_number")
]%% 


ICP: %%=v(@icp)=%%
Supply address: %%=v(@supply_address)=%%
Customer number: %%=v(@customer_number)=%%

%%[next @i]%%

%%[endif]%%

I am not getting the desired output. Sorry am not a coder.

  • what is wrong? I don't see an endif and your lookup rows should be on email instead of emailaddress and what does @email set to? – EazyE Feb 26 at 1:46
  • i have edited the script. – Rahul G Feb 26 at 2:13
  • what does the current output look like? Your lookuprows still looks incorrect I believe you should have something like lookupRows("Metering_ElecDE_email", "email",_subscriberkey) – EazyE Feb 26 at 2:17
1

It appears you simply have a bunch of typos in your code if your DE image is accurate, I believe this may fix your issue:

%%[ var @rows, @row, @rowcount, @i, @ICP, @supply_address, @customer_number, @Emailaddress,
set @rows = lookupRows("Metering_ElecDE_email", "email",emailaddr )

set @rowcount = rowcount(@rows)

if @rowcount > 0 then

for @i = 1 to @rowcount do

set @row = row(@rows, @i) /*get row based on loop counter */

set @ICP = field(@row,"ICP")
set @site_address = field(@row,"supply address")
set @party_code = field(@row,"customer number")
]%% 


ICP: %%=v(@icp)=%%
Supply address: %%=v(@site_address)=%%
Customer number: %%=v(@party_code)=%%

%%[next @i]%%

%%[endif]%%
| improve this answer | |
  • That worked beautifully. Thank you so much. – Rahul G Feb 26 at 19:50
  • @RahulG please mark the answer accepted if it was helpful – EazyE Feb 26 at 20:15

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.