1

I have something weird going on with my code. I have a Data Extension name “DEXT Seeds”. I am checking the DataSourceName_ to see if this list is picked by a user. I have an if/else statement that says if DataSourceName_ contains Seed, then the variable Seedsource equals “columnSeed” from the local Data Extension. Otherwise lookup Columnsource that matches the subscriberkey from a shared Data Extension.

My issue is that the DEXT Seeds works if I pick a seeded list. But if I pick something outside of the seeded list, I get an error that says it is looking for “columnSeed”. But I don’t want it to pull in ColumnSeed, I want it to lookup Columnsource. Why is it still trying to evaluate columnSeed when it should ignore this code and evaluate the Lookup. Please see the code below.

SET @DEXT = _DataSourceName

SET @SubscriberKey = [Customer ID]

IF Indexof(@DEXT, "Seed") > 0 THEN

SET @Seedsource = [columnSeed]

ELSE

SET @Seedsource = Lookup('ENT.Shared_DE','Column1','SubscriberKey', @SubscriberKey)

ENDIF

1 Answer 1

2

I think your issue may be that the IndexOf() will pick up anything that has Seed in it. Including "Conciseedition" or similar.

I would define this a bit more defensively with something like:

SET @DEXT = AttributeValue("_DataSourceName")
SET @SubscriberKey = AttributeValue("Customer ID")
SET @Seed = AttributeValue("columnSeed")

IF NOT EMPTY(@Seed) AND @Seed != "" THEN

  SET @Seedsource = AttributeValue("columnSeed")

ELSE

  SET @Seedsource = Lookup('ENT.Shared_DE','Column1','SubscriberKey', @SubscriberKey)

ENDIF

I always utilize AttributeValue() for all personalization string references as it is better at handling null and Empty values - reducing the amount of unnecessary errors.

In this case, we are using the AttributeValue() function to check and see if that field exists. If the value comes up empty, then we know that it either does not exist in the sendable DE, or that the value inside of the column is empty.

1
  • 1
    Thank you #Gortonington. I didn't think about using the AttributeValue function rather than calling the column directly. That cleared the error.
    – HHF21
    Feb 8, 2019 at 19:13

You must log in to answer this question.

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