Question 1
IntermediateProgrammatic Content · AMPscript
A developer is tasked with retrieving specific subscriber details from a Data Extension named 'LoyaltyMembers' for an email send. The email must display the member's tier status. If the subscriber is not found in the 'LoyaltyMembers' Data Extension, the email should default the tier to 'Bronze'. Which AMPscript function provides the most efficient way to achieve this lookup while handling the default value inline?
Answer and explanation
Correct answer: B
The Lookup() function is designed to return a specific field value from a Data Extension. To handle the default 'Bronze' value efficiently, the developer can wrap the Lookup() function in a conditional statement or use the AttributeValue() function in conjunction with an inline check. However, compared to LookupOrderedRows (which returns a rowset), Lookup returns the specific scalar value directly, which is more performant for single-value retrieval. The default logic is typically handled as: SET @tier = Lookup(...) IF EMPTY(@tier) THEN SET @tier = 'Bronze' ENDIF.
