0

I'll get right into it. - I am trying to do the following:

I have two DEs one is my send DE, the other is a lookup table.

Let's say both data extensions have a column called [STATE].

The send DE has IL, WA, FL, GA, MN

The lookup DE has IL, WA, FL

I want to compare the two attribute values so if the states don't match or if there is a state in the send DE that isn't in the lookup DE it will show something else.

Some example code below:

%%[

VAR @State1, @State2

SET @State1 = [STATE1]

SET @State2 = Lookup("StateLookupTable", "CITY2", "STATE2", @State1)

IF AttributeValue["STATE1"] != AttributeValue["STATE2"]

THEN (Show this)

ELSE (Show this)

ENDIF

]%%

All help is greatly appreciated!

1

You can try this:

VAR @State, @RowCount_State, @message

SET @State = AttributeValue('STATE')

SET @RowCount_State = RowCount(LookupRows('StateLookupTable','STATE',@State))

IF @RowCount_State == 0 THEN

SET @message = "State is NOT in Lookup DE."

ELSE

SET @message = "State is in Lookup DE."

ENDIF
  • Selim, thank you! - I'm sorry for the late response but this is correct and worked like a charm. – AMPvoyager Jan 15 at 16:57
0

AttributeValue is for retrieving attribute/DE column values from the send context. It also returns an empty string if the attribute doesn't exist.

Your lookup is fine as long as you're only needing a single column value from StateLookupTable. If the row doesn't exist, it'll return an empty string.

I'd write it like this:

%%[

VAR @State1, @State2

SET @State1 = AttributeValue["STATE1"]
SET @State2 = Lookup("StateLookupTable", "CITY2", "STATE2", @State1)

IF @State1 != @State2 THEN 

 /* show this */

ELSE

 /* otherwise show this */

ENDIF

]%%

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.