0

Our MC is connected to Salescloud. We have one Data Extension and 2 different types: Customer and Center.

DataExtension : Subscriber Key, FirstName, Preferred Center, Billing state, Billing city, Type

Record Examples :

1)Subkey = 123, First Name = rohan, Preferred center = 456,billing address is empty, billing city is empty, type : customer.

2)subkey = 456, billing city = edison, billing state= new jersey , type : Center

Note : for the second record my subscriber key is preferred center from the first record

I am facing trouble to display the Billing city, state for a particular customer in email content . I used lookup rows but as its in all one DE, i am not able to pull the expected values. i cant use other sync DE as this is the only DE which has the fields

1
  • 1
    can you show us the code you have tried so far? Commented Aug 19, 2022 at 6:52

1 Answer 1

0

You would need to do two lookups to get this info (assuming the preferred center field links to a subkey in the same DE.)

Something like:

%%[
  Set @lookup1 = LookUpRows(@myDE,"SubKey",@SubKey)
  IF Rowcount(@lookup1) > 0 THEN
    FOR @i=1 TO Rowcount(@lookup1) DO
      SET @row = Row(@lookup1,@i)
      SET @subkey = Field(@row,"Subkey")
      SET @FirstName = Field(@row,"First Name")
      SET @PreferredCenter = Field(@row,"Preferred center")
      
      SET @lookup2 = LookupRows(@myDE,"Subkey",@PreferredCenter)
      IF Rowcount(@lookup2) > 0 THEN
        SET @row2 = Row(@lookup2,1)
        SET @billingAddress = Field(@row2,"Billing Address")
        SET @billingCity = Field(@row2,"BillingCity")
      ENDIF
    NEXT @i
  ENDIF
]%%

I threw the FOR loop in there just in case, but you can remove it if you only will have 1 result and duplicate the way I set up in Lookup2 instead.

1
  • Thanks ! it helped and worked
    – Rohan
    Commented Aug 22, 2022 at 16:54

You must log in to answer this question.

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